Commit Graph

46 Commits

Author SHA1 Message Date
Marton Balint
da36bcbeb7 ffmpeg: fix -stream_loop with multiple inputs
The input thread needs to be properly cleaned up and re-initalized before we
can start reading again in threaded mode. (Threaded input reading is used when
there is mode than one input file).

Fixes ticket #6121 and #7043.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-07-02 11:58:08 +02:00
Marton Balint
b181cd359b ffmpeg: factorize input thread creation and destruction
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-07-02 11:58:08 +02:00
Gyan Doshi
07987404a8 ffmpeg: make loglevel verbose for frame duration warning 2018-06-28 14:08:51 +05:30
Hans Carlson
a790813739 ffmpeg: Treat subtitles like audio and video for non-monotonic dts.
Fixes ticket #4450.
Fixes ticket #6248.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-23 01:06:29 +02:00
Jun Zhao
24be912827 fftools/ffmpeg: Replace the number by macro for bprint init
Replace the number by macro for bprint init.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
2018-06-17 09:59:33 +08:00
Michael Niedermayer
28d33c252e ffmpeg: assert that audio packet duration in process_input_packet() is non negative
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-14 18:55:45 +02:00
Michael Niedermayer
16d8b13b3b fftools/ffmpeg: Fallback to duration if sample rate is unavailable
Regression since: af1761f7
Fixes: Division by 0
Fixes: ffmpeg_crash_1

Found-by: Thuan Pham, Marcel Böhme, Andrew Santosa and Alexandru Razvan Caciulescu with AFLSmart
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-14 18:55:45 +02:00
Carl Eugen Hoyos
5686c4489a ffmpeg: Fail if the user requested impossible subtitle encoding.
Fixes ticket #7239.
2018-06-09 21:34:27 +02:00
Vishwanath Dixit
146cdf7e4b fftools/ffmpeg: fix for all forced key frames when 'copyts' is enabled
Forced key frames generation functionality was assuming the first PTS
value as zero, but, when 'copyts' is enabled, the first PTS can be any
big number. This was eventually forcing all the frames as key frames.
To resolve this issue, update has been made to use first input pts as
reference pts.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-06-04 22:26:55 +02:00
Tobias Rapp
a150b2e3a0 fftools/ffmpeg: properly initialize output stream field order
Fixes stream field order written by avformat_write_header when "top"
option is specified on the command-line.

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2018-05-02 08:35:08 +02:00
James Almer
e3866ea20d fftools/ffmpeg: fix mixed code and declarations
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-04-30 18:22:51 -03:00
André Camargo
1322b00060 fftools/ffmpeg: change fps progress log message to show two decimal digits
Useful when transcoding videos at 29.97 fps because delivers a more accurate result for monitoring.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-28 18:08:52 +02:00
Mark Wachsler
9d75354963 fftools/ffmpeg: Add system time and real time to benchmarking.
The -benchmark and -benchmark_all options now show user, system, and real time,
instead of just user time.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-28 18:08:52 +02:00
Timo Teräs
94d831f388 ffmpeg: allow setting attached_pic disposition
This is used to signal that image should be stored in metadata
as cover image.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-04 19:09:28 +02:00
Josh de Kock
89029bd2c7 lav*,tests: remove several register_all calls
avdevice_register_all() is still required to register devices into
lavf (this is required due to lavd being somewhat of a hack).

Signed-off-by: Josh de Kock <josh@itanimul.li>
2018-04-02 03:26:22 +01:00
Jan Ekström
e760c12aee ffmpeg: prevent premature EOF in sub2video with nullptr AVSubtitles
With certain types of input and the filter chain getting re-initialized
or re-configured, multiple nullptr AVSubtitles can get pushed into
sub2video_update() in a row from sub2video_heartbeat.

This causes end_pts, and on the next round pts, to become INT64_MAX,
latter of which signals EOF in framesync, leading to complete loss of
subtitles from that point on.

Thus, check that the sub2video.end_pts is smaller than INT64_MAX
in a similar fashion to sub2video_flush before sending out the
nullptr AVSubtitle. This keeps premature EOFs from happening in
framesync and the subtitle overlay is kept past the filter chain
re-initializations/configurations.
2018-04-01 13:56:31 +03:00
Carl Eugen Hoyos
11f8f9547d fftools/ffmpeg: Remove an unused variable.
Fixes a warning:
fftools/ffmpeg.c:2201:22: warning: unused variable 'fg'
2018-03-30 12:01:58 +02:00
Marton Balint
0031eab61c ffmpeg: do not finish output streams manually on eof even if no input is provided
The generic code should be able to finish the streams just fine initializing
and flushing the filters and codecs properly.

