[FFmpeg-devel] [PATCH 0/2] libavformat/matroskadec: set fixed duration for subtitles

ffmpegagent ffmpegagent at gmail.com
Tue Jan 10 17:42:06 EET 2023


The matroska specification states the start time and duration of subtitle
entries are encoded in the block TimeStamp and BlockDuration. Furthermore,
for all subtitle formats except S_HDMV/PGS the BlockDuration must always be
defined and have an absolute value even if it is simply 0. ffmpeg assumes
that a duration of 0 means the duration is still unknown and tries to adjust
based on the next packet pts. This is wrong for all formats except
S_HDMV/PGS. Since changing the semantics of duration 0 is not an option
(touches too many parts of the code) this change introduces
AV_PKT_FLAG_FIXED_DURATION flag which decoders might use to flag the
duration of a given packet should not be changed.

Signed-off-by: Miguel Borges de Freitas enen92 at kodi.tv

----------------------------------------------------------------------------

This is my attempt at fixing https://trac.ffmpeg.org/ticket/10135 Initially
reported to Kodi in https://github.com/xbmc/xbmc/issues/21625

Miguel Borges de Freitas (2):
  libavformat/matroskadec: set fixed duration for subtitles
  fate: update test reference data to include AV_PKT_FLAG_FIXED_DURATION

 libavcodec/packet.h                        |  5 ++
 libavformat/demux.c                        |  3 +-
 libavformat/matroskadec.c                  |  4 +
 tests/ref/fate/matroska-dvbsub-remux       | 84 ++++++++++----------
 tests/ref/fate/matroska-zero-length-block  |  4 +-
 tests/ref/fate/matroska-zlib-decompression |  2 +-
 tests/ref/fate/shortest-sub                | 92 +++++++++++-----------
 7 files changed, 102 insertions(+), 92 deletions(-)


base-commit: 94aa70d757af6b0e0919250f9def2a819aa00358
Published-As: https://github.com/ffstaging/FFmpeg/releases/tag/pr-ffstaging-48%2Fenen92%2Fass_mkv_fixed_subs-v1
Fetch-It-Via: git fetch https://github.com/ffstaging/FFmpeg pr-ffstaging-48/enen92/ass_mkv_fixed_subs-v1
Pull-Request: https://github.com/ffstaging/FFmpeg/pull/48
-- 
ffmpeg-codebot


More information about the ffmpeg-devel mailing list