[Ffmpeg-devel] Seeking on a live stream

Erik Slagter erik
Fri Jun 17 18:35:11 CEST 2005

On Fri, 2005-06-17 at 17:08 +0100, Andy Parkins wrote:

> I'm using ffmpeg to record a live MPEG4 stream.  This is working well.  
> However, when I try to play back the stream - with say ffplay - I can't seek 
> properly.  The problem, I believe, is that the file is still open and so 
> hasn't had whatever headers/trailers that are needed written to it yet.
> My question then is what output format should I be using?  I'd like to be able 
> to view the stream "live" but still seek backwards in time.  A bit like a 
> TiVo or similar.
> I've tried a few different formats and have also tried calling 
> av_seek_frame_binary() but after a bit of investigation find that very few 
> formats actually support av_seek_frame_binary() because they don't implement 
> read_timestamp().  Oh dear.  I'm sure I can't be the only person in the world 
> wanting to seek on a live stream - so I'm fairly convinced I'm missing 
> something obvious; my apologies for my ignorance :-)

You're giving no information at all.

You're practically saying here that you're recording an mpeg4 elementary
stream, because you do not mention any container. Mpeg4 elementary
streams can be sought in while recording very well, no problem.

BUT you're probably not recording an elementary stream at all (just like
999/1000 of the others) but using an avi container (either on purpose or
not). Avi streams cannot be sought in without making an index. The index
is made when you stop the recording. You can convince mplayer though to
make an index on the fly with -idx. Prepare for some waiting time.

Better not use avi at all, but I guess (as usual) that's out of the
question because it needs to be erhm... compatible with windows, right?

More information about the ffmpeg-devel mailing list