1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-18 03:19:31 +02:00
Commit Graph

2344 Commits

Author SHA1 Message Date
Nicolas George
8043d8eb3b ffmpeg: send EOF pts to filters. 2017-09-08 10:31:07 +02:00
Nicolas George
36c111c40f ffmpeg: use reordered duration for stream PTS. 2017-09-08 10:21:59 +02:00
Nicolas George
dfed8e2cbb ffmpeg: rename a variable.
Makes the reason of the "FIXME" comment more obvious.
Avoid name conflicts for the next commit.
2017-09-08 10:21:59 +02:00
James Almer
8a0954dd51 avcodec: add missing FF_API_DEBUG_MV wrappers
Signed-off-by: James Almer <jamrial@gmail.com>
2017-08-25 13:44:52 -03:00
Wan-Teh Chang
dc11a467e6 ffmpeg: Fix typos in the comment for decode() ("." vs. "->")
pkt is a pointer, so it should be dereferenced with the -> operator.

Signed-off-by: Wan-Teh Chang <wtc@google.com>
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-07-07 03:48:56 +02:00
Mark Thompson
bc4e33ce0f ffmpeg: Flush output BSFs when encode reaches EOF
Before this, output bitstream filters would never see EOF and
therefore would not be able to flush any delayed packets.

(cherry picked from commit f64d1100a5)
2017-06-24 15:23:30 +01:00
wm4
f1df7cc10c ffmpeg: remove misleading and incorrect warning messages
It is wrong/incorrect in two aspects:
1. The pixel format is not enough to guarantee that the resulting file
   will be any more compatible with media players.
2. Media players not supporting higher profiles are not necessarily
   outdated (in fact this is simply an arrogant statement that
   libavcodec can handle these particular features).

You could add that there are plenty of other ways to produce widely
incompatible files with ffmpeg, and these don't show any warnings.

What we really want to do here is defaulting to codec profiles that
have wide compatibility, such as main/high for h264. Also, if an
encoder does not accept certain pixfmts, we should automatically
convert them to a pixfmt the encoder can accept. But the existing
message certainly is not appropriate.

It also works for 2 specific encoders only. Extending it for other
cases would result in a lot of special cases, so this is not the
right place.
2017-06-20 10:03:30 +02:00
Mark Thompson
06043cc0bc ffmpeg: Generic device setup
Not yet enabled for any hwaccels.

(cherry picked from commit d2e6dd32a4)
(cherry picked from commit 9203aac228)
2017-06-14 22:26:32 +01:00
James Almer
f1cdc01e72 ffmpeg: remove bsf extradata propagation hack
The offending bitstream filter was fixed, so this is no longer needed.

Signed-off-by: James Almer <jamrial@gmail.com>
2017-05-24 20:28:00 -03:00
erankor
2b06f2d2e2 ffmpeg: add enc_time_base option
add a per-stream option for setting the encoder timebase.
the following values are allowed:
0 - for video, use 1/frame_rate, for audio use 1/sample_rate (this is
  the default)
-1 - match the input timebase (when possible)
>0 - set the timebase to provided number

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-05-10 14:00:20 +02:00
Muhammad Faiz
c4be288fdb ffmpeg: count packets when queued
Because write_packet() fakely writes packets to muxer by queueing
them when muxer hasn't been initialized, it should also increment
frame_number fakely.
This is required because code in do_streamcopy() rely on
frame_number.

Should fix Ticket6227

Reviewed-by: James Almer <jamrial@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-05-03 01:47:32 +07:00
Nicolas George
0dfb4d4b43 ffmpeg: do not report EOF on filters as an error.
Also print the error message in case of real error.
2017-04-23 14:22:22 +02:00
Muhammad Faiz
8893c943a9 ff*: do not use AVFrame accessor
Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-04-23 14:43:31 +07:00
Marton Balint
c037f2f1ba ffmpeg; check return code of avcodec_send_frame when flushing encoders
Fixes Coverity CID 1404841.

