[Matroska-devel] practical limit on number of frames in a lace?

Steve Lhomme slhomme at matroska.org
Sat May 12 08:53:46 CEST 2012


Indeed if TrueHD has 1ms packets you may add more than 8 frames at
once in a lace.

I'd say the optimum duration of a lace would be between 1/2 of the
video frame duration and the whole frame duration, so there's always
enough audio packets the video but not too much so the video frame can
come at the right time. Of course that would be in a buffer limited
player (and no B frames) when you can hardly buffer anything.

On Thu, May 10, 2012 at 10:13 AM, Moritz Bunkus <moritz at bunkus.org> wrote:
> Hey,
>
> 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
> situations.
>
> 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.
>
> Kind regards,
> mo
> _______________________________________________
> Matroska-devel mailing list
> Matroska-devel at lists.matroska.org
> http://lists.matroska.org/cgi-bin/mailman/listinfo/matroska-devel
> Read Matroska-Devel on GMane: http://dir.gmane.org/gmane.comp.multimedia.matroska.devel



-- 
Steve Lhomme
Matroska association Chairman


More information about the Matroska-devel mailing list