[FFmpeg-devel] How is the total duration set in a fragmented MP4?

Alex Sukhanov alx.sukhanov at gmail.com
Tue Jan 27 20:01:18 CET 2015


On Tue, Jan 27, 2015 at 8:43 AM, Gerard <ggarcia at deic.uab.cat> wrote:

> Hello,
>
> I'm having trouble determining how is set the total duration of a
> fragmented MP4. If mvhd, tkhd and mdhd boxes have the duration set to
> 0xffffffff how does the demuxer know how long is the stream?
>
> Thanks,
>
> Gerard
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

Hi Gerald,

if duration is not set in tkhd, mvhd, demuxer can guess duration using
bitrate and file size. If I recall correctly, this is what MPEG2-TS demuxer
does in ffmpeg.
I don't think that there is other way to find out duration without
processing entire stream.


More information about the ffmpeg-devel mailing list