-
-
Notifications
You must be signed in to change notification settings - Fork 60
Description
I've really been trying to better understand how ffmpeg is really treating our data.
I found that there is a difference between "tv" color range, and "pc" color range. Where the "tv" color range is compressed, and the "pc" color range is "full".
The code in FFMPEG:
static int convert_range(enum AVColorRange color_range)
{
switch (color_range) {
case AVCOL_RANGE_UNSPECIFIED:
case AVCOL_RANGE_MPEG:
return ZIMG_RANGE_LIMITED;
case AVCOL_RANGE_JPEG:
return ZIMG_RANGE_FULL;
}
return ZIMG_RANGE_LIMITED;
}
Thus if you leave the color range unspecified, it will be compressed, very likely not what you want in modern image processing.
I've been adding code to specify the color range as 2 in hopes to avoid color compression. I'm really not sure if it does the right thing since it seems that the color range of yuv isn't specified in the log of the implicit conversion that ffmpeg adds if your input and output colors do not match.
Some related discussion here:
https://www.facebook.com/permalink.php?story_fbid=2413101932257643&id=100006735798590