[FFmpeg-user] Most efficient format/container for seeking

Matthew Heaney matthewjheaney at google.com
Wed Sep 4 02:06:10 CEST 2013


What about Matroska?  The cues name every keyframe in the file.


On Mon, Sep 2, 2013 at 12:56 AM, Francois Visagie <
francois.visagie at gmail.com> wrote:

> > -----Original Message-----
> > From: ffmpeg-user-bounces at ffmpeg.org [mailto:ffmpeg-user-
> > bounces at ffmpeg.org] On Behalf Of Maxim E
> > Sent: 01 September 2013 16:07
> > To: FFmpeg user questions
> > Subject: Re: [FFmpeg-user] Most efficient format/container for seeking
> >
> > That answer was all I was looking for, gonna test it asap !
> >
> > Thanks :)
> >
> >
> > 2013/9/1 Robert Krüger <krueger at lesspain.de>
> >
> > > On Sun, Sep 1, 2013 at 3:38 PM, Maxim E <maxoumdu35 at gmail.com>
> > wrote:
> > > > Hi,
> > > >
> > > > This question will probably be best answered by developpers
> > > > themselves,
> > > I'm
> > > > looking for the most efficient container for seeking.
> > > >
> > > > My problem :
> > > > I'm downloading a video file that eventually gets very large, and
> > > > seeking can take a lot of time. I guess the whole file is processed
> > > > until the
> > > right
> > > > frame is found. Is there any container with which the seeking
> > > > process is more "optimized" ?
> > > > For instance, instead of processing the whole file, the total
> > > > duration of the video is calculated somehow, and the file size is
> > > > used to look at
> > > some
> > > > position (if the framerate is constant).
> > > >
> > > > An example to make myself clear :
> > > > I've got a 20 Gb file, in a FLV container. No problem to get the
> > > > total duration, ffmpeg -i file.flv returns it in just a few seconds
> (Duration:
> > > > 55:07:28.35).
> > > > No problem when I seek to the beginning of the file, for example
> > > > "ffmpeg -ss 00:02:00.00 -i file.flv -t 10 -c:a copy -c:v copy
> > > > out.flv" gets executed in a few seconds. However, "ffmpeg -ss
> > > > 10:02:00.00 -i file.flv
> > > -t
> > > > 10 -c:a copy -c:v copy out.flv" takes at least one minute, which
> > > > makes me think ffmpeg process the file from the beginning until it
> > > > finds the matching frame.
> > > > Let's consider the framerate is constant
> > > > 20 000 Mo x 10 Hours / 55 Hours should return the approximate
> > > > position at which the frame that is sought is, and starting from
> > > > there instead of starting from the beginning of the file would make
> > > > things much more efficient. Is there such a container that supports
> this
> > type of seeking ?
> > > > Or is it impossible ? I don't have much experience with
> > > > development/media files so maybe things are not as easy as I think,
> > > > but please let me know
> > > !
> > >
> > > mp4 and mov both support what you are looking for. They contain
> > > metadata where each frame and packet of sound samples is located in
> > > the file. You can additionally force that metadata at the beginning of
> > > the file by using the option -movflags faststart, if you have
> > > situations where you want to seek based on only a partially downloaded
> > > file, which is what many players support.
>
> If you are going to re/transcode, you can also look at shortening the GOP
> (group of pictures) size. However, this will only speed up seeking
> incrementally while you can expect the biggest improvement from -movflags
> faststart in the mp4 or mov container as suggested.
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>


More information about the ffmpeg-user mailing list