[FFmpeg-user] maintaining full swing when encoding in 10 bit (want to preserve all values from 0-1023)

Marwan Daar marwan.daar at gmail.com
Mon Nov 9 17:54:27 CET 2015

I'm doing some experimentation with different displays, and I need to be 
able to encode 10 bit images (scaled to a 16 bit png) into an mp4.

I'm using madVR to render the 10 bit content. When I view, for example, 
a 10 bit gradient that goes from pixel value 0 to pixel value 7 (with 
the highest pixel value being 1023), it renders perfectly when I render 
the image with madVR - I see 8 distinct bars.

However, when I use the 10 bit ffmpeg build found here: 
https://ffmpeg.zeranoe.com/blog/?p=435 (static, win32), there are 
artifacts in the encoding that seem to arise from a compression into 
64-940 when the RGB is transformed into YUV (similar to how 0-255 is 
transformed to 16-235 in 8 bit). This is a problem in my case, as I need 
all 1023 distinct values to work with.

Here is the code I'm using:

*ffmpeg -i %d.png test.mp4*

I originally thought this was a bug, and submitted a ticket: 

I was told the following,

*Use the input option **-color_range mpeg**to force 0->0. It appears 
that this fails for rgb48 but please also try the output option 
**-dst_range 1*

however this didn't work at all. -dst_range 1 just turned the whole 
frame into a uniform patch of color, rather than 8 distinct ones.

I could really use some guidance here.


More information about the ffmpeg-user mailing list