summaryrefslogtreecommitdiff
path: root/fftools/ffmpeg.c
Commit message (Collapse)AuthorAge
...
* fftools/ffmpeg: reindent after previous commitAnton Khirnov2022-10-18
|
* fftools/ffmpeg: move freeing an output stream into a separate functionAnton Khirnov2022-10-18
|
* fftools/ffmpeg: move init_output_bsfs() to ffmpeg_muxAnton Khirnov2022-10-18
| | | | | Bitstream filtering is done as a part of muxing, so this is the more proper place for this.
* fftools/ffmpeg: move some stream initialization code to ffmpeg_muxAnton Khirnov2022-10-18
| | | | | The code in question is muxing-specific and so belongs there. This will allow make some objects private to the muxer in future commits.
* fftools/ffmpeg: move output_packet() to ffmpeg_muxAnton Khirnov2022-10-18
| | | | | This function is common to both transcoding and streamcopy, so it properly belongs into the muxing code.
* fftools/ffmpeg: move some code from init_output_stream() to ↵Anton Khirnov2022-10-04
| | | | | | | init_output_stream_encode() The code is subtitle-encoding-specific, so this is a more appropriate place for it.
* fftools/ffmpeg: rename OutputStream.sync_opts to next_ptsAnton Khirnov2022-10-04
| | | | The current name is confusing.
* fftools/ffmpeg: pass the timestamp to check_recording_time()Anton Khirnov2022-10-04
| | | | | Stop setting OutputStream.sync_opts for subtitle encoding, as it is now unused.
* fftools/ffmpeg: stop setting OutputStream.sync_opts for streamcopyAnton Khirnov2022-10-04
| | | | It is not used for anything.
* fftools/ffmpeg: drop never-set OutputStream.first_ptsAnton Khirnov2022-10-04
|
* fftools/ffmpeg: cosmeticsAnton Khirnov2022-10-04
| | | | Reindent after previous commit, apply some style fixes.
* fftools/ffmpeg: move forced keyframe processing into its own functionAnton Khirnov2022-10-04
|
* fftools/ffmpeg: drop always-true conditionsAnton Khirnov2022-10-04
| | | | | in_picture->pts cannot be AV_NOPTS_VALUE, as it is set to ost->sync_opts a few lines above. ost->sync_opts is never AV_NOPTS_VALUE.
* fftools/ffmpeg: drop the -async optionAnton Khirnov2022-10-04
| | | | | | | | | | | | 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: fix av_display_rotation_set() type castZhao Zhili2022-09-22
| | | | Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* fftools: Use report_error_then_exit_program() for allocation failuresAndreas Rheinhardt2022-09-01
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* fftools/ffmpeg: use a separate counter for encoded packet data sizeAnton Khirnov2022-08-29
| | | | | | | | | | | | | | | | | update_video_stats() currently uses OutputStream.data_size to print the total size of the encoded stream so far and the average bitrate. However, that field is updated in the muxer thread, right before the packet is sent to the muxer. Not only is this racy, but the numbers may not match even if muxing was in the main thread due to bitstream filters, filesize limiting, etc. Introduce a new counter, data_size_enc, for total size of the packets received from the encoder and use that in update_video_stats(). Rename data_size to data_size_mux to indicate its semantics more clearly. No synchronization is needed for data_size_mux, because it is only read in the main thread in print_final_stats(), which runs after the muxer threads are terminated.
* fftools/ffmpeg: drop OutputStream.encAnton Khirnov2022-08-29
| | | | | | 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: stop accessing av_stream_get_parser() from the main threadAnton Khirnov2022-08-29
| | | | | | | | | | | | | | | It races with the demuxing thread. Instead, send the information along with the demuxed packets. Ideally, the code should stop using the stream-internal parsing completely, but that requires considerably more effort. Fixes races, e.g. in: - fate-h264-brokensps-2580 - fate-h264-extradata-reload - fate-iv8-demux - fate-m4v-cfr - fate-m4v
* fftools/ffmpeg: store a separate copy of input codec parametersAnton Khirnov2022-08-16
| | | | | | | | | | | 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: move packet timestamp processing to demuxer threadAnton Khirnov2022-08-13
| | | | | | | | | Discontinuity detection/correction is left in the main thread, as it is entangled with InputStream.next_dts and related variables, which may be set by decoding code. Fixes races e.g. in fate-ffmpeg-streamloop after aae9de0cb2887e6e0bbfda6ffdf85ab77d3390f0.
* fftools/ffmpeg: use a separate variable for discontinuity offsetAnton Khirnov2022-08-13
| | | | | | This will allow to move normal offset handling to demuxer thread, since discontinuities currently have to be processed in the main thread, as the code uses some decoder-produced values.
* fftools/ffmpeg: simplify conditions in ts_discontinuity_processAnton Khirnov2022-08-13
|
* fftools/ffmpeg: move inter-stream ts discontinuity handling to ↵Anton Khirnov2022-08-13
| | | | ts_discontinuity_process()
* fftools/ffmpeg: move timestamp discontinuity correction out of process_input()Anton Khirnov2022-08-13
|
* fftools/ffmpeg: pre-compute the streamcopy start pts before transcoding startsAnton Khirnov2022-08-13
| | | | | | | InputFile.ts_offset can change during transcoding, due to discontinuity correction. This should not affect the streamcopy starting timestamp. Cf. bf2590aed3e64d44a5e2430fdbe89f91f5e55bfe
* fftools/ffmpeg: move stream-dependent starttime correction to transcode_init()Anton Khirnov2022-08-13
| | | | | Currently this code is located in the discontinuity handling block, where it does not belong.
* fftools/ffmpeg: mark all encode sync queues as done before flushing encodersAnton Khirnov2022-08-13
|
* fftools/ffmpeg: move handling corrupt packets to the input threadAnton Khirnov2022-08-08
|
* fftools/ffmpeg_demux: do not store demux packet in the contextAnton Khirnov2022-08-08
| | | | Its use is local to input_thread().
* fftools/ffmpeg: move -stream_loop handling to the demuxer threadAnton Khirnov2022-08-08
| | | | | | | | | | | | | -stream_loop is currently handled by destroying the demuxer thread, seeking, then recreating it anew. This is very messy and conflicts with the future goal of moving each major ffmpeg component into its own thread. Handle -stream_loop directly in the demuxer thread. Looping requires the demuxer to know the duration of the file, which takes into account the duration of the last decoded audio frame (if any). Use a thread message queue to communicate this information from the main thread to the demuxer thread.
* fftools/ffmpeg: move seek_to_start() to ffmpeg_demux.cAnton Khirnov2022-08-08
| | | | Reduces the diff in the following commit.
* fftools/ffmpeg: move get_input_packet() to ffmpeg_demux.cAnton Khirnov2022-08-08
| | | | Also rename it to use the ifile_* namespace.
* fftools/ffmpeg: report new streams from the input threadAnton Khirnov2022-08-08
| | | | | | This avoids a potential race with the demuxer adding new streams. It is also more efficient, since we no longer do inter-thread transfers of packets that will be just discarded.
* fftools/ffmpeg: handle dumping input packets in input_thread()Anton Khirnov2022-08-08
| | | | This is a more appropriate place for this.
* fftools/ffmpeg: drop the 'h' key handlingAnton Khirnov2022-08-08
| | | | | | | | | This undocumented feature runtime-enables dumping input packets. I can think of no reasonable real-world use case that cannot also be accomplished in a different way. Keeping this functionality would interfere with the following commit moving it to the input thread (then setting the variable would require locking or atomics, which would be unnecessarily complicated for a feature that probably nobody uses).
* fftools/ffmpeg: move the input thread into its own fileAnton Khirnov2022-08-08
| | | | It will contain more demuxing-specific code in the future.
* fftools/ffmpeg: drop a write-only variableAnton Khirnov2022-08-08
|
* fftools/ffmpeg: always read input in a threadAnton Khirnov2022-08-08
| | | | This will be required by the following architecture changes.
* fftools/ffmpeg: drop a superfluous stack variableAnton Khirnov2022-08-08
|
* fftools/ffmpeg: remove OutputStream.sync_istAnton Khirnov2022-08-08
| | | | It is not actually used for anything.
* fftools/ffmpeg: remove OutputStream.encoding_neededAnton Khirnov2022-08-08
| | | | It is unnecessary, as it is always exactly equivalent to !!ost->enc_ctx
* fftools/ffmpeg: remove OutputStream.stream_copyAnton Khirnov2022-08-08
| | | | | | | | | | | | | | | 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: stop accessing the decoder context unnecessarilyAnton Khirnov2022-08-08
| | | | | | The same information is available from AVStream.codecpar. This will allow to stop allocating a decoder unless decoding is actually performed.
* fftools/ffmpeg: do not log to the decoder contextAnton Khirnov2022-07-28
| | | | | That should only be done from inside the decoder. Log to NULL instead, as is the current convention in ffmpeg.
* 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: drop unused hwaccel variablesAnton Khirnov2022-07-28
|
* fftools/ffmpeg: stop allocating an encoder context when not encodingAnton Khirnov2022-07-28
|
* fftools/ffmpeg: do not use the encoder context for streamcopyAnton Khirnov2022-07-28
| | | | | | The streamcopy initialization code briefly needs an AVCodecContext to apply AVOptions to. Allocate a temporary codec context, do not use the encoding one.