summaryrefslogtreecommitdiff
path: root/fftools/ffmpeg_enc.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_enc.c
parentcf121592c5086ef205f627827ddc67beffff840c (diff)
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_enc.c')
-rw-r--r--fftools/ffmpeg_enc.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index 1b0410ae74..f6431b29d1 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -512,8 +512,8 @@ void enc_subtitle(OutputFile *of, OutputStream *ost, AVSubtitle *sub)
}
av_shrink_packet(pkt, subtitle_out_size);
- pkt->time_base = ost->mux_timebase;
- pkt->pts = av_rescale_q(sub->pts, AV_TIME_BASE_Q, pkt->time_base);
+ pkt->time_base = AV_TIME_BASE_Q;
+ pkt->pts = sub->pts;
pkt->duration = av_rescale_q(sub->end_display_time, (AVRational){ 1, 1000 }, pkt->time_base);
if (enc->codec_id == AV_CODEC_ID_DVB_SUBTITLE) {
/* XXX: the pts correction is handled here. Maybe handling
@@ -735,19 +735,6 @@ static int encode_frame(OutputFile *of, OutputStream *ost, AVFrame *frame)
av_ts2str(pkt->duration), av_ts2timestr(pkt->duration, &enc->time_base));
}
- av_packet_rescale_ts(pkt, pkt->time_base, ost->mux_timebase);
- pkt->time_base = ost->mux_timebase;
-
- if (debug_ts) {
- av_log(ost, AV_LOG_INFO, "encoder -> type:%s "
- "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s "
- "duration:%s duration_time:%s\n",
- type_desc,
- av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &enc->time_base),
- av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &enc->time_base),
- av_ts2str(pkt->duration), av_ts2timestr(pkt->duration, &enc->time_base));
- }
-
if ((ret = trigger_fix_sub_duration_heartbeat(ost, pkt)) < 0) {
av_log(NULL, AV_LOG_ERROR,
"Subtitle heartbeat logic failed in %s! (%s)\n",