[x264-devel] Lossless Compression

Alain Champenois achampen at matrox.com
Fri Aug 23 18:34:33 CEST 2013


The x264 options (-qp0 and -no-8x8dct) should be the only one to use to enable lossless. 
I'm not too familiar with the full ffmpeg flow, but I suggest you separate each conversion
to understand where it become lossy.

> ffmpeg -y -i Grayscale256.mov -c:v libx264 -pix_fmt yuv444p -preset:v slow -profile:v high444 -qp 0 -x264opts no-8x8dct Grayscale256_qp0_no8_444.m4v
> ffmpeg -y -i Grayscale256_qp0_no8_444.m4v -f image2 Grayscale256_qp0_no8_444_F%2d.png

First convert, the .mov to .yuv (uncompress format)

   ffmpeg -y -i Grayscale256.mov -pix_fmt yuv444p input_uncompress_yuv444.yuv

Then encode the YUV using x264 (SIZE is the resolution of your video in the format WxH)

   ffmpeg -pix_fmt yuv444p -s SIZE -y -i uncompress_yuv444.yuv -preset:v slow -profile:v high444 -qp 0 -x264opts no-8x8dct Grayscale256_qp0_no8_444.m4v

You can now make sure the output is lossless by generating the YUV and comparing it with the input

   ffmpeg -i Grayscale256_qp0_no8_444.m4v -vcodec copy -pix_fmt yuv444p output_uncompress_yuv444.yuv


The input_uncompress_yuv444.yuv and output_uncompress_yuv444.yuv file should be identical (you can do a 
cmp to make sure). If they are, then the mov->yuv or m4v->png convertion are the issue.

   Alain


More information about the x264-devel mailing list