Fixes the following command:

ffmpeg -f lavfi -i "testsrc=d=0.1[out0];aevalsrc=0:d=0[out1]" -af apad -shortest -f framecrc -

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-03-29 00:07:39 +02:00
Marton Balint
60c9a25530 ffmpeg: fallback to codecpar parameters on input filter eof
Fixes ticket #6854 and the following simpler case:

ffmpeg -f lavfi -i testsrc=d=1 -f lavfi -i testsrc=d=0 -filter_complex overlay -f null none

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-03-29 00:07:39 +02:00
James Almer
231a73308f ffmpeg: pass reference counted packet on codec copy when possible
Should prevent unnecessary copy of data in cases where new references
to the packet are created within the muxer or a bitstream filter.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-23 22:05:25 -03:00
James Almer
f5ceb15bb6 ffmpeg: remove dead call to av_parser_change()
It's been a noop for years, and it's been argued that in-band headers
should not be forcedly removed without the user's explicit request.

Also, as the FIXME line stated, this is a job for a bitstream filter
like extract_extradata, remove_extradata, dump_extradata, and
filter_units.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-03-23 22:03:22 -03:00
Gyan Doshi
8ad83044b4 ffmpeg.c - drain all decoded frames during stream_loop flush
When a decoded stream is being looped, after each post-EOF rewind,
decoders are flushed in seek_to_start(). This only drains 1 frame, and
thus the output has a few frames missing at the tail of each iteration
except the last.

With this patch, process_input is looped till process_input_packet
reaches EOF.

Fixes #7081

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-03-20 22:59:40 +01:00
Tobias Rapp
69995a94d8 fftools/ffmpeg: update print_report to use AVBPrint API
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2018-03-05 09:24:55 +01:00
Tobias Rapp
a194e9c415 fftools/ffmpeg: fix progress log message in case pts is not available
Also fixes sign prefix for progress report.

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2018-03-05 09:24:40 +01:00
Tobias Rapp
fa0c9d69d3 fftools/ffmpeg: replace call to av_strerror with av_err2str
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2018-02-27 08:34:35 +01:00
Tomas Härdin
5caae27979 Don't complain about codec2's 700 bit/s modes in ffmpeg.c 2018-02-24 17:06:31 +01:00
Aman Gupta
4f40d64e00 avformat/mpegts: set AV_DISPOSITION_DEPENDENT for mix_type=0 supplementary audio
Signed-off-by: Aman Gupta <aman@tmm1.net>
2018-02-23 13:47:29 -08:00
Marton Balint
25a2d269bd fftools, tools, examples: migrate to AVFormatContext->url
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-01-28 23:06:43 +01:00
Mark Thompson
74cf4a75f7 ffmpeg: Ignore SIGPIPE
On systems which deliver SIGPIPE (Unices), a broken pipe will currently
result in the immediate termination of the ffmpeg process (the default
disposition as required by POSIX).  This is undesirable, because while
the broken pipe is likely fatal to useful cleanup of whatever component
is writing to it, there might be other components which can do useful
cleanup - for example, a muxer on another stream may still need to write
indexes to complete a file.  Therefore, set the signal disposition for
SIGPIPE to ignore the signal - the call which caused the signal will
fail with EPIPE and the error will be propagated upwards like any other
I/O failure on a single stream.
2018-01-25 22:54:10 +00:00
James Almer
414a49d671 ffmpeg: use thread wrappers for the thread message functionality
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
2018-01-04 15:22:09 -03:00
Mark Thompson
b0cd14fb1d ffmpeg: Use codec hardware config to configure hwaccels
Removes specific support for all hwaccels supported by the generic code
(DXVA2, D3D11VA, NVDEC, VAAPI and VDPAU).
2017-11-26 21:41:19 +00:00
Jun Zhao
a5870cb37f ffmpeg: add return value check to supress the build warning.
add return value check to supress the build warning message like
"warning: ignoring return value" when use attribute -Wunused-result.

Signed-off-by: Jun Zhao <jun.zhao@intel.com>
Reviewed-by: 刘歧 <lq@chinaffmpeg.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-21 03:13:03 +01:00
James Almer
e9025beacb ffmpeg: remove usage of AVCodecContext accessors
Signed-off-by: James Almer <jamrial@gmail.com>
2017-11-15 01:14:22 -03:00
Timo Rothenpieler
6a4d1c9063 ffmpeg: use explicitly requested hwaccel only
With there being two hwaccels that use the CUDA pix_fmt now, just
relying on the pix_fmt to identify the selected hwaccel is not enough
anymore.

