summaryrefslogtreecommitdiff
path: root/fftools/ffmpeg_opt.c
Commit message (Collapse)AuthorAge
* fftools/ffmpeg_opt: reindentAnton Khirnov2022-07-28
|
* fftools/ffmpeg_opt: factor manually mapping streams out of open_output_file()Anton Khirnov2022-07-28
|
* fftools/ffmpeg_opt: reindentAnton Khirnov2022-07-28
|
* fftools/ffmpeg_opt: factor auto-mapping data streams out of open_output_file()Anton Khirnov2022-07-28
|
* fftools/ffmpeg_opt: reduce indentation in map_auto_subtitle()Anton Khirnov2022-07-28
| | | | | Fix indentation after the previous commit. Also use an early return to save one extra indentation level.
* fftools/ffmpeg_opt: factor auto-mapping subtitles out of open_output_file()Anton Khirnov2022-07-28
|
* fftools/ffmpeg_opt: reduce indentation in map_auto_audio()Anton Khirnov2022-07-28
| | | | | Fix indentation after the previous commit. Also use an early return to save one extra indentation level.
* fftools/ffmpeg_opt: factor auto-mapping audio out of open_output_file()Anton Khirnov2022-07-28
|
* fftools/ffmpeg_opt: reduce indentation in map_auto_video()Anton Khirnov2022-07-28
| | | | | Fix indentation after the previous commit. Also use an early return to save one extra indentation level.
* fftools/ffmpeg_opt: factor auto-mapping video out of open_output_file()Anton Khirnov2022-07-28
|
* fftools/ffmpeg: deprecate the -map_channel optionAnton Khirnov2022-07-28
| | | | | It is now entirely redundant with audio filters, and is in fact implemented by setting up a 'pan' filter instance.
* fftools/ffmpeg: move guess_input_channel_layout() to ffmpeg_opt.cAnton Khirnov2022-07-28
| | | | That is the only place where it is used. Also make it static.
* fftools/ffmpeg_opt: drop a redundant assignmentAnton Khirnov2022-07-28
| | | | | The codec type will be set by avcodec_alloc_context3(), there is no reason to set it manually.
* fftools/ffmpeg: stop allocating an encoder context when not encodingAnton Khirnov2022-07-28
|
* fftools/ffmpeg: deprecate -psnrAnton Khirnov2022-07-28
| | | | It is entirely redundant with -flags +psnr.
* fftools/ffmpeg: drop OutputStream.ref_parAnton Khirnov2022-07-28
| | | | | It serves no purpose, codec parameters can be written directly to AVStream.codecpar with the same effect.
* fftools/ffmpeg: drop the -vol optionAnton Khirnov2022-07-28
| | | | It has been deprecated in favor of the volume filter since 2012.
* fftools/ffmpeg: move each muxer to a separate threadAnton Khirnov2022-07-23
|
* fftools/ffmpeg: depend on threadsAnton Khirnov2022-07-23
| | | | | ffmpeg will be switched to a fully threaded architecture, starting with muxers.
* fftools/ffmpeg: make the muxer AVFormatContext private to ffmpeg_mux.cAnton Khirnov2022-07-23
| | | | | Since the muxer will operate in a separate thread in the future, the muxer context should not be accessed from the outside.
* fftools/ffmpeg: use the sync queues to handle -framesAnton Khirnov2022-07-23
| | | | | | | | | | | | | | | | Same issues apply to it as to -shortest. Changes the results of the following tests: - matroska-flac-extradata-update The test reencodes two input FLAC streams into three output FLAC streams. The last output stream is limited to 8 frames. The current code results in the first two output streams having 12 frames, after this commit all three streams have 8 frames and are the same length. This new result is better, since it is predictable. - mkv-1242 The test streamcopies one video and one audio stream, video is limited to 11 frames. The new result shortens the audio stream so that it is not longer than the video.
* fftools/ffmpeg: rework -shortest implementationAnton Khirnov2022-07-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The -shortest option (which finishes the output file at the time the shortest stream ends) is currently implemented by faking the -t option when an output stream ends. This approach is fragile, since it depends on the frames/packets being processed in a specific order. E.g. there are currently some situations in which the output file length will depend unpredictably on unrelated factors like encoder delay. More importantly, the present work aiming at splitting various ffmpeg components into different threads will make this approach completely unworkable, since the frames/packets will arrive in effectively random order. This commit introduces a "sync queue", which is essentially a collection of FIFOs, one per stream. Frames/packets are submitted to these FIFOs and are then released for further processing (encoding or muxing) when it is ensured that the frame in question will not cause its stream to get ahead of the other streams (the logic is similar to libavformat's interleaving queue). These sync queues are then used for encoding and/or muxing when the -shortest option is specified. A new option – -shortest_buf_duration – controls the maximum number of queued packets, to avoid runaway memory usage. This commit changes the results of the following tests: - copy-shortest[12]: the last audio frame is now gone. This is correct, since it actually outlasts the last video frame. - shortest-sub: the video packets following the last subtitle packet are now gone. This is also correct.
* fftools/ffmpeg: use last filter output pts to choose next output streamAnton Khirnov2022-07-23
| | | | | This will be needed in following commits that will add new buffering stages after encoding and bitstream filtering.
* fftools/ffmpeg: move output file opts into private contextAnton Khirnov2022-07-23
| | | | It is private to the muxer, no reason to access it from outside.
* fftools/ffmpeg: move the mux queue into muxer private dataAnton Khirnov2022-07-23
| | | | | | | | | The muxing queue currently lives in OutputStream, which is a very large struct storing the state for both encoding and muxing. The muxing queue is only used by the code in ffmpeg_mux, so it makes sense to restrict it to that file. This makes the first step towards reducing the scope of OutputStream.
* fftools/ffmpeg: refactor the code checking for bitexact outputAnton Khirnov2022-07-23
| | | | | | | | Figure out earlier whether the output stream/file should be bitexact and store this information in a flag in OutputFile/OutputStream. Stop accessing the muxer in set_encoder_id(), which will become forbidden in future commits.
* fftools/ffmpeg: refactor limiting output file size with -fsAnton Khirnov2022-07-23
| | | | | | Move the file size checking code to ffmpeg_mux. Use the recently introduced of_filesize(), making this code consistent with the size shown by print_report().
* fftools/ffmpeg: fix the type of limit_filesizeAnton Khirnov2022-07-23
| | | | | The option is parsed as INT64 (signed). It is also compared to the output of avio_tell(), which is also int64_t.
* fftools/ffmpeg_mux: add private muxer contextAnton Khirnov2022-07-23
| | | | | | | | Move header_written into it, which is not (and should not be) used by any code outside of ffmpeg_mux. In the future this context will contain more muxer-private state that should not be visible to other code.
* ffmpeg: add option -isyncGyan Doshi2022-07-14
| | | | | | | | | | | | This is a per-file input option that adjusts an input's timestamps with reference to another input, so that emitted packet timestamps account for the difference between the start times of the two inputs. Typical use case is to sync two or more live inputs such as from capture devices. Both the target and reference input source timestamps should be based on the same clock source. If either input lacks starting timestamps, then no sync adjustment is made.
* fftools: Remove MAX_PATH limit and switch to UTF-8 versions of fopen() and ↵Nil Admirari2022-06-21
| | | | | | getenv() Signed-off-by: Martin Storsjö <martin@martin.st>
* ffmpeg: add option fps_modeGyan Doshi2022-06-11
| | | | | | | fps_mode sets video sync per output stream. Overrides vsync for matching streams. vsync is deprecated.
* fftools/ffmpeg: fix 2pass log file namesAnton Khirnov2022-05-24
| | | | | | | Use the global stream index rather than an unrelated variable in the filename. Broken in 6d5d9246042.
* fftools: Stop using av_fopen_utf8Martin Storsjö2022-05-23
| | | | | | | | | | Provide a header based inline reimplementation of it. Using av_fopen_utf8 doesn't work outside of the libraries when built with MSVC as shared libraries (in the default configuration, where each DLL gets a separate statically linked CRT). Signed-off-by: Martin Storsjö <martin@martin.st>
* fftools/ffmpeg: store output format separately from the muxer contextAnton Khirnov2022-04-13
| | | | | | Allows accessing it without going through the muxer context. This will be useful in the following commits, where the muxer context will be hidden.
* fftools/ffmpeg: store the output file index in OutputFileAnton Khirnov2022-04-13
| | | | | Use it to simplify check_init_output_file(). Will allow further simplifications in the following commits.
* fftools/ffmpeg: pass the muxer context explicitly to some functionsAnton Khirnov2022-04-13
| | | | | Stop accessing OutputFile.ctx. This will be useful in the following commits, where it will become hidden.
* fftools/ffmpeg: drop mistakenly added empty lineAnton Khirnov2022-03-22
|
* fftools: move opt_timelimit from cmdutils to ffmpegAnton Khirnov2022-03-22
| | | | This option is only supported by ffmpeg.
* fftools/cmdutils: split common option handlers into their own fileAnton Khirnov2022-03-22
|
* ffmpeg: make the ac option set the demuxer's ch_layout AVOptionJames Almer2022-03-22
| | | | | | channels is deprecated on all supported raw demuxers. Signed-off-by: James Almer <jamrial@gmail.com>
* ffmpeg: add a ch_layout option as an alias to channel_layoutJames Almer2022-03-22
| | | | | | This ensures it's parsed as a CLI option instead of the AVCodecContext AVOption. Signed-off-by: James Almer <jamrial@gmail.com>
* ffmpeg: replace custom channel_layout code with an SpecifierOpt based oneJames Almer2022-03-22
| | | | | | This is cleaner and allows fine tuning which stream the option is applied to. Signed-off-by: James Almer <jamrial@gmail.com>
* ffmpeg: convert to new channel layout-APIJames Almer2022-03-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* fftools/ffmpeg_opt: Apply copyinkf for all stream typesAndreas Rheinhardt2022-03-04
| | | | | | | | | | The earlier code has ignored it for all stream types except video and subtitles, probably because audio was presumed to only consist of keyframes. Yet this assumption is not true for e.g. TrueHD. Reviewed-by: Jan Ekström <jeebjp@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg_opt: Simplify adding complex filtergraphAndreas Rheinhardt2022-03-03
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg_opt: Simplify adding new input/output streamsAndreas Rheinhardt2022-03-03
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* ffmpeg: flush delayed frames in codec copy scenariosJames Almer2022-02-28
| | | | | | | Bitstream filters inserted between the input and output were never drained, resulting in packets being lost if the bsf had any buffered. Signed-off-by: James Almer <jamrial@gmail.com>
* ffmpeg: switch to new FIFO APIAnton Khirnov2022-02-07
|
* ffmpeg: move setting video sync method to new_video_stream()Anton Khirnov2021-12-07
| | | | | | do_video_out() is the wrong place for it, since the necessary information is already known when creating the stream and its value should never change.