[FFmpeg-user] Use of "-color_range"

Mark Himsley mark at mdsh.com
Tue Jul 5 15:59:17 CEST 2011


On 05/07/11 07:43, Tim Nicholson wrote:
> On 04/07/11 22:01, Mark Himsley wrote:
>> On 04/07/2011 15:44, Tim Nicholson wrote:
>>> I am struggling to find any documentation on the use of this and
>>> searching the source was not very revealing, to my eye at least.
>>>
>>> Apart from the fact that it expects an <int> I am none the wiser.
>>>
>>> I since it is a DEV function I was hoping I could use it to force ffmpeg
>>> to handle source material of a non standard range.
>>
>> Hi Tim,
>>
>> The source says:
>>
>> 0 == unspecified
>> 1 == "MPEG" range
>> 2 == "JPEG" range
>>
>  > Therefore, I'd expect 1 to be "broadcast" 16-235, and 2 to be "full"
>> 0-255. I haven't tested this, just grepped through the source.
>>
>
>
> Bother! Missed that in my "find", which file was that in?

./libavcodec/avcodec.h line 502

enum AVColorRange{
     AVCOL_RANGE_UNSPECIFIED=0,
     AVCOL_RANGE_MPEG       =1, ///< the normal 219*2^(n-8) "MPEG" YUV 
ranges
     AVCOL_RANGE_JPEG       =2, ///< the normal     2^n-1   "JPEG" YUV 
ranges
     AVCOL_RANGE_NB           , ///< Not part of ABI
};


> I presume that you are presuming MPEG => yuv=> 16-235 and JPEG => RGB
> =>0-255, which is a bit woolly for such an important parameter.

No. JPEG does not mandate RGB.

>> My flip camera records 0-255 videos but flags the h.264 as 16-235 (or,
>> perhaps I could word that better as the camera omits to flag the h.264
>> as using the 0-255 range). It would be really nice if this option in
>> ffmpeg could allow correct that - an even better if ffmpeg could then
>> scale my 0-255 media to 16-235 for direct import into "broadcast"
>> infrastructure.
>>
>
> Quite. But presumably setting the flag one way for the incoming and the
> other way for the output would sort that....
>
> Mind you there is a lot of "broadcast" kit making things to the wrong
> spec. I know of one major application that outputs V210 YUV quicktimes
> in full range, and another that outputs RGB dpx's to reduced range......

D'oh!

I'll have a play with -color_range and let you know my thoughts.

-- 
Mark


More information about the ffmpeg-user mailing list