[x264-devel] Lossless with 10bit pixel depth

Simon Dumke simon.dumke at ipp.mpg.de
Wed Jul 17 13:11:46 CEST 2019


Hi again,

Thanks a lot, using qp=0 worked fine for 8 and 10 bit lossless!

Regarding 12/14 bit: There were some messages back in autumn of 2015, 
where "xuefeng" claimed to offer a patch including 12bit support. It 
seems to never have been merged because it mixed 12bit and AVCULTRA 
support. I wonder if one could estimate the amount of work neccessary to 
create 12 (and possibly even 14 or 16) bit support in the present 
version of x264?

The background of my asking is that we need to losslessly compress video 
(for scientific purposes like video analytics etc. in fusion science) 
data for longterm storage as well as streaming. Most of this data is 12 
bit grayscale (presently stored as uncompressed raw 16bit grayscale 
images), some of it has 14bits, and future might bring color images or 
even >14 bit grayscale. We are looking into x264 because it allows 
higher compression ratios and much, much faster compression of our 
material than x265 (without specialized HW), not to speak of AV1, FFV1, 
huffyuv or VP9. So - any other tips regarding alternatives would also be 
highly appreciated ;-)

Kind regars,
Simon

Am 10.07.2019 um 20:19 schrieb BugMaster:
> 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.
>
> _______________________________________________
> x264-devel mailing list
> x264-devel at videolan.org
> https://mailman.videolan.org/listinfo/x264-devel
>

-- 
----
Simon Dumke

Developer - CoDaC
Department Operation

Max Planck Institut for Plasmaphysics



More information about the x264-devel mailing list