[FFmpeg-user] BGR24-YUV420-BGR24 conversion on raw video

Mark Himsley mark.himsley at gmail.com
Tue Sep 18 20:39:59 CEST 2012

On 18 Sep 2012 19:10, "Timo S" <timo.infradex at gmail.com> wrote:
> Hello.
> I am tring to find an explanation on this peculiarity:
> 1) Introduce a raw BGR24 avi video and transcode it to YUV420 using ffmpeg
> -i rawinput.avi -vcodec rawvideo -pix_fmt yuv420p output.yuv
> 2) Transcode it back to BGR24 avi using ffmpeg -s 848x480 -i output.yuv
> -vcodec rawvideo -pix_fmt bgr24 raw_decoded.avi
> 3) Compare PSNR, AbsDiff and UIQ results on the original rawinput.avi and
> raw_decoded.avi
> Results: Comparative PSNR, AbsDiff and UIQ measurements on Y-components
> indicate that the raw_decoded.avi has changed (ie PSNR-Y way less than 100
> dB). Change definitely should be expected on U and V components but I did
> not expect any change on Y component.
> Any ideas?

In BGR24 each component has values in the range 0-255

They will be mapped to YUV where Y is in the range 16-235. Therefore some
levels are lost as there is not a direct one-to-one mapping.

Those YUV levels will then be mapped back to 0-255 when you return to
BGR24. Again, there is no one-to-one mapping so more loss of levels (and
dithering) so worse PSNR.


More information about the ffmpeg-user mailing list