Henry Mason
2003-Jun-09 19:50 UTC
[theora-dev] [PATCH] Fix for YUV4MPEG support in encoder_example
As was briefly discussed on IRC, ffmpeg and mplayer currently output two somewhat incompatible YUV4MPEG streams. This meant that encoder_example could take input from mplayer, but not ffmpeg or movtoy4m (a QuickTime->Y4M tool). This is a patch that fixes this issue and should allow encoder_example to take input from either format: diff -urd xiph-cvs/theora/examples/encoder_example.c xiph-cvs-new/ theora/examples/encoder_example.c --- xiph-cvs/theora/examples/encoder_example.c Mon Jun 9 07:18:01 2003 +++ xiph-cvs-new/theora/examples/encoder_example.c Mon Jun 9 21:41:03 2003 @@ -375,11 +375,33 @@ for(i=state;i<2;i++){ char frame[6]; int ret=fread(frame,1,6,video); - + + /* + yuv4mpeg specs say this: + + FRAMEHEADER consists of + string "FRAME " (note the space after the 'E') + unlimited number of ' ' (single space) separated TAGGEDFIELDs + single 'n' line terminator + + ( http://roguelife.org/~fujita/MJPEG/yuv4mpeg.html ) + MPlayer 0.9.0 writes "FRAME" with no space at the end, however. + To deal with this.... + */ + if(ret<6)break; if(memcmp(frame,"FRAME\n",6)){ - fprintf(stderr,"Loss of framing in YUV input data\n"); - exit(1); + if(memcmp(frame,"FRAME ",6)){ + fprintf(stderr,"Loss of framing in YUV input data\n"); + exit(1); + } else { + ret=fread(frame,1,1,video); + if(ret<1)break; + if(memcmp(frame,"\n",1)){ + fprintf(stderr,"Loss of framing in YUV input data\n"); + exit(1); + } + } } /* read the Y plane into our frame buffer with centering */ <p> -- ____________________________________________ http://www.operamail.com Get OperaMail Premium today - USD 29.99/year <p>Powered by Outblaze --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'theora-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Henry Mason
2003-Jun-09 19:52 UTC
[theora-dev] [PATCH] Fix for YUV4MPEG support in encoder_example
As was briefly discussed on IRC, ffmpeg and mplayer currently output two somewhat incompatible YUV4MPEG streams. This meant that encoder_example could take input from mplayer, but not ffmpeg or movtoy4m (a QuickTime->Y4M tool). This is a patch that fixes this issue and should allow encoder_example to take input from either format: diff -urd xiph-cvs/theora/examples/encoder_example.c xiph-cvs-new/ theora/examples/encoder_example.c --- xiph-cvs/theora/examples/encoder_example.c Mon Jun 9 07:18:01 2003 +++ xiph-cvs-new/theora/examples/encoder_example.c Mon Jun 9 21:41:03 2003 @@ -375,11 +375,33 @@ for(i=state;i<2;i++){ char frame[6]; int ret=fread(frame,1,6,video); - + + /* + yuv4mpeg specs say this: + + FRAMEHEADER consists of + string "FRAME " (note the space after the 'E') + unlimited number of ' ' (single space) separated TAGGEDFIELDs + single 'n' line terminator + + ( http://roguelife.org/~fujita/MJPEG/yuv4mpeg.html ) + MPlayer 0.9.0 writes "FRAME" with no space at the end, however. + To deal with this.... + */ + if(ret<6)break; if(memcmp(frame,"FRAME\n",6)){ - fprintf(stderr,"Loss of framing in YUV input data\n"); - exit(1); + if(memcmp(frame,"FRAME ",6)){ + fprintf(stderr,"Loss of framing in YUV input data\n"); + exit(1); + } else { + ret=fread(frame,1,1,video); + if(ret<1)break; + if(memcmp(frame,"\n",1)){ + fprintf(stderr,"Loss of framing in YUV input data\n"); + exit(1); + } + } } /* read the Y plane into our frame buffer with centering */ <p> -- ____________________________________________ http://www.operamail.com Get OperaMail Premium today - USD 29.99/year <p>Powered by Outblaze --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'theora-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
rillian
2003-Jun-13 18:22 UTC
[theora-dev] [PATCH] Fix for YUV4MPEG support in encoder_example
On Monday 2003 June 9, Henry Mason wrote:> As was briefly discussed on IRC, ffmpeg and mplayer currently output > two somewhat incompatible YUV4MPEG streams. This meant that > encoder_example could take input from mplayer, but not ffmpeg or > movtoy4m (a QuickTime->Y4M tool).I've committed a more liberal version which should accept output from either program. The trailing space requirement seems to have been a documentation mistake. The mjpegtools implementation neither requires nor produces it, nor is it part of the format documentation in the source itself. The manpage you linked to was corrected in cvs, but there hasn't been a release since then. Cheers, -r --- >8 ---- List archives: http://www.xiph.org/archives/ Ogg project homepage: http://www.xiph.org/ogg/ To unsubscribe from this list, send a message to 'theora-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.