[FFmpeg-devel] [PATCH] matroskadec: Improve TTA duration calculation
James Almer
jamrial at gmail.com
Sat Aug 17 23:02:58 CEST 2013
On 17/08/13 4:23 PM, Paul B Mahol wrote:
> On 8/17/13, James Almer <jamrial at gmail.com> wrote:
>> On 17/08/13 3:30 PM, Paul B Mahol wrote:
>>> On 8/17/13, James Almer <jamrial at gmail.com> wrote:
>>>> On 17/08/13 6:48 AM, Paul B Mahol wrote:
>>>>> On 8/16/13, James Almer <jamrial at gmail.com> wrote:
>>>>>> On 16/08/13 5:21 PM, Paul B Mahol wrote:
>>>>>>> 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,
>>>>>>
>>>>>> It's using matroska->ctx->duration, which is calculated using the
>>>>>> duration
>>>>>> and the timescale of the stream as stored in the file (line 1546).
>>>>>
>>>>> But could it use track duration which is set in track time base units?
>>>>
>>>> So you mean doing "av_rescale((matroska->duration *
>>>> matroska->time_scale),
>>>> track->audio.out_samplerate, AV_TIME_BASE * 1000)"?
>>>> I guess that might be a tad more accurate depending on the file.
>>>
>>> I do not mean anything. But isn't time scale & duration different for
>>> each track?
>>
>> I guess so, but what difference does that make?
>
> audio is in track and each track can have different duration?
> Thus global one can be for anything else.
I tried two muxers (ffmpeg and mkvtoolnix) and neither of them stored a value for
track->time_scale.
Our muxer also didn't store a value for track->default_duration. The other muxer
did, but i can't make sense of the value after a quick look.
I'm not sure how to use those, or if they can be used. But until we find how we
should commit this patch which will at least improve support for audio only files.
More information about the ffmpeg-devel
mailing list