[MPlayer-advusers] [BUG] mencoder floating point exception with -of lavf
Rich Felker
dalias at aerifal.cx
Thu Nov 10 16:35:36 CET 2005
On Wed, Nov 09, 2005 at 06:13:10PM -0800, Corey Hickey wrote:
> Rich Felker wrote:
> >>Oddly enough, mplayer's avi muxer writes the header three times:
> >>- first without knowing anything about the video
> >>- second once it knows about the video stream
> >>- third when it's completely done and it can write the number of video frames
> >>
> >>My buffering layer can make the first header-writing unneccessary, but can't
> >>help the third. I can't think of any way to avoid it.
> >
> >
> > No need to avoid it; this is correct behavior. The final fix-up for
> > avi is part of the 'write trailer' operation, not a header rewrite.
> > The fact that it happens to be implemented as rewriting the header for
> > avi is coincidental; for sane formats this won't need to be done.
>
> Ok. For some reason I was under the impression at some point early in
> this thread that we would be able to write avi files without seeking.
No. AVI stupidly puts the index location and total size (both
unnecessary) in the header, so indexed seeking in any file written
without seeking at write-time is impossible.
> >>+ muxer->muxbuf_do_buffer = 1;
> >
> > No need for a variable for this. It's always required for correctness.
>
> Actually, I'm using that to keep track of when frames no longer need to
> be buffered. Once the wrapper function sees a video frame, it sends all
> the buffered frames to the muxer and sets muxbuf_do_buffer=0. Then the
> rest of the frames go straight to the muxer without being buffered.
I see.
> Is there a better approach?
Why not do it the other way around, i.e. make a flag to indicate that
the real muxer has already been initialized. Then the flag will be
automatically set to buffering (0) to begin with, instead of the
caller having to set it manually to avoid broken behavior.
Also, I think the a/v sync code (advancing stream timers) should
probably be moved out of the individual muxers and into the wrapper
layer, since it's the same for all muxers. If this is done then the
wrapper still needs to be called; it just doesn't do much. :)
Rich
More information about the MPlayer-advusers
mailing list