So this checks if the user explicitly selected a hwaccel, and only
accepts that one.
2017-11-11 14:19:05 +01:00
James Almer
09100ccc14 Merge commit 'a58873b11198d04670b7f98f5a8a749d742db7c5'
* commit 'a58873b11198d04670b7f98f5a8a749d742db7c5':
  avconv: when using -loop option bail out if seek to start fails

Merged-by: James Almer <jamrial@gmail.com>
2017-11-10 20:24:37 -03:00
Peter Große
0ae1f6ddeb ffmpeg.c: fix code style in seek_to_start
Signed-off-by: Peter Große <pegro@friiks.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-05 03:14:29 +01:00
Peter Große
3ddb887c88 ffmpeg.c: fix calculation of input file duration in seek_to_start()
Fixes looping files without audio or when using stream_copy, where
ist->nb_samples is not set since no decoding is done.

This fixes ticket #5719 and also fixes an endless loop with the sample
in ticket #6139.

Signed-off-by: Peter Große <pegro@friiks.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-11-05 03:14:29 +01:00
Mark Thompson
cf17086982 ffmpeg: Fix flush packet stream copy input timestamp handling
Since a7da134742, flush packets are passed
to process_input_packet() during stream copy.  This modifies the input
timestamp handling to ignore them - since they contain no data, timestamps
should not be affected.
2017-11-01 19:55:56 +00:00
James Almer
88c7aa13dd Merge commit '91622f6446b463abe6507ad2cd5d1fbf7e49c424'
* commit '91622f6446b463abe6507ad2cd5d1fbf7e49c424':
  avconv: Always initialize the opkt struct on streamcopy

Merged-by: James Almer <jamrial@gmail.com>
2017-10-31 13:41:37 -03:00
James Almer
a7da134742 Merge commit '4d56f7ab8f627aa140c1ede1bb61305f01cefcdd'
* commit '4d56f7ab8f627aa140c1ede1bb61305f01cefcdd':
  avconv: Flush output BSFs when stream copy reaches EOF

Merged-by: James Almer <jamrial@gmail.com>
2017-10-30 23:07:15 -03:00
Michael Niedermayer
f1251a6b9c ffmpeg: Fix stored encoder metadata with -bitexact
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-10-30 21:32:26 +01:00
Carl Eugen Hoyos
693a11b8a2 lavf: Remove AVFMT_RAWPICTURE.
Deprecated since October 2015.
2017-10-26 23:43:11 +02:00
Marton Balint
f4090940bd ffmpeg: always init output stream before reaping filters
Otherwise the frame size of the codec is not set in the buffersink.

Fixes ticket #6603 and the following simpler case:

ffmpeg -c aac -filter_complex "sine=d=0.1,asetnsamples=1025" out.aac

Signed-off-by: Marton Balint <cus@passwd.hu>
2017-10-18 21:52:47 +02:00
Sasi Inguva
2b006ccf83 ffmpeg.c: Fallback to duration_dts, when duration_pts can't be determined.
This is required for FLV files, for which duration_pts comes out to be zero.

Signed-off-by: Sasi Inguva <isasi@google.com>
Reviewed-by: Thomas Mundt <tmundt75@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-10-12 01:27:52 +02:00
Marton Balint
41569bbc66 ffmpeg: always use single threaded decoding for attached pictures
Since af1761f7b5 ffmpeg waits for a frame in each
stream before writing the output header. If we are using threaded decoding for
attached pictures, we have to read till EOF to be able to finally flush the
decoder and output the decoded frame. This essentially makes ffmpeg buffer all
non-attached picture packets, which will cause a "Too many packets buffered for
output stream" eventually.

By forcing single threaded decoding, we get a frame from a single packet as
well and we can avoid the error.

Fixes part of ticket #6375:
ffmpeg -i 46564100.mp3 -acodec libmp3lame -ab 128k -ac 2 out.mp3

Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2017-10-08 22:32:13 +02:00
James Almer
fd5f4ac081 Merge commit 'c95169f0ec68bdeeabc5fde8aa4076f406242524'
* commit 'c95169f0ec68bdeeabc5fde8aa4076f406242524':
  build: Move cli tool sources to a separate subdirectory

Merged-by: James Almer <jamrial@gmail.com>
2017-10-01 18:26:36 -03:00