[FFmpeg-devel] YUV image conversion

jelliott at rohan.sdsu.edu jelliott
Fri Mar 4 01:52:03 CET 2011


Hello.  I am a graduate student at San Diego State University and I am
utilizing ffmpeg for an adaptive, internet streaming video service.  My
camera produces images in the YUV420P format.  I want to give the user the
option to stream video in color or in black and white.  To do this, all I
should have to do is zero out the U and V components of each frame of the
video.  I have been able to do this from the rawdec.c code inside the
libavcodec library.

My problem is that when the U and V components are zero'd out, I obtain a
green image when I am expecting a black and white image.  On the other end
of the spectrum, when I set the U and V components to 255, I obtain a dark
magenta image.  A black and white image can only be obtained if the U and
V components are set to their midrange values of 217.  I have attached
copies of sample images to illustrate this.

I have found out, through emailing one of the authors of ffmpeg, that the
U and V components have an offset of 128 in order to represent negative
values.  I need to find out where in ffmpeg this offset is taking place. 
I only want to stream the Y data without having to transmit values for the
U and V data.  I want to be able to set those values to 0 initially and
only transmit the Y data.  If someone could point me in the right
direction as to how to do this or just point me to where the UV offset is
coded, I would greatly appreciate it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: YUV_norm.jpg
Type: image/pjpeg
Size: 76342 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110303/2863672a/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: YUV_0.jpg
Type: image/pjpeg
Size: 44399 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110303/2863672a/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: YUV_127.jpg
Type: image/pjpeg
Size: 70166 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110303/2863672a/attachment-0002.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: YUV_255.jpg
Type: image/pjpeg
Size: 45040 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110303/2863672a/attachment-0003.bin>



More information about the ffmpeg-devel mailing list