fftools/ffmpeg_enc: ensure subtitle packet pts respects output start_time

In do_subtitle_out(), local_sub.pts already subtracts of->start_time
when output-side -ss is requested. However, pkt->pts was assigned from
sub->pts rather than the adjusted pts variable, causing cue headers to
drift across container muxers whenever output seeking was used.

Assign pkt->pts from pts so that encoded subtitle packets stay aligned
with audio/video streams on the shifted timeline.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
This commit is contained in:
Jun Zhao authored and Jun Zhao committed 2026-09-28 01:08:27 +00:00
1 parent 55718343aa
commit 7f2b4adeac
1 file changed
+1 -1
+1 -1
View File
@@ -525,7 +525,7 @@ static int do_subtitle_out(OutputFile *of, OutputStream *ost, const AVSubtitle *
av_shrink_packet(pkt, subtitle_out_size);
pkt->time_base = AV_TIME_BASE_Q;
pkt->pts = sub->pts;
pkt->pts = 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