summaryrefslogtreecommitdiff
path: root/fftools/ffmpeg_opt.c
Commit message (Collapse)AuthorAgeFilesLines
* fftools/ffmpeg: add ability to set a input burst time before readrate is ↵Davy Durham2023-05-071-0/+3
| | | | | | enforced Signed-off-by: Anton Khirnov <anton@khirnov.net>
* fftools/ffmpeg: deprecate -adrift_thresholdAnton Khirnov2023-05-021-2/+12
| | | | | This option has had no effect since -async was removed in 3d86a13b47b726e49c2d780c5f723c290e8a36b4
* fftools/ffmpeg_filter: add a function for creating a filtergraphAnton Khirnov2023-04-241-9/+5
| | | | | | Code creating a new filtergraph is currently duplicated in 3 places. This commit unifies it and moves towards making filtergraphs more self-contained.
* fftools/ffmpeg_opt: Document VAAPI -device usage for DirectX AdapterSil Vilerino2023-04-241-1/+1
| | | | | | | | Initial review at https://github.com/intel-media-ci/ffmpeg/pull/619/ Signed-off-by: Sil Vilerino <sivileri@microsoft.com> Reviewed-by: Dmitry Rogozhkin <dmitry.v.rogozhkin@intel.com> Reviewed-by: Wu, Tong1 <tong1.wu@intel.com>
* fftools/ffmpeg: disable and deprecate -qphistAnton Khirnov2023-04-131-3/+12
| | | | | | | | | | | | | | | | | | | | | | This option adds a long string of numbers to the progress line, where i-th number contains the base-2 logarithm of the number of times a frame with this QP value was seen by print_report(). There are multiple problems with this feature: * despite this existing since 2005, web search shows no indication that it was ever useful for any meaningful purpose; * the format of what is printed is entirely undocumented, one has to find it out from the source code; * QP values above 31 are silently ignored; * it only works with one video stream; * as it relies on global state, it is in conflict with ongoing architectural changes. It then seems that the nontrivial cost of maintaining this option is not worth its negligible (or possibly negative - since it pollutes the already large option space) value. Users who really need similar functionality can also implement it themselves using -vstats.
* fftools/ffmpeg: rename -enc_stats* to -stats_enc*Anton Khirnov2023-02-101-6/+6
| | | | | | | This is consistent with -stats_mux* As the options were added very recently, this should not break any users.
* fftools/ffmpeg: add an option for writing pre-muxing statsAnton Khirnov2023-02-091-0/+4
| | | | | | Analogous to -enc_stats*, but happens right before muxing. Useful because bitstream filters and the sync queue can modify packets after encoding and before muxing. Also has access to the muxing timebase.
* ffmpeg_opt: move help text for -ab/-b:a to audio categoryMarth642023-02-091-2/+2
| | | | | | | | Since at least 4.4.3, -ab/-b:a help text was in the video section of ffmpeg -h, but these are audio options. Signed-off-by: Marth64 <marth64@proxyid.net> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* ffmpeg: add video heartbeat capability to fix_sub_durationJan Ekström2023-02-031-0/+5
| | | | | | | | | | | | | | | | | | | Splits the currently handled subtitle at random access point packets that can be configured to follow a specific output stream. Currently only subtitle streams which are directly mapped into the same output in which the heartbeat stream resides are affected. This way the subtitle - which is known to be shown at this time can be split and passed to muxer before its full duration is yet known. This is also a drawback, as this essentially outputs multiple subtitles from a single input subtitle that continues over multiple random access points. Thus this feature should not be utilized in cases where subtitle output latency does not matter. Co-authored-by: Andrzej Nadachowski <andrzej.nadachowski@24i.com> Co-authored-by: Bernard Boulay <bernard.boulay@24i.com> Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
* fftools/ffmpeg: add an AVClass to MuxStream/OutputStreamAnton Khirnov2023-01-291-4/+5
| | | | | Use it for logging. This makes log messages related to this output stream more consistent.
* fftools/ffmpeg: add options for writing encoding statsAnton Khirnov2023-01-291-0/+9
| | | | | | | Similar to -vstats, but more flexible: - works for audio as well as video - frame and/or packet information - user-specifiable format
* fftools: use av_dict_iterateMarvin Scholz2022-12-011-1/+1
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg: remove the input_streams globalAnton Khirnov2022-11-231-2/+2
| | | | | | | | | Replace it with an array of streams in each InputFile. This is a more accurate reflection of the actual relationship between InputStream and InputFile. Analogous to what was previously done to output streams in 7ef7a22251b852faab9404c85399ba8ac5dfbdc3.
* fftools/ffmpeg_mux_init: drop an always-false checkAnton Khirnov2022-11-171-5/+0
| | | | It cannot be true since 1959351aecf. Effectively reverts 6a3833e1411.
* fftools/ffmpeg_mux_init: move validating codec avoptions to a separate functionAnton Khirnov2022-11-171-1/+1
|
* fftools/ffmpeg_[de]mux: constify all uses of OptionsContextAnton Khirnov2022-11-161-1/+1
|
* ffmpeg: fix implementation of updated input start timeGyan Doshi2022-11-031-10/+23
| | | | | | | | | | The current adjustment of input start times just adjusts the tsoffset. And it does so, by resetting the tsoffset to nullify the new start time. This leads to breakage of -copyts, ignoring of input_ts_offset, breaking of -isync as well as breaking wrap correction. Fixed by taking cognizance of these parameters, and by correcting start times just before sync offsets are applied.
* ffmpeg: shift start time correction to ffmpeg_optGyan Doshi2022-11-031-0/+27
| | | | | In preparation for applying start time correction that accounts for all factors such as copyts, input_ts_offset ..etc
* fftools/ffmpeg_opt: move opening input files to ffmpeg_demux.cAnton Khirnov2022-10-251-643/+2
| | | | | | | | | This is similar to what was done before for output files and will allow introducing demuxer-private state in future commits Unlike for muxing, the code is moved to existing ffmpeg_demux.c rather than to a new file. The reason is just file size - the demuxing code is much smaller than muxing.
* fftools/ffmpeg: rename read_file() to avoid conflict with libassAnton Khirnov2022-10-211-2/+2
| | | | | libass defines a non-static read_file() symbol, which causes conflicts with static linking.
* ffmpeg: Add display_{rotation, hflip, vflip} optionsJan Ekström2022-10-191-0/+50
| | | | | | | | | This enables overriding the rotation as well as horizontal/vertical flip state of a specific video stream on the input side. Additionally, switch the singular test that was utilizing the rotation metadata to instead override the input display rotation, thus leading to the same result.
* fftools/ffmpeg_opt: Move stuff only used by ffmpeg_mux_init to itAndreas Rheinhardt2022-10-181-6/+0
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg_opt: move opening output files into a new fileAnton Khirnov2022-10-181-1906/+20
| | | | | | | | | | | | | ffmpeg_opt.c currently contains code for - parsing the options provided on the command line - opening and initializing input files based on these options - opening and initializing output files based on these options The code dealing with each of these is for the most part disjoint, so it makes sense to move them to separate files. Beyond reducing the quite considerable size of ffmpeg_opt.c, this will also allow exposing muxer internals (currently private to ffmpeg_mux.c) to the initialization code, thus removing the awkward separation currently in place.
* fftools/ffmpeg_opt: Use av_err2strMarvin Scholz2022-10-141-3/+1
| | | | | | | This simplifies the code as there is no other place the error buffer is needed, so the av_err2str helper macro can be used. Signed-off-by: Anton Khirnov <anton@khirnov.net>
* ffmpeg: Make find_stream_info behave like a normal per-file optionMarvin Scholz2022-10-131-3/+3
| | | | | | | | | Currently it would essentially change the find_stream_info setting for the file it was specified for and all following files, which is unusual and somewhat unexpected behaviour for a per-file option and not even documented to behave like this. Signed-off-by: Anton Khirnov <anton@khirnov.net>
* fftools/ffmpeg: drop the -async optionAnton Khirnov2022-10-041-3/+0
| | | | | | | | | | | | It has been deprecated in favor of the aresample filter for almost 10 years. Another thing this option can do is drop audio timestamps and have them generated by the encoding code or the muxer, but - for encoding, this can already be done with the setpts filter - for muxing this should almost never be done as timestamp generation by the muxer is deprecated, but people who really want to do this can use the setts bitstream filter
* fftools/ffmpeg_opt: Check creation of new programAndreas Rheinhardt2022-09-011-0/+2
| | | | | | Fixes Coverity issue #1512413. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools: Use report_error_then_exit_program() for allocation failuresAndreas Rheinhardt2022-09-011-43/+27
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg: drop OutputStream.fps_modeAnton Khirnov2022-08-291-4/+4
| | | | | It is only used within new_video_stream(), so make it a local variable there.
* fftools/ffmpeg: drop OutputStream.encAnton Khirnov2022-08-291-23/+31
| | | | | | It is either equal to OutputStream.enc_ctx->codec, or NULL when enc_ctx is NULL. Replace the use of enc with enc_ctx->codec, or the equivalent enc_ctx->codec_* fields where more convenient.
* fftools/ffmpeg_opt: try to propagate the requested output channel layoutJames Almer2022-08-231-1/+37
| | | | | | | | | Don't silently replace it with the default layout for the amount of channels from the requested layout. Should fix ticket #9869 Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/ffmpeg: call av_guess_frame_rate() when opening the fileAnton Khirnov2022-08-221-0/+2
| | | | | It is currently called when configuring the filter, which races with the demuxer thread.
* fftools/ffmpeg: store a separate copy of input codec parametersAnton Khirnov2022-08-161-1/+5
| | | | | | | | | | | Use it instead of AVStream.codecpar in the main thread. While AVStream.codecpar is documented to only be updated when the stream is added or avformat_find_stream_info(), it is actually updated during demuxing. Accessing it from a different thread then constitutes a race. Ideally, some mechanism should eventually be provided for signalling parameter updates to the user. Then the demuxing thread could pick up the changes and propagate them to the decoder.
* fftools/ffmpeg_demux: do not store demux packet in the contextAnton Khirnov2022-08-081-3/+0
| | | | Its use is local to input_thread().
* fftools/ffmpeg: store the input file index in InputFileAnton Khirnov2022-08-081-4/+5
| | | | | | Use it to simplify some code and fix two off-by-one errors. Similar to what was previously done for OutputFile.
* fftools/ffmpeg: deprecate specifying a sync stream with -mapAnton Khirnov2022-08-081-34/+7
| | | | It has not had any effect whatsoever for over 10 years.
* fftools/ffmpeg: remove OutputStream.sync_istAnton Khirnov2022-08-081-12/+6
| | | | It is not actually used for anything.
* fftools/ffmpeg: remove OutputStream.encoding_neededAnton Khirnov2022-08-081-6/+2
| | | | It is unnecessary, as it is always exactly equivalent to !!ost->enc_ctx
* fftools/ffmpeg: remove OutputStream.stream_copyAnton Khirnov2022-08-081-21/+12
| | | | | | | | | | | | | | | There are currently three possible modes for an output stream: 1) The stream is produced by encoding output from some filtergraph. This is true when ost->enc_ctx != NULL, or equivalently when ost->encoding_needed != 0. 2) The stream is produced by copying some input stream's packets. This is true when ost->enc_ctx == NULL && ost->source_index >= 0. 3) The stream is produced by attaching some file directly. This is true when ost->enc_ctx == NULL && ost->source_index < 0. OutputStream.stream_copy is currently used to identify case 2), and sometimes to confusingly (or even incorrectly) identify case 1). Remove it, replacing its usage with checking enc_ctx/source_index values.
* fftools/ffmpeg_opt: drop redundant decoder selectionAnton Khirnov2022-08-081-5/+0
| | | | A decoder is already selected above, in choose_decoder().
* fftools/ffmpeg_opt: move adding metadata out of open_output_file()Anton Khirnov2022-08-081-62/+63
|
* fftools/ffmpeg_opt: move adding programs out of open_output_file()Anton Khirnov2022-08-081-65/+70
|
* fftools/ffmpeg_opt: move adding attachments out of open_output_file()Anton Khirnov2022-08-081-36/+43
|
* ffmpeg_opt: consider HW acceleration method when selecting decoderHaihao Xiang2022-08-031-4/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Usually a HW decoder is expected when user specifies a HW acceleration method via -hwaccel option, however the current implementation doesn't take HW acceleration method into account, it is possible to select a SW decoder. For example: $ ffmpeg -hwaccel vaapi -i av1.mp4 -f null - $ ffmpeg -hwaccel nvdec -i av1.mp4 -f null - $ ffmpeg -hwaccel vdpau -i av1.mp4 -f null - [...] Stream #0:0 -> #0:0 (av1 (libdav1d) -> wrapped_avframe (native)) libdav1d is selected in this case even if vaapi, nvdec or vdpau is specified. After applying this patch, the native av1 decoder (with vaapi, nvdec or vdpau support) is selected for decoding(libdav1d is still used for probing format). $ ffmpeg -hwaccel vaapi -i av1.mp4 -f null - $ ffmpeg -hwaccel nvdec -i av1.mp4 -f null - $ ffmpeg -hwaccel vdpau -i av1.mp4 -f null - [...] Stream #0:0 -> #0:0 (av1 (native) -> wrapped_avframe (native)) Tested-by: Mario Roy <marioeroy@gmail.com> Signed-off-by: Haihao Xiang <haihao.xiang@intel.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* ffmpeg_opt: select a decoder after getting values for per-stream hwdec optionsHaihao Xiang2022-08-031-66/+68
| | | | | | | | | | | After applying this patch, the desired HW acceleration method is known before selecting decoder, so we may take HW acceleration method into account when selecting decoder for input stream in the next commit There should be no functional changes in this patch Signed-off-by: Haihao Xiang <haihao.xiang@intel.com> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* fftools/ffmpeg_opt: Fix copyinkfAndreas Rheinhardt2022-08-021-0/+3
| | | | | | | Broken in 9c2b800203a5a8f3d83f3b8f28e8c50d28186b39. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg_opt: reindentAnton Khirnov2022-07-281-70/+70
|
* fftools/ffmpeg_opt: factor manually mapping streams out of open_output_file()Anton Khirnov2022-07-281-76/+81
|
* fftools/ffmpeg_opt: reindentAnton Khirnov2022-07-281-9/+9
|
* fftools/ffmpeg_opt: factor auto-mapping data streams out of open_output_file()Anton Khirnov2022-07-281-12/+16
|