[Ffmpeg-devel] MPEG4 encoding of Gray Scale images Round 2

Matt Schuckmann mschuck
Wed May 17 18:58:12 CEST 2006

Ok stay with me here this may be totally off base, but I thought I?d give it
a shot. 


I?m dealing with a video system that provides me with the bayer images (i.e.
for each frame there are 4 gray scale images that represents 4 color planes
Red, Blue, Green1 and Green2, each of which are ? the size of final image). 


I?ve been playing with using MPEG4 to compress these gray scale images with
the thought that encoding and decoding the individual color planes might be
faster and actually compress better than debayering (or demosacing) the
image and encoding the single RGB image since there is 1/3 the data in the
gray scale images than in the RGB representation or ? (I think) when
compared to YUV420. 


My initial tests show that yep it?s faster, encoding is about 25% faster and
decoding is about 40% faster and the quality even looks better although this
could be an artifact of the simple debayering algorithm I have. The only
problem is the compression is only about ? as good as compressing the RGB. I
think this is because the MPEG4 codec first converts the gray scale image to
YUV420 format (at least I think this is required) and then encodes that and
stores information for the Y, U and V components even though there is only
information in the Y component so we actually end up storing a bunch of
unneeded data in the U and V components. 


So my question is do I have this basically right, did I miss anything? I
think I?ve said this before I?m kind of new to this video stuff so I could
easily have something wrong.

If I don?t have it right can anybody tell me what I?m missing. 


Is there any way to throw away and not store, or simply not create the U and
V components for gray scale images to get better compression?

Or is there another codec, other than MPEG4, that might accomplish this task


Your thoughts, suggestions and opinions are much appreciated

Matt Schuckmann

More information about the ffmpeg-devel mailing list