aboutsummaryrefslogtreecommitdiffstats
path: root/fftools/ffmpeg_mux.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-05-28 10:25:45 +0200
committerAnton Khirnov <anton@khirnov.net>2023-06-05 16:15:04 +0200
commitd7781cfb95b1a4732456e82deca7e59b9ac18714 (patch)
treef56350154ccf4fb5e7b39b5e1713400cc17f74e3 /fftools/ffmpeg_mux.c
parentcf121592c5086ef205f627827ddc67beffff840c (diff)
downloadffmpeg-d7781cfb95b1a4732456e82deca7e59b9ac18714.tar.gz
fftools/ffmpeg: convert timestamps inside the muxer
Packets submitted to the muxer now have their timebase attached to them, so the muxer can do conversion to muxing timebase and avoid exposing it to callers.
Diffstat (limited to 'fftools/ffmpeg_mux.c')
-rw-r--r--fftools/ffmpeg_mux.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fftools/ffmpeg_mux.c b/fftools/ffmpeg_mux.c
index 121796a55a..dc2d189ff0 100644
--- a/fftools/ffmpeg_mux.c
+++ b/fftools/ffmpeg_mux.c
@@ -334,6 +334,12 @@ void of_output_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int eof)
if (!eof && pkt->dts != AV_NOPTS_VALUE)
ost->last_mux_dts = av_rescale_q(pkt->dts, pkt->time_base, AV_TIME_BASE_Q);
+ /* rescale timestamps to the muxing timebase */
+ if (!eof) {
+ av_packet_rescale_ts(pkt, pkt->time_base, ost->mux_timebase);
+ pkt->time_base = ost->mux_timebase;
+ }
+
/* apply the output bitstream filters */
if (ms->bsf_ctx) {
int bsf_eof = 0;