Commit Graph

2270 Commits

Author SHA1 Message Date
James Almer
3ac76d7618 ffmpeg: fix memleak of encoder options AVDictionary on failure
Reviewed-by: Josh de Kock <josh@itanimul.li>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-09-25 16:17:41 -03:00
Michael Niedermayer
9083e044f1 ffmpeg: Fix bistream typos
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-09-25 19:06:51 +02:00
Clément Bœsch
5ef1959080 ffmpeg: switch to the new BSF API
This commit is initially largely based on commit 4426540 from Anton
Khirnov <anton@khirnov.net> and two following fixes (80fb19b and
fe7b21c) which were previously skipped respectively in 98e3153, c9ee36e,
and 7fe7cdc.

mpeg4-bsf-unpack-bframes FATE reference is updated because the bsf
filter now actually fixes the extradata (mpeg4_unpack_bframes_init()
changing one byte is now honored on the output extradata).

The FATE references for remove_extra change because the packet flags
were wrong and the keyframes weren't marked, causing the bsf relying on
these proprieties to not actually work as intended.

The following was fixed by James Almer:

The filter option arguments are now also parsed correctly.

A hack to propagate extradata changed by bitstream filters after the
first av_bsf_receive_packet() call is added to maintain the current
behavior. This was previously done by av_bitstream_filter_filter() and
is needed for the aac_adtstoasc bsf.

The exit_on_error was not being checked anymore, and led to an exit
error in the last frame of h264_mp4toannexb test. Restoring this
behaviour prevents erroring out. The test is still changed as a result
due to the badly filtered frame now not being written after the failure.

Signed-off-by: Clément Bœsch <u@pkh.me>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-09-24 14:25:53 -03:00
Clément Bœsch
955b818cf9 ffmpeg: switch to codecpar
This commit is largely based on commit 15e84ed3 from Anton Khirnov
<anton@khirnov.net> which was previously skipped in bbf5ef9d.

There are still a bunch of things raising codecpar related warnings that
need fixing, such as:
- the use of codec->debug in the interactive debug mode
- read_ffserver_streams(): it's probably broken now but there is no test
- lowres stuff
- codec copy apparently required by bitstream filters

The matroska references are updated because they now properly forward
the field_order (previously unknown, now progressive).

Thanks to James Almer for fixing a bunch of FATE issues in this commit.

Signed-off-by: Clément Bœsch <clement@stupeflix.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2016-09-21 15:39:28 +02:00
Clément Bœsch
ae1dd0c9a6 lavf: add avformat_transfer_internal_stream_timing_info() and use it in ffmpeg
In lavf we have access to st->internal->avctx so it's a better place
than in ffmpeg*.c and will allow moving to codecpar.
2016-09-14 09:57:55 +02:00
Jon Toohill
7f386bbe2a ffmpeg: copy trailing_padding when using -acodec copy
Signed-off-by: James Almer <jamrial@gmail.com>
2016-09-13 23:59:41 -03:00
Clément Bœsch
1895e3a24f ffmpeg: fix broken indent/style in write_frame 2016-09-02 11:01:46 +02:00
Marton Balint
2ee8a4f887 ffmpeg: fix -stream_loop with -re
Otherwise the stream failed with EAGAIN.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-08-28 18:22:24 +02:00
Carl Eugen Hoyos
ec9d7047c4 ffmpeg: Do not set too large bits_per_raw_sample. 2016-08-17 18:08:16 +02:00
Hendrik Leppkes
3bf142c773 cmdutils: remove the current working directory from the DLL search path on win32
Reviewed-by: Matt Oliver <protogonoi@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-08 18:36:55 +02:00
James Almer
61da882cea Merge commit '90944ee3ab79081845ea1bd97eea475031ce0842'
* commit '90944ee3ab79081845ea1bd97eea475031ce0842':
  avconv: refactor selecting an encoder

Conflicts:
	ffmpeg.c
	ffmpeg_opt.c

Merged-by: James Almer <jamrial@gmail.com>
2016-08-06 13:31:12 -03:00
Timothy Gu
e5c79cd854 Merge commit '5e1840622ce6e41c57d9c407604863d3f3dcc3ae'
* commit '5e1840622ce6e41c57d9c407604863d3f3dcc3ae':
  avconv: fix handling attachments in init_output_stream

Conflicts:
	avconv.c

This is functionally a no-op, as we don't have the bug this is trying to
fix. See 843be56ee1.

Merged-by: Timothy Gu <timothygu99@gmail.com>
2016-08-03 21:28:43 -07:00
Timothy Gu
1b04ea1a6c Merge commit '73c6ec6d659bab11ac424a4ba6ce3a56246295ee' into merge
* commit '73c6ec6d659bab11ac424a4ba6ce3a56246295ee':
  avconv: create simple filtergraphs earlier

Merged-by: Timothy Gu <timothygu99@gmail.com>
2016-08-03 20:53:03 -07:00
Timothy Gu
9aa3023672 Merge commit '49670e4218d34899a1c37abb7a11615efc16f757'
* commit '49670e4218d34899a1c37abb7a11615efc16f757':
  avconv: add a function for determining whether a filtergraph is simple

