aboutsummaryrefslogtreecommitdiffstats
path: root/fftools/ffmpeg_mux_init.c
Commit message (Collapse)AuthorAgeFilesLines
* fftools/ffmpeg: use an int for nb_threadsJames Almer2025-02-171-2/+2
| | | | | | Removes unnecessary allocations. Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/ffmpeg_mux_init: consolidate connecting source to mux streamAnton Khirnov2024-09-301-19/+18
|
* fftools/ffmpeg_mux_init: move the ost_get_filters() call to ost_bind_filter()Anton Khirnov2024-09-301-9/+9
| | | | That is a more appropriate place for it.
* fftools/ffmpeg_mux_init: move the check for filtering+streamcopyAnton Khirnov2024-09-301-23/+29
| | | | | | | | | | | | To streamcopy_init(). This will allow to simplify the control flow in ost_add() by moving the ost_get_filters() call (which previously had to handle both encoding and streamcopy streams) to ost_bind_filter() (which is only called for audio/video encoding). Also, return EINVAL rather than ENOSYS, as trying to combine filtering with streamcopy is a parameter error.
* fftools/ffmpeg_mux_init: do not export forced_keyframes_const_names[]Anton Khirnov2024-09-301-1/+1
| | | | It is only used in this file.
* fftools/ffmpeg_mux: move OutputStream.enc_ctx to EncoderAnton Khirnov2024-09-301-35/+31
| | | | | The encoding AVCodecContext is a part of the encoder, and so should live there.
* fftools/ffmpeg_demux: drop ist_output_add()Anton Khirnov2024-09-301-8/+9
| | | | It is now a trivial wrapper over ist_use(), so export that directly.
* fftools/ffmpeg_filter: remove remaining OutputStream usage in ↵Anton Khirnov2024-09-261-2/+5
| | | | | | | | | init_simple_filtergraph() With this, nothing in ffmpeg_filter acesses OutputStream anymore, thus there are no more direct ties between filtering and muxing. Rename init_simple_filtergraph() to fg_create_simple() for consistency.
* fftools/ffmpeg_filter: drop the OutputStream parameter to ofilter_bind_ost()Anton Khirnov2024-09-261-1/+1
| | | | | | It is no longer used for anything besides a sanity-checking assert. Rename the function to ofilter_bind_enc(), as it no longer has any assumptions about the target being an output stream.
* fftools/ffmpeg_filter: stop accessing OutputStream.[max_]frame_rateAnton Khirnov2024-09-261-7/+9
| | | | | | | | Pass them to ofilter_bind_ost() via OutputFilterOptions, as is done for most other data it needs. OutputStream.[max_]frame_rate/force_fps are no longer used outside of ffmpeg_mux*, and so can be made private. This is a step toward decoupling encoders from muxers.
* fftools/ffmpeg_enc: move set_encoder_id() to ffmpeg_mux_initAnton Khirnov2024-09-261-3/+28
| | | | | | | | This code uses no encoder properties or state besides its name, and is mostly muxer logic, and thus belongs more properly into the muxer. The results of several test change due to different metadata tag order (the "encoder" tag is now set first).
* fftools/ffmpeg_enc: do not set output stream codec parameters directlyAnton Khirnov2024-09-261-13/+17
| | | | | | | | | | Have the muxer code read them out of the encoder context in of_stream_init() instead. OutputStream.par_in no longer needs to be public, so can be moved to MuxStream. This is a step towards decoupling encoders from muxers.
* fftools/ffmpeg_enc: do not set AVStream timebase directlyAnton Khirnov2024-09-261-1/+1
| | | | | | | | Instead, pass the encoder context to of_stream_init() and have the muxer take the timebase from there. Note that the muxer can currently access the codec context directly, but that will change in future commits. This is a step towards decoupling encoders from muxers.
* fftools/ffmpeg_enc: add an AVClass to EncoderAnton Khirnov2024-09-261-1/+1
| | | | | | | Log decoder messages to the encoder rather than OutputStream. This is a step towards decoupling encoders from muxers, similarly to what was previously done to decoders and demuxers.
* fftools/ffmpeg: add support for multiview videoAnton Khirnov2024-09-231-11/+23
| | | | | | | | This extends the syntax for specifying input streams in -map and complex filtergraph labels, to allow selecting a view by view ID, index, or position. The corresponding decoder is then set up to decode the appropriate view and send frames for that view to the correct filtergraph input(s).
* fftools/ffmpeg_sched: allow decoders to have multiple outputsAnton Khirnov2024-09-231-1/+1
| | | | Will be useful for multilayer video.
* ffmpeg_mux_init: correct log suggestionGyan Doshi2024-09-191-1/+1
| | | | The option is enc_time_base, not enc_timebase
* fftools/ffmpeg_mux_init: fix variable shadowingMarvin Scholz2024-09-131-10/+7
|
* fftools/ffmpeg_mux_init: remove unused variableMarvin Scholz2024-09-131-2/+0
| | | | This dict is declared and freed but nothing is ever written to it.
* fftools/ffmpeg: remove useless error checkMarvin Scholz2024-09-121-2/+0
| | | | | | | | | | | | When ret is checked here, it was never assigned anything, making this check useless, as highlighted by Coverity. It seems to be a copy paste mistake given that opt_match_per_stream_str does not return an error code that could be checked and the previous value assigned to ret is already checked above. So just remove this check. Fixes: CID1616292
* fftools/ffmpeg_filter: remove YUVJ hackNiklas Haas2024-09-081-15/+0
| | | | | | | This is no longer needed, since we now correctly negotiate the required range from the mjpeg encoder via avcodec_get_supported_config(). Signed-off-by: Anton Khirnov <anton@khirnov.net>
* fftools/ffmpeg_filter: propagate codec yuv metadata to filtersNiklas Haas2024-09-081-0/+12
| | | | | | | To convert between color spaces/ranges, if needed by the codec properties. Signed-off-by: Anton Khirnov <anton@khirnov.net>
* fftools/ffmpeg_filter: switch to avcodec_get_supported_config()Niklas Haas2024-09-081-1/+34
| | | | Signed-off-by: Anton Khirnov <anton@khirnov.net>
* fftools/ffmpeg_mux_init: factor out binding filters to output streamsAnton Khirnov2024-09-081-59/+78
|
* fftools/ffmpeg_mux_init: switch to avcodec_get_supported_config()Niklas Haas2024-09-081-5/+17
|
* fftools/ffmpeg: Fix honor -r output option with streamcopyNicolas Gaullier2024-09-041-1/+0
| | | | | | | | | | | | | | | Fix "ost->st->avg_frame_rate = ost->frame_rate" in streamcopy_init() being reset to input's frame rate a few lines below. Note that in current code, there are some discrepancies amongst the muxers. For example, avienc relies on time_base, so it is not affected by this patch, whereas mxfenc and matroskaenc do use avg_frame_rate, so this patch fixes -r being honored. In the updated fate test, the input is (wrongly) probed as 50fps. With this patch, the correct value (25fps) is successfully forced with -r. Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris> Signed-off-by: Anton Khirnov <anton@khirnov.net>
* fftools/ffmpeg: use new stream specifier API in opt_match_per_stream*()Anton Khirnov2024-08-131-148/+50
| | | | Removes a lot of error checking code, as matching cannot fail.
* fftools/ffmpeg: replace remaining uses of MATCH_PER_STREAM_OPT()Anton Khirnov2024-08-131-20/+51
|
* fftools/ffmpeg: replace MATCH_PER_STREAM_OPT(.., str, ..) with a functionAnton Khirnov2024-08-131-44/+112
| | | | | | | | | | | | | | | | | | | | | This has multiple advantages: * The macro has multiple parameters that often have similar or identical values, yet very different meanings (one is the name of the OptionsContext member where the parsed options are stored, the other the name of the variable into which the result is written); this change makes each of these explicit. * The macro returns on failure, which may cause leaks - this was the reason for adding MATCH_PER_STREAM_OPT_CLEAN(), also ost_add() currently leaks encoder_opts. The new function returns failure to its caller, which decides how to deal with it. While that adds a lot of error checks/forwards for now, those will be reduced in following commits. * new code is type- and const- correct Invocations of MATCH_PER_STREAM_OPT() with other types will be converted in following commits.
* fftools/ffmpeg_mux_init: default to input timebase for streamcopyAnton Khirnov2024-07-091-6/+1
| | | | | Stop trying to invent some "framerate-based" timebase when there is no reason to think the stream is CFR at all.
* fftools/ffmpeg_mux_init: make encoder_opts local to ost_add()Anton Khirnov2024-07-031-31/+40
| | | | It is no longer needed after this function returns.
* fftools/ffmpeg_mux_init: apply encoder options manuallyAnton Khirnov2024-07-031-31/+35
| | | | | | | | | | | | | | | Do not pass an options dictionary to the avcodec_open2() in enc_open(). This is cleaner and more robust, as previously various bits of code would try to interpret the contents of the options dictionary, with varying degrees of correctness. Now they can just access the encoder AVCodecContext directly. Cf. 372c78dd42f2b1ca743473b9c32fad71c65919e0 - analogous change for decoding. A non-progressive field order is now written on the container level in interlaced ProRes encoding tests.
* fftools/ffmpeg: rewrite checking whether codec AVOptions have been usedAnton Khirnov2024-07-031-50/+6
| | | | | | Share the code between encoding and decoding. Instead of checking every stream's options dictionary (which is also used for other purposes), track all used options in a dedicated dictionary.
* fftools/ffmpeg_mux_init: Cleanup on error return in set_dispositions()Michael Niedermayer2024-07-021-1/+1
| | | | | | | Fixes: CID1539099 Resource leak Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec: add external enc libvvenc for H266/VVCThomas Siedel2024-06-151-1/+1
| | | | | | | | | | | | Add external encoder VVenC for H266/VVC encoding. Register new encoder libvvenc. Add libvvenc to wrap the vvenc interface. libvvenc implements encoder option: preset,qp,qpa,period, passlogfile,stats,vvenc-params,level,tier. Enable encoder by adding --enable-libvvenc in configure step. Co-authored-by: Christian Bartnik chris10317h5@gmail.com Signed-off-by: Thomas Siedel <thomas.ff@spin-digital.com>
* fftools/ffmpeg_mux_init: Fix leak when using non-encoding optionAndreas Rheinhardt2024-06-111-0/+1
| | | | | Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg_mux_init: Return error upon errorAndreas Rheinhardt2024-06-111-3/+7
| | | | | | | | | Currently it may return an uninitialized value. Introduced in 840f2bc18eddd72fa886aec30efc82991b920c45. Fixes Coverity issue #1603565. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg_mux_init: Free pts on errorMichael Niedermayer2024-06-071-1/+1
| | | | | | | Fixes: CID1538863 Resource leak Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* fftools/ffmpeg_mux_init: add missing IAMF Param Definition copiesJames Almer2024-04-241-0/+25
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/ffmpeg_mux_init: remove leftover debug log messagesJames Almer2024-04-241-2/+0
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/ffmpeg_mux_init: allow mapping a stream group from one of the inputsJames Almer2024-04-231-2/+152
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/ffmpeg_filter: drop OutputFilter.ostAnton Khirnov2024-04-091-1/+1
| | | | | All remaining code accessing it only needs to know whether this filtergraph output has been bound or not.
* fftools/ffmpeg_filter: accept encoder thread count through OutputFilterOptionsAnton Khirnov2024-04-091-0/+5
| | | | | | Stop digging through encoder options manually. Will allow decoupling filtering from encoding in future commits.
* fftools/ffmpeg_mux: drop OutputFile.formatAnton Khirnov2024-04-091-1/+0
| | | | | It is no longer used outside of the muxing code (where we can access the muxer directly).
* fftools/ffmpeg_mux: drop OutputFile.shortestAnton Khirnov2024-04-091-8/+9
| | | | It is no longer needed outside of of_open() and its children.
* fftools/ffmpeg_filter: move most of -apad logic to the muxerAnton Khirnov2024-04-091-7/+29
| | | | | | The decision whether -apad actually does anything is made based on muxer properties, and so more properly belongs there. Filtering code only receives the result.
* fftools/ffmpeg_filter: pass trim parameters through OutputFilterOptionsAnton Khirnov2024-04-091-0/+2
| | | | | | Do not read them from OutputStream directly. Will allow decoupling filtering from encoding in future commits.
* fftools/ffmpeg_filter: pass autoscale through OutputFilterOptionsAnton Khirnov2024-04-091-3/+4
| | | | | | Do not read it from OutputStream directly. Will allow decoupling filtering from encoding in future commits.
* fftools/ffmpeg_filter: pass sws/swr opts through OutputFilterOptionsAnton Khirnov2024-04-091-7/+4
| | | | | | Do not read them from OutputStream directly. Will allow decoupling filtering from encoding in future commits.
* fftools/ffmpeg_filter: accept a caller-provided output nameAnton Khirnov2024-04-091-0/+4
| | | | | | Do not construct it from OutputStream manually. Will allow decoupling filtering from encoding in future commits.