[Ffmpeg-devel] YUV codec with x264

Dan Maas dmaas
Tue Oct 10 03:46:20 CEST 2006


Is one of your programs using 4:4:4 sampling and another using 4:2:2
sampling? Most YUV formats are 4:2:2 (i.e. the two chroma channels are
half the resolution of the luma channel horizontally)

I don't get the factor of 3/2. The size of an 8-bit 4:2:2 buffer is
width*height*2 bytes.

Regards,
Dan

* Christian Bienia (cbienia at cs.princeton.edu) wrote:
> Hi,
> 
> I'm trying to put together a few uncompressed YUV videos for benchmarking 
> purposes. I'd appreciate if somebody could help me with a problem I have: For 
> some reason the videos I get from ffmpeg are a factor 2 bigger than what x264 
> expects. I generated the YUV video from PNG files as described in the 
> documentation:
> 
> 
> ffmpeg -f image2 -i %03d.png rawvideo.yuv
> 
> 
> Some math revealed that ffmpeg uses 3 bytes per pixel. However, x264 expects 
> only half as many, as can be seen in the function get_frame_total_yuv in 
> muxers.c:
> 
> 
> int get_frame_total_yuv( hnd_t handle )
> {
>     yuv_input_t *h = handle;
>     int i_frame_total = 0;
> 
>     if( !fseek( h->fh, 0, SEEK_END ) )
>     {
>         uint64_t i_size = ftell( h->fh );
>         fseek( h->fh, 0, SEEK_SET );
>         i_frame_total = (int)(i_size / ( h->width * h->height * 3 / 2 ));
>     }
> 
>     return i_frame_total;
> }
> 
> 
> That results in twice as many frames being detected as actually exist in the 
> file. Could somebody point me to my mistake? I assume I didn't use the right 
> options with ffmpeg, so is it possible to tell it to use only 3/2 bytes per 
> pixel?
> 
> Thanks a lot for the help in advance.
> 
> - Chris
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
> 
> 




More information about the ffmpeg-devel mailing list