Signed-off-by: Marton Balint <cus@passwd.hu>
2017-04-22 22:56:51 +02:00
Michael Niedermayer
d0b3922d24 ffmpeg: Clear fifo pointer on deallocation
Not leaving stale pointers is more robust

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-04-18 03:18:50 +02:00
James Almer
b438a7868c ffmpeg: use av_stream_new_side_data() in init_output_stream 2017-04-08 01:12:57 -03:00
James Almer
9f102653fd ffmpeg: use av_stream_new_side_data()
Signed-off-by: James Almer <jamrial@gmail.com>
2017-04-07 16:48:21 -03:00
Michael Niedermayer
0e2f0fedcd ffmpeg: Change duration to int64_t
It is assigned from 64bit input in some branches and used with 64bit timestamps
This thus fixes a potential integer truncation

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-04-07 00:07:08 +02:00
Ronald S. Bultje
76d8c77430 ffmpeg: make transcode_init_done atomic.
Should fix tsan warnings in fate-fifo-muxer-h264/wav:

WARNING: ThreadSanitizer: data race (pid=26552)
  Write of size 4 at 0x000001e0d7c0 by main thread:
    #0 transcode_init src/ffmpeg.c:3761 (ffmpeg+0x00000050ca1c)
[..]
  Previous read of size 4 at 0x000001e0d7c0 by thread T1:
    #0 decode_interrupt_cb src/ffmpeg.c:460 (ffmpeg+0x0000004fde19)
2017-04-03 09:38:10 -04:00
Michael Niedermayer
004f27f0fb ffmpeg: Fix avframe memleak
Fixes CID1401674

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-30 16:34:06 +02:00
Matthieu Bouron
b5e1ec5660 Merge commit 'e3fb74f7f9a8f1895381355f40c92cac3c1023d9'
* commit 'e3fb74f7f9a8f1895381355f40c92cac3c1023d9':
  lavfi: Always propagate hw_frames_ctx through links

Merged-by: Matthieu Bouron <matthieu.bouron@gmail.com>
2017-03-30 00:02:08 +02:00
Clément Bœsch
549045254c Fix all -Wformat warnings raised by DJGPP 2017-03-29 14:49:29 +02:00
wm4
ddef3d902f avformat, ffmpeg: deprecate old rotation API
The old "API" that signaled rotation as a metadata value has been
replaced by DISPLAYMATRIX side data quite a while ago.

There is no reason to make muxers/demuxers/API users support both. In
addition, the metadata API is dangerous, as user tags could "leak" into
it, creating unintended features or bugs.

ffmpeg CLI has to be updated to use the new API. In particular, we must
not allow to leak the "rotate" tag into the muxer. Some muxers will
catch this properly (like mov), but others (like mkv) can add it as
generic tag. Note applications, which use libavformat and assume the
old rotate API, will interpret such "rotate" user tags as rotate
metadata (which it is not), and incorrectly rotate the video.

The ffmpeg/ffplay tools drop the use of the old API for muxing and
demuxing, as all muxers/demuxers support the new API. This will mean
that the tools will not mistakenly interpret per-track "rotate" user
tags as rotate metadata. It will _not_ be treated as regression.

Unfortunately, hacks have been added, that allow the user to override
rotation by setting metadata explicitly, e.g. via

  -metadata:s:v:0 rotate=0

See references to trac #4560. fate-filter-meta-4560-rotate0 tests this.
It's easier to adjust the hack for supporting it than arguing for its
removal, so ffmpeg CLI now explicitly catches this case, and essentially
replaces the "rotate" value with a display matrix side data. (It would
be easier for both user and implementation to create an explicit option
for rotation.)

When the code under FF_API_OLD_ROTATE_API is disabled, one FATE
reference file has to be updated (because "rotate" is not exported
anymore).

