[FFmpeg-devel] [PATCH] Add BlockDuration and TrackTimecodeScale fields to matroska streams

David Conrad lessen42
Thu Jan 21 21:49:27 CET 2010

On Jan 21, 2010, at 11:41 AM, Rafa?l Carr? wrote:

> Hi,
> Track field TrackTimecodeScale is mandatory and represents:
> "The scale to apply on this track to work at normal speed in relation
> with other tracks (mostly used to adjust video speed when the audio
> length differs)."
> This patch sets it to the default of 1.0: play at the same speed than
> other tracks.

The spec is a little weird here, mandatory elements with default values aren't really mandatory, and if missing must be assumed to be the default value. But it doesn't hurt to write this, applied.

> Cluster field BlockDuration is optional but already set for subtitle
> streams.

This is wrong, BlockDuration is a subelement of BlockGroup not Cluster. We use SimpleBlock for audio/video streams due to lower overhead, the extra elements allowed in a BlockGroup aren't needed except for duration for subtitle tracks.

Also, given the number of existing mkv files that have a slightly to completely wrong DefaultDuration/BlockDuration set for audio/video tracks, the only reliable way to calculate the duration of an audio/video frame for mkv is next reordered pts - this pts.

More information about the ffmpeg-devel mailing list