Hi,
In order to add some graphics to a video, we are modifying the yuv image prior to encoding it.
Here’s what we’re using during encoding to try and avoid encoding something out of range. This is more aggressive than the clipping specs we found. But, we still are seeing the decoder "crash" on the decode and send back a bad/corrupt data error on occasion.
//***todo - temp - boundary checks and limiting !!!***this is a temp hack***!!!
// Very frequent failures decoding when using the 16/235 and 16/240 limits,
// needs further looking at.
//Best info at the time: the MPEG 2 and hence MPEG 4 clipping specs are:
// for Y values must be between 16 and 235
// for U,V values must be between 16 and 240
//
//From http://en.wikipedia.org/wiki/YCbCr
if(yuv_pixel.components.y0 < 36)
yuv_pixel.components.y0 = 36;
if(yuv_pixel.components.y0 > 215)
yuv_pixel.components.y0 = 215;
if(yuv_pixel.components.y1 < 36)
yuv_pixel.components.y1 = 36;
if(yuv_pixel.components.y1 > 215)
yuv_pixel.components.y1 = 215;
if(yuv_pixel.components.u < 36)
yuv_pixel.components.u = 36;
if(yuv_pixel.components.u > 220)
yuv_pixel.components.u = 220;
if(yuv_pixel.components.v < 36)
yuv_pixel.components.v = 36;
if(yuv_pixel.components.v > 220)
yuv_pixel.components.v = 220;
…can’t seen to find information on what you can or can’t do during encoding that would result in the decoder detecting the encoded data as bad/corrupt. Can you shed any light on this?
Regards,
Rod Burchell
831-458-3985