Conflicts:
	avconv.c

Merged-by: Timothy Gu <timothygu99@gmail.com>
2016-08-03 20:33:57 -07:00
Mark Reid
0a088dea3d ffmpeg.c: copy video profile when using stream_copy
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-07-23 03:52:38 +02:00
James Almer
d688f39dc4 cosmetics: fix some misspelled words
Signed-off-by: James Almer <jamrial@gmail.com>
2016-07-17 13:10:27 -03:00
Clément Bœsch
11ee8a4504 ffmpeg: do not use deprecated AVSubtitleRect.pict 2016-06-25 13:35:46 +02:00
Clément Bœsch
8ef57a0d61 Merge commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb'
* commit '41ed7ab45fc693f7d7fc35664c0233f4c32d69bb':
  cosmetics: Fix spelling mistakes

Merged-by: Clément Bœsch <u@pkh.me>
2016-06-21 21:55:34 +02:00
Timo Rothenpieler
d865e74e6d ffmpeg: Add cuvid hwaccel support 2016-06-10 16:31:23 +02:00
Michael Niedermayer
6085d6b2ae ffmpeg: Check that r_frame_rate is set before attempting to use it
Avoids unexpected occurance and dependency on NaN behavior and divisions by 0

Testcase: fate-lavf-fate-avi_cram

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-05-16 14:23:49 +02:00
Ronald S. Bultje
9c4943e671 ffmpeg: copy color properties in case of -c:v copy.
I have no idea why the first hunk uses ost->enc_ctx, because as far as
I understand, that is never used in case of -c:v copy, but this code
block is only entered if encoding_needed=0, which means stream_copy=1.
My point being: review from someone that knows this really well would
be appreciated.
2016-05-10 08:37:56 -04:00
Derek Buitenhuis
172d3568b3 Merge commit '5d273d3efac340ef8de445c955ff44c7abed4e8f'
* commit '5d273d3efac340ef8de445c955ff44c7abed4e8f':
  avconv: VAAPI hwcontext initialisation and hwaccel helper

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-05-08 22:39:39 +01:00
Derek Buitenhuis
6f69f7a8bf Merge commit '9200514ad8717c63f82101dc394f4378854325bf'
* commit '9200514ad8717c63f82101dc394f4378854325bf':
  lavf: replace AVStream.codec with AVStream.codecpar

This has been a HUGE effort from:
    - Derek Buitenhuis <derek.buitenhuis@gmail.com>
    - Hendrik Leppkes <h.leppkes@gmail.com>
    - wm4 <nfxjfg@googlemail.com>
    - Clément Bœsch <clement@stupeflix.com>
    - James Almer <jamrial@gmail.com>
    - Michael Niedermayer <michael@niedermayer.cc>
    - Rostislav Pehlivanov <atomnuker@gmail.com>

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-10 20:59:55 +01:00
Ronald S. Bultje
2e6636aa87 vp9: add superframe merging bitstream filter.
Fixes ticket 4313.
2016-03-11 11:19:14 -05:00
Ronald S. Bultje
6d8ab358a3 lavf: allow BSFs to drop packets.
If pkt->size == 0 && pkt->side_data_elems == 0 after bsf->filter()
returns, the packet is considered dropped.
2016-03-11 11:19:10 -05:00
Clément Bœsch
6433618dc0 ffmpeg: set sub_text_format to ass (without timing) by default
Fixes Ticket #4783
2016-02-26 21:53:34 +01:00
Derek Buitenhuis
259fef86bb Merge commit 'c15f6098b1b25689dd5e86aeb5ce69bc12efe1e1'
* commit 'c15f6098b1b25689dd5e86aeb5ce69bc12efe1e1':
  avconv: pass the hw context from filters to the encoder

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-24 17:08:13 +00:00
Marton Balint
308ac2f7e2 ffmpeg: init input streams before opening encoders
Codec options of streams detected during avformat_find_stream_info are not set
therefore without this patch we initialize the encoders with decoder info
based on decoders without options.

This cause problems for probed DVB teletext streams where
avctx->subtitle_header depend on the txt_format setting.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-02-19 21:55:25 +01:00
Michael Niedermayer
5590ab45e0 ffmpeg: Check best_effort_timestamp after rescale
Fixes integer overflow
Fixes: Ticket5126

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-18 01:46:59 +01:00
Stefano Sabatini
b91093a411 ffmpeg: replace "flush Media" with "flush_media" in benchmark_all output
Simplify parsing and consistency.
2016-01-29 10:58:18 +01:00
Hendrik Leppkes
7dae3461c0 Merge commit '63f7f8d1dbf6ce27440fdd56ef38c822fb11b9c2'
* commit '63f7f8d1dbf6ce27440fdd56ef38c822fb11b9c2':
  avconv: Drop an impossible check

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-01-19 08:41:32 +01:00
Hendrik Leppkes
4440c8e9c9 Merge commit '7ebf1b4adad40e2b0d88ebd5cfde821a7a0ceab2'
* commit '7ebf1b4adad40e2b0d88ebd5cfde821a7a0ceab2':
  avconv: Simplify poll_filters() return value check

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2016-01-19 08:40:32 +01:00
Michael Niedermayer
7a0361b06f ffmpeg: fix sws_dict leak on error exit
Fixes: 1b79b985cdf860ffa228c00ee5497051/signal_sigsegv_1f99d24_3549_86d92054a79f6ff900fbaf03f8012b32.aif

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-01-17 01:19:43 +01:00
Ganesh Ajjanagadde
7ab37cae34 ffmpeg: check fclose return values
In the spirit of commit a956840cbc. Simple method to reproduce:
pass -vstats_file /dev/full to ffmpeg.

