From 60450bd93af0b331d7b98c88aa199366305f0721 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sun, 12 Sep 2021 22:43:52 +0200 Subject: Fix missing subtitles embedded in files decoded by FFmpeg (#2060). Since the FFmpeg 4.4 update it seems that AVSubtitle::pts is no longer set (it's AV_NOPTS_VALUE, i think). Instead we apparently need to get the PTS from the packet, which in turn requires the stream's timebase. --- src/lib/ffmpeg.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib/ffmpeg.cc') diff --git a/src/lib/ffmpeg.cc b/src/lib/ffmpeg.cc index d476b4c29..31aa18293 100644 --- a/src/lib/ffmpeg.cc +++ b/src/lib/ffmpeg.cc @@ -284,9 +284,9 @@ FFmpeg::avio_seek (int64_t const pos, int whence) FFmpegSubtitlePeriod -FFmpeg::subtitle_period (AVSubtitle const & sub) +FFmpeg::subtitle_period (AVPacket const* packet, AVStream const* stream, AVSubtitle const & sub) { - auto const packet_time = ContentTime::from_seconds (static_cast (sub.pts) / AV_TIME_BASE); + auto const packet_time = ContentTime::from_seconds (packet->pts * av_q2d(stream->time_base)); if (sub.end_display_time == static_cast (-1)) { /* End time is not known */ -- cgit v1.2.3