Hello, I want to make a program to extract frame from a theora movie as images. I tried with the decoding example located at theora web site (dump_video.c. I use it to extract a frame as yuv image but when I try to convert it to ppm with yuvtoppm program i obtain a strange image ( see http://poux.be/tmp/file.ppm ). I think it's a problem with the byte order for yuv, but don't I don't know anything about this format. I'd like to make a simple program to encode chosen frame into ppm. Perhaps it's just ordering properly the bytes issued from the write_video() function in the example and using yuvtoppm to make the conversion. What is the yuv format issued from dump_video.c (444, 422, 420 ?) and when can I find a not-too-hard-to-understand explanation of this format? Thanks in advance for your answers. -- Manuel Dahmen
On Mon, 25 Feb 2008 13:31:37 +0100 Manuel Dahmen <manuel.dahmen@gmail.com> wrote: OK I think I ll use etheora which seems simpler to encode and decode theora videos than libtheora> Hello, > > I want to make a program to extract frame from a theora movie as > images. I tried with the decoding example located at theora web site > (dump_video.c. I use it to extract a frame as yuv image but when I try > to convert it to ppm with yuvtoppm program i obtain a strange image > ( see http://poux.be/tmp/file.ppm ). I think it's a problem with the > byte order for yuv, but don't I don't know anything about this > format. > > I'd like to make a simple program to encode chosen frame into ppm. > Perhaps it's just ordering properly the bytes issued from the > write_video() function in the example and using yuvtoppm to make the > conversion. > > What is the yuv format issued from dump_video.c (444, 422, 420 ?) and > when can I find a not-too-hard-to-understand explanation of this > format? > > Thanks in advance for your answers. >-- Manuel Dahmen
On Mon, Feb 25, 2008 at 7:31 AM, Manuel Dahmen <manuel.dahmen@gmail.com> wrote:> Hello, > > I want to make a program to extract frame from a theora movie as > images. I tried with the decoding example located at theora web site > (dump_video.c. I use it to extract a frame as yuv image but when I try > to convert it to ppm with yuvtoppm program i obtain a strange image > ( see http://poux.be/tmp/file.ppm ). I think it's a problem with the > byte order for yuv, but don't I don't know anything about this format.There are multiple problems here-- it looks like the conversion routine is expecting way more bytes than it's getting.> What is the yuv format issued from dump_video.c (444, 422, 420 ?)Whatever the Theora vide is in. Currently, this will almost always be 420, but it could be any of 444, 422 or 420.> and > when can I find a not-too-hard-to-understand explanation of this format?One plane of Y in raster order, left-to-right, top-to-bottom, then two planes (U and V) in the same order but 1/4 the total size of Y. Monty
Hi Manuel, have you had a look at wikipedia? http://en.wikipedia.org/wiki/YUV The explanation is ok, to understand the idea behind YUV (against RGB for example) As Monty said, the input/output format in theora is YUV420 That means, the first (width x hight) bytes are representing the luminance (Y) of the picture. The U and V are the color(-difference) information to blue and red respectivly. As the human eye is more focused on luminance than on color, the color differences are places in the subsequent (width/2 x hight/2) bytes. So that the one color difference is responsible for a square of 2x2 luminance pixels. All information (Y, U and V) are placed in 8 Bit. All this is visualized on the wikipedia picture: http://upload.wikimedia.org/wikipedia/en/2/25/Yuv420.png Hope that helps you. - Yorn PS: If you want to convert pictures, maybe imagemagick can help you. (I never tried it so I do not really know) Am Montag 25 Februar 2008 13:31:37 schrieb Manuel Dahmen:> Hello, > > I want to make a program to extract frame from a theora movie as > images. I tried with the decoding example located at theora web site > (dump_video.c. I use it to extract a frame as yuv image but when I try > to convert it to ppm with yuvtoppm program i obtain a strange image > ( see http://poux.be/tmp/file.ppm ). I think it's a problem with the > byte order for yuv, but don't I don't know anything about this format. > > I'd like to make a simple program to encode chosen frame into ppm. > Perhaps it's just ordering properly the bytes issued from the > write_video() function in the example and using yuvtoppm to make the > conversion. > > What is the yuv format issued from dump_video.c (444, 422, 420 ?) and > when can I find a not-too-hard-to-understand explanation of this format?> > Thanks in advance for your answers.