[FFmpeg-user] Use of "-color_range"

Thomas Worth dev at rarevision.com
Sun Jul 10 12:10:33 CEST 2011


On Tue, Jul 5, 2011 at 7:19 AM, Tim Nicholson <tim.nicholson at bbc.co.uk> wrote:
> On 05/07/11 14:59, Mark Himsley wrote:
>>
>> On 05/07/11 07:43, Tim Nicholson wrote:
>>>
>>> On 04/07/11 22:01, Mark Himsley wrote:
>
> [...]
>>>>
>>>> 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
>> };
>>
>
> Ahh, you see color_range transmogrifying into ColorRange threw me off the
> scent...
>
>>
>>> 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.
>>
>
> That's what I mean by woolley, its presumed in this case when it would be
> far better to use a more rigorous definition. :(

Tim, did you ever get this to work properly? I tried transcoding some
v210 footage to mjpeg, but since mjpeg requires "yuvj" pixel format
variants, my range is always wrong because the v210 I am working with
is broadcast range. The mjpeg encoder apparently takes the full range
as input, so it looks at 0-1023 instead of 64-940.

What would be great is if I could force ffmpeg / swscale to consider
only 64-940 as input instead of 0-1023. For most intents and purposes,
only 64-940 is a valid range with v210.


More information about the ffmpeg-user mailing list