Tested-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
2017-03-27 13:20:27 +02:00
James Almer
2f05d18ee2 ffmpeg: stop using deprecated codec flags
Signed-off-by: James Almer <jamrial@gmail.com>
2017-03-25 21:37:05 -03:00
Clément Bœsch
928db51344 Merge commit '27085d1b47c3741cc0fac284c916127c4066d049'
* commit '27085d1b47c3741cc0fac284c916127c4066d049':
  avconv: only retry decoding on actual decoding errors

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-22 16:05:06 +01:00
Carl Eugen Hoyos
4b192ffdbe ffmpeg: Initialize two stack variables.
Avoids reading from uninitialized memory, regression since af1761f7
2017-03-21 08:04:59 +01:00
wm4
87c082c426 ffmpeg: don't unnecessarily use a deprecated API function
Since we've disabled side data merging in ffmpeg.c, this really changes
nothing.
2017-03-21 06:16:49 +01:00
Anton Khirnov
8db301dead ffmpeg: set the encoding framerate when the output is CFR
(cherry picked from Libav commit d10102d23c)

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
2017-03-17 11:54:38 +01:00
Clément Bœsch
a283665693 Merge commit 'e46a6fb7732a7caef97a916a4f765ec0f779d195'
* commit 'e46a6fb7732a7caef97a916a4f765ec0f779d195':
  avconv: Check that muxing_queue exists before reading from it

Mostly noop. This was fixed in FFmpeg in 7f7c494a3.

The merge makes the cosmetics match but does not include the weird
av_log().

Merged-by: Clément Bœsch <cboesch@gopro.com>
2017-03-15 14:28:43 +01:00
Clément Bœsch
993a9a3d72 Merge commit 'b0f36a0043d76436cc7ab8ff92ab99c94595d3c0'
* commit 'b0f36a0043d76436cc7ab8ff92ab99c94595d3c0':
  avconv: stop using setpts for input framerate forced with -r

Merged-by: Clément Bœsch <u@pkh.me>
2017-03-12 13:08:04 +01:00
wm4
808ab2fd0b ffmpeg: remove unnecessary hack for decoders which refuse to drain
Now the previous commit takes care of this instead.
2017-03-06 11:08:03 +01:00
wm4
7dd44cde2a ffmpeg: delay processing of subtitles before filters are initialized
If a subtitle packet came before the first video frame could be fully
decoded, the subtitle packet would get discarded. This puts the subtitle
into a queue instead, and processes it once the attached filter graph is
initialized.
2017-03-03 08:45:43 +01:00
Timo Rothenpieler
736f4af4fe ffmpeg_cuvid: adapt for recent filter graph initialization changes 2017-03-03 08:45:43 +01:00
Anton Khirnov
76e13bdeaa ffmpeg: restructure sending EOF to filters
Be more careful when an input stream encounters EOF when its filtergraph
has not been configured yet. The current code would immediately mark the
corresponding output streams as finished, while there may still be
buffered frames waiting for frames to appear on other filtergraph
inputs.

This should fix the random FATE failures for complex filtergraph tests
after a3a0230a98

This merges Libav commit 94ebf55. It was previously skipped.

This is the last filter init related Libav commit that was skipped, so
this also removes the commits from doc/libav-merge.txt.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
2017-03-03 08:45:43 +01:00
Anton Khirnov
cb884f8d7e ffmpeg: move flushing the queued frames to configure_filtergraph()
This is a more appropriate place for it, and will also be useful in the
following commit.

This merges Libav commit d2e56cf. It was previously skipped.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
2017-03-03 08:45:43 +01:00
Anton Khirnov
af1761f7b5 ffmpeg: init filtergraphs only after we have a frame on each input
This makes sure the actual stream parameters are used, which is
important mainly for hardware decoding+filtering cases, which would
previously require various weird workarounds to handle the fact that a
fake software graph has to be constructed, but never used.
This should also improve behaviour in rare cases where
avformat_find_stream_info() does not provide accurate information.

This merges Libav commit a3a0230. It was previously skipped.

The code in flush_encoders() which sets up a "fake" format wasn't in
Libav. I'm not sure if it's a good idea, but it tends to give
behavior closer to the old one in certain corner cases.

