[MPlayer-advusers] [BUG] mencoder floating point exception with -of lavf

Rich Felker dalias at aerifal.cx
Mon Nov 7 04:53:42 CET 2005


On Sun, Nov 06, 2005 at 08:17:34PM +0100, Michael Niedermayer wrote:
> Hi
> 
> On Sun, Nov 06, 2005 at 11:04:16AM +0100, Nico Sabbi wrote:
> > Corey Hickey wrote:
> > 
> > >Michael Niedermayer wrote:
> > > 
> > >
> > >>i wouldnt be so sure about that, my guess would rather be that mplayer
> > >>extracts them from the video stream for mpeg4 and store 0x0 in the avi 
> > >>header, but maybe iam wrong, the only sure thing is that the dimensions
> > >>must be valid when av_write_header() is called
> > >>   
> > >>
> > >
> > >I'm not sure about anything, just doing my best to poke around in the
> > >dark. :)
> > >
> > >According to gdb both st->codec->width and st->codec->height are set to
> > >0 when av_write_header is called. Do you know where they should be set
> > >to the correct values? I'll keep looking, but I have a feeling you could
> > >fix this in a few seconds while it'll be a hit-and-miss process for me.
> > >
> > >-Corey
> > >
> > >
> > > 
> > >
> > 
> > the problem is that muxer->fix_parameters() (that calls av_write_header())
> > is called before video width and height are really known, parameters that
> > are known only after the first video frame is decoded and filtered.
> > 
> > So, I guess that mencoder should either
> > - decode and filter the first frame
> > - or pre-init (assuming it's possible) the video filters chain to probe 
> > the characteristics
> > of the final frame
> 
> whichever way its solved, not knowing the width/height when writing the header
> is a serious problem independant of lavf, just think of nut where width/height
> are variable length, so seeking back and filling it in wont work without some
> hacks, and if i understand correctly we cant just write the header at the 
> first video frame as an audio frame might have been written before?

yes it's a known problem. there are two possible fixes:

1. preinit to get video characteristics then restart to do the actual
   encoding. this is bad for piped input.

2. hack the muxer layer to buffer all packets in a fake muxer until
   all stream properties are known, then initialize the actual muxer,
   write the headers, and pass all the buffered packets thru to the
   actual muxer.

i like option 2. this should actually be used for all muxers, even the
current avi muxer, since at present it will generate corrupt output if
the output file is not seekable.

rich




More information about the MPlayer-advusers mailing list