[x264-devel] Lossless with 10bit pixel depth

BugMaster BugMaster at narod.ru
Wed Jul 10 20:19:27 CEST 2019


On Wed, 10 Jul 2019 10:13:44 +0200, Simon Dumke wrote:
> Hi all,

Hi.

> I was today experimenting with lossless encoding in x264 (using     ffmpeg).
>   
>   
> My experiment was coming in with a raw yuv420 stream, encoding     
> that with h264 high444 witch crf=0. Than decoding it again to raw   
> yuv420 and making a binary diff to the original.
>   
> When using 8bit yuv, this works as expected:
>   
>   
> ffmpeg -f rawvideo -video_size 1024x1280 -pixel_format yuv420      
> -i yuv420-8.yuv -c:v libx264 -pix_fmt yuv420 -profile:v high444     
> -crf 0 -preset:v slow h264-8-420.m4v
>          ffmpeg -i h264-8-420.m4v -c:v rawvideo -f rawvideo
> -pix_fmt         yuv420p10le decompressed-8-420.yuv
>          diff -s yuv420-8.yuv decompressed-8-420.yuv
>   
>   
> The diff, as expected, resulted in identical files.
>   
> Doing the same with a yuv420p10le however, does not:
>   
>   
> ffmpeg -f rawvideo -video_size 1024x1280 -pixel_format        
> yuv420p10le -i yuv420-10.yuv -c:v libx264 -pix_fmt yuv420p10        
> -profile:v high444 -crf 0 -preset:v slow h264-10-420.m4v
>          ffmpeg -i h264-10-420.m4v -c:v rawvideo -f rawvideo
> -pix_fmt         yuv420p10le decompressed-10-420.yuv
>          diff -s yuv420-10.yuv decompressed-10-420.yuv
>   
>   
> Here, while the result looks ok optically, the diff (or a cmp)      show a lot of differences.
>   
> My question: Do i have to do more to have lossless 10bit      
> encoding? Is it even possible? Or is there another error in my       thinking?

For lossless you should set qp=0 (not crf=0). crf=0 works in 8-bit
mode only because crf and qp ranges are aligned (both start from 0).
But in 10-bit mode crf and qp ranges are not aligned (crf starts
from -12, but qp still starts from 0).

> Thanks & regards,
>   
> Simon
>   
> P.S.: BTW - will support for 12 and 14 bit come at any time in      the future?

Probably not. At least there is no plan for this so far.



More information about the x264-devel mailing list