[Matroska-devel] practical limit on number of frames in a lace?
moritz at bunkus.org
Thu May 10 10:13:59 CEST 2012
I honestly don't know where the practical limits are. libmatroska
(which is used by mkvmerge) limits the number to 8 which is rather on
the low side.
However, one thing to consider is that most players use the audio
track as the source for A/V synchronisation. Now laces usually have
long packet durations, and they get longer the more frames there are
in a lace (obviously). If a whole packet is ~ 1s long then A/V sync
can become quite bad -- if the player doesn't know how to handle such
This can be remedied on the player's side by taking the default
duration into account: frame_timecode = packet_timecode +
frame_number_in_lace * default_duration. However, that only works for
audio formats with a fixed number of samples per packet (e.g. MP3,
AAC, AC3) but not with ones with varying number of samples per packet
(Vorbis) as those don't have a default duration (or the calculation
would be wrong).
So basically I'd say... don't try to make packet durations go over
200ms or something like that, no matter the number of frames in a
lace. Unfortunately libmatroska has this value hardcoded even though
I'd like to go over 8 for certain audio formats with very small packet
sizes (TrueHD usually only has ~1ms of content in a packet). Hmm,
maybe I should look into patching this myself one of these days.
More information about the Matroska-devel