[FFmpeg-user] LLossless (10 Bit RGB 444) and (10 Bit YUV 422) Compression

Carl Eugen Hoyos cehoyos at ag.or.at
Sat Dec 27 17:56:27 CET 2014

Peter B. <pb <at> das-werkstatt.com> writes:

>   $ ffmpeg -i input.avi -c copy -s 10 -t 5 output.avi

I wanted to suggest -vframes 3 which would produce a 
significantly smaller output file.

Note that you can cut avi with dd (if you don't trust 
FFmpeg which makes sense if you want to test losslessness.)

But please note that the reason why r210 -> ffv1 -> r210 
was not lossless in the past was a bug (or missing feature) 
in the software scaler. This issue was fixed a year ago and 
it has also fixed the issue with r10k.
The difference with r10k is that it is more difficult to 
show that the conversion is lossless, instead of:

> r10k's format: rrrrrrrr rrgggggg ggggbbbb bbbbbbxx

FFmpeg writes:
r10k's format: rrrrrrrr rrgggggg ggggbbbb bbbbbbbb
(blue is 12 instead of 10 bits.)
The conversion is still lossless but the most significant 
blue bits will be repeated as an eleventh and 12th bit 
making the files not bit-identical (while the saved frames 
are bit-identical) assuming xx are 0 (if they aren't 0 you 
will never get identical output files).

Two patches are currently discussed to fix this issue in 
the encoder (which does not affect that the output is 
lossless but does affect the easiness of testing) but 
you can probably test by either doing:
r10k -> ffv1 -> r10k -> ffv1 ->r10k
and comparing the two ffv1 and the last two r10k files.
You could also reencode to r210 and compare.
And you can of course use -pix_fmt gbrp10 -f framecrc to 
get identical output (but this means you trust my fix for 
the gbrp10 conversion).

Carl Eugen

More information about the ffmpeg-user mailing list