[FFmpeg-devel] [PATCH] matroskadec: Improve TTA duration calculation

Paul B Mahol onemda at gmail.com
Fri Aug 16 22:21:15 CEST 2013

On 8/16/13, James Almer <jamrial at gmail.com> wrote:
> On 16/08/13 7:24 AM, Paul B Mahol wrote:
>> On 8/15/13, James Almer <jamrial at gmail.com> wrote:
>>> -            avio_wl32(&b, matroska->ctx->duration *
>>> track->audio.out_samplerate);
>>> +            avio_wl32(&b, av_rescale(matroska->ctx->duration,
>>> track->audio.out_samplerate, AV_TIME_BASE));
>> Isn't time base variable thing that can be changed by muxer?
>> Perhaps this could be used when muxing tta files to make sure
>> last packet can always decode.
> Our muxer already uses 1000000 (aka AV_TIME_BASE) as timescale for every
> file.

But this patch does not use time base as used in file, but hardcode it,

> Other muxers use values like round(1000000000 / sampleRate), which seems to
> be
> recommended for audio-only matroska:
> http://matroska.org/technical/specs/notes.html

If it does not provide sample accurate track duration we should not use it.

More information about the ffmpeg-devel mailing list