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
Anton Khirnov
0fb7d111e8
fftools/ffmpeg: move OutputStream.max_frames to MuxStream
...
It no longer needs to be visible outside of the muxing code.
2022-11-17 10:52:58 +01:00
Anton Khirnov
25620b69e0
fftools/ffmpeg: stop handling max_frames in do_video_out()
...
Frame limiting is now handled using sync queues. This code prevents the
sync queue from triggering EOF, resulting in unnecessarily many frames
being decoded, filtered, and then discarded.
Found-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
2022-11-17 10:52:58 +01:00
Anton Khirnov
6a8145a4b1
fftools/ffmpeg_mux_init: move more code from of_open() to create_streams()
...
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().
2022-11-17 10:52:58 +01:00
Anton Khirnov
1b076556c6
fftools/ffmpeg: simplify ost_iter()
...
The inner loop never goes through more than 1 iteration, and so can be
replaced by an if().
Found-by: Andreas Rheinhardt
2022-11-17 10:52:58 +01:00
Anton Khirnov
822da7a317
fftools/ffmpeg: make demuxing with one file always blocking
2022-11-16 08:41:14 +01:00
Anton Khirnov
c15eb2773a
fftools/ffmpeg_[de]mux: constify all uses of OptionsContext
2022-11-16 08:41:14 +01:00
Anton Khirnov
4119480681
fftools/ffmpeg_mux_init: stop using OptionsContext as storage in copy_metadata()
...
It should be input-only to this code. Will allow making it const in
future commits.
2022-11-16 08:41:14 +01:00
Anton Khirnov
3c7dd5ed37
fftools/ffmpeg_mux_init: drop a duplicated block in copy_metadata()
...
It does the same thing as the block right below it.
2022-11-16 08:41:14 +01:00
James Almer
b119b3da1e
fftools/ffprobe: support 2D arrays in print_list_fmt()
...
Should fix undefined behavior.
Signed-off-by: James Almer <jamrial@gmail.com>
2022-11-15 23:18:48 -03:00