[MPlayer-users] wrong avi header in mencoder

asaphu46 asaphu46 at gmail.com
Fri Apr 26 20:25:26 CEST 2013


Hi!

I've run into a problem when copying a h264 video stream from mkv to avi
with -ovc copy.

As I read the RIFF specification, all chunks must occoupy even number of
bytes, so any outer LIST chunks must have even length fields. In this case
the strf chunk of the video stream had an odd length, and was correctly
padded, but the two LIST chunks around the strf chunk had wrong (odd)
lengths. This causes several programs to reject this file (avidemux,
avimuxgui, virtuadub).

I've found a solution by inserting two instructions into the
libmpdemux/muxer_avi.c file. If someone maintaining the code could check it
out, I would really appreciate it.

Regards, Sandor

PS: I just hope, that this is the correct mailing list and useable diff
format for this purpose.

*** /a/libmpdemux/muxer_avi.c
--- /b/libmpdemux/muxer_avi.c
*************** static void avifile_write_header(muxer_t
*** 303,308 ****
--- 303,309 ----
        switch(muxer->streams[i]->type){
        case MUXER_TYPE_VIDEO:
            hdrsize+=muxer->streams[i]->bih->biSize+8; // strf
+           hdrsize+=(hdrsize&1);
     if (aspect != 0) {
         hdrsize+=8+4*(9+8*1); // vprp
     }
*************** static void avifile_write_header(muxer_t
*** 335,340 ****
--- 336,342 ----
        switch(s->type){
        case MUXER_TYPE_VIDEO:
            hdrsize+=s->bih->biSize+8; // strf
+           hdrsize+=(hdrsize&1);
            s->h.fccHandler = s->bih->biCompression;
            s->h.rcFrame.right = s->bih->biWidth;
            s->h.rcFrame.bottom = s->bih->biHeight;



More information about the MPlayer-users mailing list