Jan Ekström
746d27455b
ffmpeg: move decoded frame counter from after post-processing to decode
...
This way we can call process_subtitles without causing the decoded
frame counter to get bumped.
Additionally, this now takes into mention all of the decoded
subtitle frames without fix_sub_duration latency/buffering, or filtering
out decoded reset/end subtitles without any rendered rectangles, which
matches the original intent in 4754345027
.
Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2023-02-03 12:21:02 +02:00
Jan Ekström
fcc50674de
ffmpeg: refactor post-decoding steps for subtitles into a function
...
This enables us to later call this when generating additional
subtitles for splitting purposes.
Co-authored-by: Andrzej Nadachowski <andrzej.nadachowski@24i.com>
Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
2023-02-03 12:21:02 +02:00
Anton Khirnov
806ecace91
fftools/ffmpeg: support input frame params in encoding stats
2023-01-31 09:09:23 +01:00
Anton Khirnov
61afbc2376
fftools/ffmpeg: use correct IO context for -enc_stats_post
2023-01-31 09:09:11 +01:00
Anton Khirnov
9b5036fabd
fftools/ffmpeg: add an AVClass to MuxStream/OutputStream
...
Use it for logging. This makes log messages related to this output
stream more consistent.
2023-01-29 09:12:22 +01:00
Anton Khirnov
d2c983c213
fftools/ffmpeg: add an AVClass to Muxer/OutputFile
...
Use it for logging. This makes log messages related to this output file
more consistent.
2023-01-29 09:10:57 +01:00
Anton Khirnov
425b2c4a56
fftools/ffmpeg: add options for writing encoding stats
...
Similar to -vstats, but more flexible:
- works for audio as well as video
- frame and/or packet information
- user-specifiable format
2023-01-29 09:09:59 +01:00
Stefano Sabatini
843a446713
ffprobe: fix data hash rendering
...
Print data hash before side data list, fix wrong nesting level of data hash
element.
In particular, fix trac issue:
http://trac.ffmpeg.org/ticket/7217
2023-01-24 23:58:00 +01:00
Stefano Sabatini
b6219c9114
ffprobe: use pkt->dts to compute interval ts when pts is missing
...
For some samples the pkt->pts is always missing, use the pkt->dts
instead.
Fix trac issue:
http://trac.ffmpeg.org/ticket/4427
2023-01-24 23:58:00 +01:00
Jan Ekström
be76a9bd32
ffprobe: expose AVAmbientViewingEnvironment side data in AVFrames
2023-01-13 21:26:27 +02:00
Zhao Zhili
52eb2396d7
fftools/ffmpeg_demux: prefer fd over pipe for seek support
...
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-01-11 18:50:36 +08:00
Zhao Zhili
244f3cfbe3
fftools/ffprobe: prefer fd over pipe for seek support
...
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-01-11 18:50:36 +08:00
Zhao Zhili
c926140558
fftools/ffplay: prefer fd over pipe for seek support
...
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-01-11 18:50:36 +08:00
Zhao Zhili
195ccf7ea8
fftools/ffmpeg_demux: disable stdin interaction for fd protocol
...
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-01-11 18:50:36 +08:00
Anton Khirnov
260f391893
fftools/ffmpeg: always generate CFR output when -r is used
...
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).
2023-01-10 11:49:28 +01:00
Anton Khirnov
7655249f72
fftools/ffmpeg: reindent after previous commit
2023-01-10 11:49:28 +01:00
Anton Khirnov
a848a5a223
fftools/ffmpeg: move video frame dup/drop logic into its own function
2023-01-10 11:49:28 +01:00
Anton Khirnov
5874ca3650
fftools/ffmpeg: rename a variable to be more descriptive
2023-01-10 11:49:28 +01:00
Anton Khirnov
3b21f10639
fftools/ffmpeg: fix stream id in an error message.
...
Broken in 7ef7a22251
2023-01-10 11:49:28 +01:00
Anton Khirnov
c60941dfaf
fftools/ffmpeg: stop using AVCodecContext.sample_rate in decode_audio()
...
Use the decoded frame's sample_rate instead, which is the authoritative
value.
Drop a now-obsolete check validating AVCodecContext.sample_rate.
2023-01-10 11:49:28 +01:00
Marvin Scholz
ece29ad0dc
fftools: use av_dict_get_string
...
Instead of manually assembling the string, use av_dict_get_string
which handles things like proper escaping too (even though it is
not yet needed here).
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-01 11:21:14 +01:00
Marvin Scholz
f1907faab4
fftools: use av_dict_iterate
...
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-12-01 11:21:14 +01:00
Anton Khirnov
becbb22eb0
fftools/ffmpeg: cosmetics
...
Reindent after previous commit and break/split some lines as
appropriate.
2022-11-28 10:28:14 +01:00
Anton Khirnov
d04ec7efe3
fftools/ffmpeg: remove a useless inner block
...
adjust_frame_pts_to_encoder_tb() is so small that this serves no useful
purpose.
2022-11-28 10:28:14 +01:00
Anton Khirnov
d60d6d819d
fftools/ffmpeg: drop an always-false check
2022-11-28 10:28:14 +01:00
Anton Khirnov
8ee4365ad8
fftools/ffmpeg: only convert video frame pts if we have a frame
...
Calling adjust_frame_pts_to_encoder_tb() with a NULL frame does not
perform a meaningful action.
2022-11-28 10:28:14 +01:00
Anton Khirnov
617ea07c22
fftools/ffmpeg: call check_recording_time() with actual frame pts
...
Not its estimated value that will not necessarily be used.
2022-11-28 10:28:14 +01:00
Anton Khirnov
86a71d6b3c
fftools/ffmpeg: stop calling adjust_frame_pts_to_encoder_tb() for audio
...
Almost none of that function's complexity is useful for audio, it can
be replaced by a simple av_rescale_q().
2022-11-28 10:28:14 +01:00
Anton Khirnov
a186360f27
fftools/ffmpeg: set AVFrame.time_base after filtering
...
Makes it easier to track what timebase are the frame timestamps in and
allows to stop accessing filters in code that shouldn't deal with
filtering.
2022-11-28 10:28:14 +01:00
Anton Khirnov
d9534ec84e
fftools/ffmpeg: move logging filtered frame timestamps
...
Do it right after the frame is received from the filtergraph. This is a
more logical place for this and will simplify future commits.
2022-11-28 10:28:14 +01:00
Anton Khirnov
2fa2e146cc
fftools/ffmpeg: avoid storing full forced keyframe spec
...
It is not needed after the spec is parsed. Also avoids ugly string
comparisons for each video frame.
2022-11-28 10:28:14 +01:00
Anton Khirnov
334e52e094
fftools/ffmpeg: parse forced keyframes in of_open()
...
Allows to remove the ugly of_get_chapters() wrapper.
2022-11-28 10:28:14 +01:00
Anton Khirnov
efe4423627
fftools/ffmpeg: store forced keyframe pts in AV_TIME_BASE_Q
...
Rather than the encoder timebase. Since the times are parsed as
microseconds, this will not reduce precision, except possibly when
chapter times are used and the chapter timebase happens to be better
aligned with the encoder timebase, which is unlikely.
This will allow parsing the keyframe times earlier (before encoder
timebase is known) in future commits.
2022-11-28 10:28:14 +01:00
Anton Khirnov
b1143330c8
fftools/ffmpeg: move force-keyframe-related vars to a separate struct
...
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.
2022-11-28 10:28:14 +01:00
Anton Khirnov
630fbdcc52
fftools/ffmpeg: stop explicitly closing decoders
...
It serves no purpose, they will be closed and freed in
avcodec_free_context() called from ist_free().
2022-11-28 10:28:14 +01:00
Anton Khirnov
95af0bcc34
fftools/ffmpeg_mux_init: postpone matching -disposition to streams
...
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().
2022-11-23 10:36:23 +01:00
Anton Khirnov
3da5c60aa9
fftools/ffmpeg: _-prefix variables in MATCH_PER_STREAM_OPT()
...
Avoids conflicts, e.g. when 'i' is used in the outvar expression.
2022-11-23 10:36:23 +01:00
Anton Khirnov
996fed5235
fftools/ffmpeg: declare loop variables inside loops in transcode_init()
2022-11-23 10:36:23 +01:00
Anton Khirnov
005f4e1caf
fftools/ffmpeg: do not assume input streams exist
...
There can be zero input streams, with input provided by lavfi complex
filtergraphs.
2022-11-23 10:36:23 +01:00
Anton Khirnov
fd8bf8d3b5
fftools/ffmpeg: remove the input_streams global
...
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
7ef7a22251
.
2022-11-23 10:36:23 +01:00
Anton Khirnov
86e2ffedfe
fftools/ffmpeg_mux_init: simplify inner loop in map_auto_{video,audio}
...
Skip unusable streams early and do not compute any scores for them.
2022-11-23 10:36:23 +01:00
Anton Khirnov
4c40581614
fftools/ffmpeg: replace OutputStream.source_index with a pointer to InputStream
...
This is simpler. The indirection via an index exists for historical
reasons that longer apply.
2022-11-23 10:36:23 +01:00
Anton Khirnov
bda06c60fe
fftools/ffmpeg: stop inventing fake source information
...
This code was supposed to affect copying stream dispositions, but it
does not achieve that after bd55552d69
, since dispositions are set
earlier.
2022-11-23 10:36:23 +01:00
Anton Khirnov
50ecba7e84
fftools/ffmpeg: drop an arbitrary condition
...
Encoding init code will currently fall back to a 25fps default when no
framerate is known or specified, but only if there is a known source
input stream. There is no good reason for this condition, so drop it.
2022-11-23 10:36:23 +01:00
Anton Khirnov
9654df1336
fftools/ffmpeg: move freeing an input stream into a separate function
2022-11-23 10:36:23 +01:00
Zhao Zhili
c0c0a5f106
fftools/ffmpeg_demux: set default hwaccel_output_format for mediacodec
...
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-11-21 23:57:10 +08:00
Anton Khirnov
b58264217b
fftools/ffmpeg_mux_init: drop an always-false check
...
It cannot be true since 1959351aec
. Effectively reverts 6a3833e141
.
2022-11-17 10:52:58 +01:00
Anton Khirnov
13947aff3f
fftools/ffmpeg_mux_init: use av_dict_iterate() where appropriate
2022-11-17 10:52:58 +01:00
Anton Khirnov
19e192eae6
fftools/ffmpeg_mux_init: do not call av{codec,format}_get_class() repeatedly
2022-11-17 10:52:58 +01:00
Anton Khirnov
52380a055b
fftools/ffmpeg_mux_init: move validating codec avoptions to a separate function
2022-11-17 10:52:58 +01:00