All raw fclose usages in ffmpeg.c taken care of here.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2016-01-07 16:57:37 -08:00
Ganesh Ajjanagadde
369b161d8e ffmpeg: replace log2 by av_log2
Slight change in output deemed irrelevant here.

Reviewed-by: Hendrik Leppkes <h.leppkes@gmail.com>
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2016-01-06 20:36:24 -08:00
Ganesh Ajjanagadde
a956840cbc ffmpeg: check return value of avio_closep for progress report
avio_closep is not guaranteed to succeed, and its return value can
contain information regarding failure of preceding writes and silent
loss of data (man 2 close, man fclose). Users should know when the
progress was not successfully logged, and so a diagnostic is printed
here.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde@gmail.com>
2016-01-05 19:06:21 -08:00
Rodger Combs
a5fd3a1a2b ffmpeg: use lavf API for applying bitstream filters 2015-12-28 08:34:30 -06:00
Hendrik Leppkes
be52b95d31 Merge commit 'e63e3797a1ed9346f529848e6ba3d27fd2d2cc8d'
* commit 'e63e3797a1ed9346f529848e6ba3d27fd2d2cc8d':
  avconv: pass the global codec side data to the muxer

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-12-17 13:20:37 +01:00
Moritz Barsnick
9d1fb9ef31 ffmpeg: add progress speed to status line and report
This adds a computation of the progress speed versus realtime ("Nx")
to the status line and to the report log. It uses the progress time
as already calculated for total output time as a base.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-17 02:17:02 +01:00
Tom Marecek
46cbb4c231 ffmpeg: change command line option -dump to work without -loglevel debug
-hex and -dump command line options do nothing unless -loglevel debug is set.

-dump by itself is useful for monitoring live streams (to get the current PTS for example)  however when it is used with -loglevel debug for an RTMP stream, librtmp also dumps the packet data which makes the output too noisy.

do_pkt_dump is only set in check_keyboard_interaction or by the -dump command line option so this change should have no effect on any other parts of the code..

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-11 13:39:21 +01:00
Simon Thelen
5b6c0fdb43 ffmpeg: When streamcopying, only add the input seek position when copying timestamps.
Using -ss as an input option shifts timestamps down by the seek, so it
doesn't have to be added to the recording time when checking whether to
stop.

Fixes #977

Signed-off-by: Simon Thelen <ffmpeg-dev@c-14.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-05 04:24:22 +01:00
Clément Bœsch
7234e04e35 ffmpeg: enable echoing with command and debug modes
Allow seeing text when pressing 'c' or 'd'.
2015-12-04 15:47:06 +01:00
Michael Niedermayer
9d44e23618 ffmpeg: Check pkt_dts for AV_NOPTS_VALUE
Fixes integer overflow
Fixes: 1536b9b096a8f95b742bae9d3d761cc6/signal_sigsegv_294aaed_2039_8d1797aeb823ea43858d0fa45c9eb899.ogv

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-04 13:37:04 +01:00
Rodger Combs
bf2590aed3 ffmpeg: fix -copy_prior_start 0 with -copyts and input -ss
Also rearranged the relevant check to reduce code duplication

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-20 19:20:30 +01:00
Maksym Veremeyenko
d21b690e55 ffmpeg: preserve profile for audio stream copy
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-20 18:09:47 +01:00
Bryan Huh
1fe82abac7 ffmpeg: Simplify fps code related to delta0
Small refactor of fps code for improved readability. In particular
the "cor" variable was unnecessary and misleading because it would
always be set to -delta0.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-16 01:53:47 +01:00
Bryan Huh
dfa98c4f83 ffmpeg: Fixing typos and adding comments to fps code
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-16 01:53:47 +01:00
Michael Niedermayer
6770a9d689 ffmpeg: Fix integer overflow with cur_dts being AV_NOPTS_VALUE
Since de0e219a8a cur_dts is sometimes invalid
2015-11-11 17:46:19 +01:00
Michael Niedermayer
363673fbe0 ffmpeg: Print a warning if a pkt duration is already set before using the frame rate
I didnt find any case that triggers this but if it gets triggered it needs to be
investigated

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-11 15:04:21 +01:00
Michael Niedermayer
46070cc20a ffmpeg: set muxer packet duration based on framerate only for CFR
a set ost->frame_rate does not imply CFR in ffmpeg

The changed fate tests had all wrong packet durations
(like 1/1000 or 1/90000)

There might be more cases in which is_cfr could be set

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-11-11 15:04:21 +01:00