The vp8-size-change gives different result, because now the size of
the first frame is used. libavformat reported the size of the largest
frame for some reason.

The exr tests now use the sample aspect ratio of the first frame. For
some reason libavformat determines 0/1 as aspect ratio, while the
decoder returns the correct one.

The ffm and mxf tests change the field_order values. I'm assuming
another libavformat/decoding mismatch.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
2017-03-03 08:45:43 +01:00
Anton Khirnov
4ee5aed122 ffmpeg: do packet ts rescaling in write_packet()
This will be useful in the following commit, after which the muxer
timebase is not always available when encoding.

This merges Libav commit 3e265ca. It was previously skipped.

There are some changes with how/when the mux_timebase field is set,
because the Libav approach often causes a too imprecise time base
to be set. This is hard, because the muxer's write_header function
can readjust the timebase, at which point we might already have
encoded packets buffered. (It might be better to buffer them after
the encoder, instead of after all the timestamp handling logic
before muxing.)

The two FATE tests change because the output time base is raised
for subtitles. (Needed to avoid certain rounding issues in other
cases.)

Includes a minor merge fix by Mark Thompson, and

    avconv: Move rescale to stream timebase before monotonisation

also by Mark Thompson <sw@jkqxz.net>.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
2017-03-03 08:45:43 +01:00
wm4
33580a8625 ffmpeg: make sure packets put into the muxing FIFO are refcounted
Some callers (like do_subtitle_out()) call this with an AVPacket that is
not refcounted. This can cause undefined behavior.

Calling av_packet_move_ref() does not make a packet refcounted if it
isn't yet. (And it can't be made to, because it always succeeds,
and can't return ENOMEM.)

Call av_packet_ref() instead to make sure it's refcounted.

I couldn't find a case that is fixed by this with the current code. But
it will fix the fate-pva-demux test with the later patches applied.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
2017-03-03 08:45:43 +01:00
Carl Eugen Hoyos
f8d2079a67 ffmpeg: Add a linebreak to an error message. 2017-02-27 10:28:00 +01:00
Michael Niedermayer
dfc6e30cd4 ffmpeg: Remove redundant null check
Fixes CID1396245

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-02-06 01:01:33 +01:00
Carl Eugen Hoyos
ac0863146b ffmpeg: Add a missing line break when requesting a sample. 2017-02-02 09:45:15 +01:00
Sasi Inguva
03e42a4fec ffmpeg.c: Add output file index and stream index to vstats file.
Signed-off-by: Sasi Inguva <isasi@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-01-27 22:16:37 +01:00
Tobias Rapp
c324e2c5db ffmpeg: pass output stream duration as a hint to the muxer
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-01-19 01:54:49 +01:00
Michael Bradshaw
3ac46a0a62 ffmpeg: Add -time_base option to hint the time base
Signed-off-by: Michael Bradshaw <mjbshaw@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2017-01-14 20:03:56 +01:00
Nicolas George
d9b311d44c ffmpeg: use buffersink accessors. 2017-01-12 14:06:16 +01:00
Michael Niedermayer
a830ab3f3b ffmpeg: remove stop_encoding variable and related code, it is dead / unused code
Fixes: CID1396243

Reviewed-by: compn <tempn@mi.rr.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-28 19:19:15 +01:00
Michael Niedermayer
11103a493d ffmpeg: Check avcodec_parameters_to_context() for failure
Fixes CID1396241

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-26 20:45:23 +01:00
Tobias Rapp
4d57ca51d7 ffmpeg: assert return value is initialized
Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-01 12:01:51 +01:00
Clément Bœsch
825f6fbfac ffmpeg: factor out sending frame to filters
Video doesn't exit ffmpeg on error anymore, and audio now prints an
error.
2016-11-18 20:23:58 +01:00
Clément Bœsch
b9c26aed4e ffmpeg: remove dead code out of the video filter loop
It makes no sense for this code to be inside the video filter loop, and
the frame sample aspect ratio is even set unconditionally a few lines
above.
2016-11-18 20:23:58 +01:00