aboutsummaryrefslogtreecommitdiffstats
path: root/fftools/ffmpeg_mux_init.c
Commit message (Collapse)AuthorAgeFilesLines
...
* fftools/ffmpeg: stop setting InputStream fields from muxing/filtering codeAnton Khirnov2023-04-171-6/+0
| | | | | | Set InputStream.decoding_needed/discard/etc. only from ist_{filter,output},add() functions. Reduces the knowledge of InputStream internals in muxing/filtering code.
* fftools/ffmpeg_mux_init: consolidate input stream flagging codeAnton Khirnov2023-04-171-23/+19
| | | | | Makes it easier to see where the input stream is modified from muxer code.
* fftools/ffmpeg_mux_init: remove a redundant checkAnton Khirnov2023-04-171-11/+9
|
* fftools/ffmpeg: move init_output_stream_streamcopy() to ffmpeg_mux_initAnton Khirnov2023-04-171-0/+143
| | | | | Everything in it can be done immediately when creating the output stream, there is no reason to postpone it.
* fftools/ffmpeg_mux_init: restructure output stream creationAnton Khirnov2023-04-171-54/+35
| | | | | | | | | | | | Creating a new output stream of a given type is currently done by calling new_<type>_stream(), which all start by calling new_output_stream() to allocate the stream and do common init, followed by type-specific init. Reverse this structure - the caller now calls the common function ost_add() with the type as a parameter, which then calls the type-specific function internally. This will allow adding common code that runs after type-specific code in future commits.
* fftools/ffmpeg_mux_init: move new_output_stream() lower in the fileAnton Khirnov2023-04-171-242/+245
| | | | | | | Reduces the diff in the following commit. Temporarily add a forward declaration for new_output_stream(), it will be removed in the next commit.
* fftools/ffmpeg: avoid possible invalid reads with short -tag valuesAnton Khirnov2023-04-171-2/+5
| | | | Fixes #10319 and #10309.
* fftools/ffmpeg: track a list of non-lavfi outputs in InputStreamAnton Khirnov2023-04-131-0/+3
| | | | | | | Currently, output streams where an input stream is sent directly (i.e. not through lavfi) are determined by iterating over ALL the output streams and skipping the irrelevant ones. This is awkward and inefficient.
* fftools/ffmpeg_mux_init: print more meaningful error messagesAnton Khirnov2023-04-131-7/+10
|
* fftools/ffmpeg: move OutputStream.last_filter_pts to OutputFilterAnton Khirnov2023-04-131-1/+0
| | | | | This value is associated with the filtergraph output rather than the output stream, so this is a more appropriate place for it.
* fftools/ffmpeg: move OutputStream.sq_frame to EncoderAnton Khirnov2023-04-131-4/+0
| | | | | It is audio/video encoding-only and does not need to be visible outside of ffmpeg_enc.c
* fftools/ffmpeg: add encoder private dataAnton Khirnov2023-04-091-4/+4
| | | | | Start by moving OutputStream.last_frame to it. In the future it will hold other encoder-internal state.
* fftools/ffmpeg: use sync queues for enforcing audio frame sizeAnton Khirnov2023-04-091-6/+13
| | | | | | | | | | | The code currently uses lavfi for this, which creates a sort of configuration dependency loop - the encoder should be ideally initialized with information from the first audio frame, but to get this frame one needs to first open the encoder to know the frame size. This necessitates an awkward workaround, which causes audio handling to be different from video. With this change, audio encoder initialization is congruent with video.
* fftools/ffmpeg: drop InputStream.processing_neededAnton Khirnov2023-04-091-3/+0
| | | | It is equivalent to !InputStream.discard.
* fftools/ffmpeg_mux_init: Use all metadata selectors if none is specified.Thilo Borgmann2023-03-251-3/+3
| | | | | Fixes regression from 3c7dd5ed37da6d2de06c4850de5a319ca9cdd47f. Fixes ticket #10157.
* fftools/ffmpeg_mux_init: avoid invalid reads in forced keyframe parsingAnton Khirnov2023-03-201-1/+1
| | | | Fixes #10243
* avformat: remove FF_API_AVSTREAM_CLASSJames Almer2023-02-091-11/+0
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/ffmpeg: add an option for writing pre-muxing statsAnton Khirnov2023-02-091-5/+18
| | | | | | 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: add video heartbeat capability to fix_sub_durationJan Ekström2023-02-031-0/+4
| | | | | | | | | | | | | | | | | | | 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: support input frame params in encoding statsAnton Khirnov2023-01-311-2/+19
|
* fftools/ffmpeg: add an AVClass to MuxStream/OutputStreamAnton Khirnov2023-01-291-61/+88
| | | | | Use it for logging. This makes log messages related to this output stream more consistent.
* fftools/ffmpeg: add an AVClass to Muxer/OutputFileAnton Khirnov2023-01-291-52/+81
| | | | | Use it for logging. This makes log messages related to this output file more consistent.
* fftools/ffmpeg: add options for writing encoding statsAnton Khirnov2023-01-291-0/+224
| | | | | | | Similar to -vstats, but more flexible: - works for audio as well as video - frame and/or packet information - user-specifiable format
* fftools/ffmpeg: always generate CFR output when -r is usedAnton Khirnov2023-01-101-5/+11
| | | | | | | | | | | | | | | | Current code may, depending on the muxer, decide to use VSYNC_VFR tagged with the specified framerate, without actually performing framerate conversion. This is clearly wrong and against the documentation, which states unambiguously that -r should produce CFR output for video encoding. FATE test changes: * nuv-rtjpeg: replace -r with '-enc_time_base -1', which keeps the original timebase. Output frames are now produced with proper durations. * filter-mpdecimate: just drop the -r option, it is unnecessary * filter-fps-r: remove, this test makes no sense and actually produces broken VFR output (with incorrect frame durations).
* fftools/ffmpeg: avoid storing full forced keyframe specAnton Khirnov2022-11-281-15/+20
| | | | | It is not needed after the spec is parsed. Also avoids ugly string comparisons for each video frame.
* fftools/ffmpeg: parse forced keyframes in of_open()Anton Khirnov2022-11-281-0/+106
| | | | Allows to remove the ugly of_get_chapters() wrapper.
* fftools/ffmpeg: move force-keyframe-related vars to a separate structAnton Khirnov2022-11-281-4/+4
| | | | | | There are 8 of them and they are typically used together. Allows to pass just this struct to forced_kf_apply(), which makes it clear that the rest of the OutputStream is not accessed there.
* fftools/ffmpeg_mux_init: postpone matching -disposition to streamsAnton Khirnov2022-11-231-12/+24
| | | | | | | | | Do it in set_dispositions() rather than during stream creation. Since at this point all other stream information is known, this allows setting disposition based on metadata, which implements #10015. This also avoids an extra allocated string in OutputStream that was unused after of_open().
* fftools/ffmpeg: remove the input_streams globalAnton Khirnov2022-11-231-58/+63
| | | | | | | | | 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: simplify inner loop in map_auto_{video,audio}Anton Khirnov2022-11-231-8/+13
| | | | Skip unusable streams early and do not compute any scores for them.
* fftools/ffmpeg: replace OutputStream.source_index with a pointer to InputStreamAnton Khirnov2022-11-231-20/+17
| | | | | This is simpler. The indirection via an index exists for historical reasons that longer apply.
* fftools/ffmpeg_mux_init: drop an always-false checkAnton Khirnov2022-11-171-6/+0
| | | | It cannot be true since 1959351aecf. Effectively reverts 6a3833e1411.
* fftools/ffmpeg_mux_init: use av_dict_iterate() where appropriateAnton Khirnov2022-11-171-3/+2
|
* fftools/ffmpeg_mux_init: do not call av{codec,format}_get_class() repeatedlyAnton Khirnov2022-11-171-2/+2
|
* fftools/ffmpeg_mux_init: move validating codec avoptions to a separate functionAnton Khirnov2022-11-171-42/+49
|
* fftools/ffmpeg: move OutputStream.max_frames to MuxStreamAnton Khirnov2022-11-171-10/+13
| | | | It no longer needs to be visible outside of the muxing code.
* fftools/ffmpeg_mux_init: move more code from of_open() to create_streams()Anton Khirnov2022-11-171-49/+50
| | | | | | Specificaly, the of_add_attachments() call (which can add attachment streams to the output) and the check whether the output file contains any streams. They both logically belong in create_streams().
* fftools/ffmpeg_[de]mux: constify all uses of OptionsContextAnton Khirnov2022-11-161-21/+21
|
* fftools/ffmpeg_mux_init: stop using OptionsContext as storage in copy_metadata()Anton Khirnov2022-11-161-8/+16
| | | | | It should be input-only to this code. Will allow making it const in future commits.
* fftools/ffmpeg_mux_init: drop a duplicated block in copy_metadata()Anton Khirnov2022-11-161-10/+0
| | | | It does the same thing as the block right below it.
* fftools/ffmpeg_mux_init: stop modifying OptionsContext.*_disableAnton Khirnov2022-10-251-7/+12
| | | | | | | | | | | The current code will override the *_disable fields (set by -vn/-an options) when creating output streams for unlabeled complex filtergraph outputs, in order to disable automatic mapping for the corresponding media type. However, this will apply not only to automatic mappings, but to manual ones as well, which should not happen. Avoid this by adding local variables that are used only for automatic mappings.
* fftools/ffmpeg_mux_init: move code creating streams into a new functionAnton Khirnov2022-10-251-33/+39
| | | | | Makes it easy to see where all the streams are created. Will also be useful in the following commit.
* fftools/ffmpeg_mux_init: stop modifying some OptionsContext fieldsAnton Khirnov2022-10-251-9/+12
| | | | | | Specifically recording_time and stop_time - use local variables instead. OptionsContext should be input-only to this code. Will allow making it const in future commits.
* fftools/ffmpeg_mux_init: constify metadata specifier argumentsAnton Khirnov2022-10-251-2/+2
|
* fftools/ffmpeg_mux_init: avoid modifying OptionsContext.chapters_input_fileAnton Khirnov2022-10-251-7/+8
| | | | | Use a local variable instead. This will allow making OptionsContext const in future commits.
* fftools/ffmpeg: factor out copying metadata/chapters from of_open()Anton Khirnov2022-10-251-57/+66
| | | | | This code shares variables like OptionsContext.metadata_*_manual, so it makes sense to group it together.
* 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: Deprecate display rotation override with a metadata keyJan Ekström2022-10-191-0/+10
| | | | | | | | Now that we have proper options for defining display matrix overrides, this should no longer be required. fftools does not have its own versioning, so for now the define is just set to 1 and disables the functionality if set to zero.
* fftools/ffmpeg_opt: Move stuff only used by ffmpeg_mux_init to itAndreas Rheinhardt2022-10-181-0/+6
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg_mux: move muxing queue fields from OutputStream to MuxStreamAnton Khirnov2022-10-181-4/+4
| | | | | They are private to the muxer and do not need to be visible outside of it.