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
2 years ago
Anton Khirnov
7655249f72
fftools/ffmpeg: reindent after previous commit
2 years ago
Anton Khirnov
a848a5a223
fftools/ffmpeg: move video frame dup/drop logic into its own function
2 years ago
Anton Khirnov
5874ca3650
fftools/ffmpeg: rename a variable to be more descriptive
2 years ago
Anton Khirnov
3b21f10639
fftools/ffmpeg: fix stream id in an error message.
...
Broken in 7ef7a22251
2 years ago
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.
2 years ago
Marvin Scholz
f1907faab4
fftools: use av_dict_iterate
...
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2 years ago
Anton Khirnov
becbb22eb0
fftools/ffmpeg: cosmetics
...
Reindent after previous commit and break/split some lines as
appropriate.
2 years ago
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.
2 years ago
Anton Khirnov
d60d6d819d
fftools/ffmpeg: drop an always-false check
2 years ago
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.
2 years ago
Anton Khirnov
617ea07c22
fftools/ffmpeg: call check_recording_time() with actual frame pts
...
Not its estimated value that will not necessarily be used.
2 years ago
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().
2 years ago
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.
2 years ago
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.
2 years ago
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.
2 years ago
Anton Khirnov
334e52e094
fftools/ffmpeg: parse forced keyframes in of_open()
...
Allows to remove the ugly of_get_chapters() wrapper.
2 years ago
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.
2 years ago
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.
2 years ago
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().
2 years ago
Anton Khirnov
996fed5235
fftools/ffmpeg: declare loop variables inside loops in transcode_init()
2 years ago
Anton Khirnov
005f4e1caf
fftools/ffmpeg: do not assume input streams exist
...
There can be zero input streams, with input provided by lavfi complex
filtergraphs.
2 years ago
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
.
2 years ago
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.
2 years ago
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.
2 years ago
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.
2 years ago
Anton Khirnov
9654df1336
fftools/ffmpeg: move freeing an input stream into a separate function
2 years ago
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>
2 years ago
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
2 years ago
Gyan Doshi
5ccd4d3060
ffmpeg: fix implementation of updated input start time
...
The current adjustment of input start times just adjusts the tsoffset.
And it does so, by resetting the tsoffset to nullify the new start time.
This leads to breakage of -copyts, ignoring of input_ts_offset, breaking
of -isync as well as breaking wrap correction.
Fixed by taking cognizance of these parameters, and by correcting start times
just before sync offsets are applied.
2 years ago
Gyan Doshi
93faba449c
ffmpeg: shift start time correction to ffmpeg_opt
...
In preparation for applying start time correction that accounts for all
factors such as copyts, input_ts_offset ..etc
2 years ago
Anton Khirnov
c20977c4e0
fftools/ffmpeg: drop free_input_threads()
...
Stop demuxer threads in ifile_close() instead. Simplifies the demuxer
API.
2 years ago
Anton Khirnov
295848bacb
fftools/ffmpeg: move closing the input file into a separate function
...
For now this is just closing the format context and freeing InputFile,
but will contain more in the future.
2 years ago
Anton Khirnov
09cd147dcc
fftools/ffmpeg: drop init_input_threads()
...
Start threads implicitly when ifile_get_packet() is called. Simplifies
the demuxer API.
2 years ago
Jan Ekström
b9058765d7
ffmpeg: Deprecate display rotation override with a metadata key
...
Now that we have proper options for defining display matrix
overrides, this should no longer be required.
fftools does not have its own versioning, so for now the define is
just set to 1 and disables the functionality if set to zero.
2 years ago
Anton Khirnov
709b47f8a4
fftools/ffmpeg: free output streams in of_close()
...
Output streams are now children of OutputFile, so it makes more sense to
free them there.
2 years ago
Anton Khirnov
fe304c0694
fftools/ffmpeg: remove a cleanup block at the end of transcode()
...
Some of it is already duplicated in ost_free() - those parts can be just
dropped. The rest is moved to ost_free(), as it properly belongs there.
2 years ago
Anton Khirnov
7ef7a22251
fftools/ffmpeg: remove the output_streams global
...
Replace it with an array of streams in each OutputFile. This is a more
accurate reflection of the actual relationship between OutputStream and
OutputFile. This is easier to handle and will allow further
simplifications in future commits.
2 years ago
Anton Khirnov
18d96e8703
fftools/ffmpeg: reindent after previous commit
2 years ago
Anton Khirnov
2dcedd9af8
fftools/ffmpeg: move freeing an output stream into a separate function
2 years ago
Anton Khirnov
9f9bf8703b
fftools/ffmpeg: move init_output_bsfs() to ffmpeg_mux
...
Bitstream filtering is done as a part of muxing, so this is the more
proper place for this.
2 years ago
Anton Khirnov
965bff37b6
fftools/ffmpeg: move some stream initialization code to ffmpeg_mux
...
The code in question is muxing-specific and so belongs there. This will
allow make some objects private to the muxer in future commits.
2 years ago
Anton Khirnov
d579a70291
fftools/ffmpeg: move output_packet() to ffmpeg_mux
...
This function is common to both transcoding and streamcopy, so it
properly belongs into the muxing code.
2 years ago
Anton Khirnov
044d70736e
fftools/ffmpeg: move some code from init_output_stream() to init_output_stream_encode()
...
The code is subtitle-encoding-specific, so this is a more appropriate
place for it.
2 years ago
Anton Khirnov
29188f9c62
fftools/ffmpeg: rename OutputStream.sync_opts to next_pts
...
The current name is confusing.
2 years ago
Anton Khirnov
3c0f532cbc
fftools/ffmpeg: pass the timestamp to check_recording_time()
...
Stop setting OutputStream.sync_opts for subtitle encoding, as it is now
unused.
2 years ago
Anton Khirnov
69f770f77c
fftools/ffmpeg: stop setting OutputStream.sync_opts for streamcopy
...
It is not used for anything.
2 years ago
Anton Khirnov
76678b7137
fftools/ffmpeg: drop never-set OutputStream.first_pts
2 years ago
Anton Khirnov
5188aeaffb
fftools/ffmpeg: cosmetics
...
Reindent after previous commit, apply some style fixes.
2 years ago
Anton Khirnov
c75be06148
fftools/ffmpeg: move forced keyframe processing into its own function
2 years ago