[Libav-user] How to change color range on SwsContext
I need to perform lossless encoding of grayscale videos, which involves
a color space conversion step: GRAY8->YUV420. Lossless conversion means
the full color range must be preserved which is not the case by default
When creating an instance of SwsContext with parameters
AV_PIX_FMT_GRAY8 and AV_PIX_FMT_YUVJ420P, it works but issues a warning
that AV_PIX_FMT_YUVJ420P is deprecated.
I have tried to create a context with AV_PIX_FMT_YUV420P as the
destination color space and then override the color range but it fails
with operation not permitted (see example below). It can be done with
the command line tools (arguments: "-pix_fmt yuv420p -dst_range 1
-color_range 2") but how to reproduce it with the C API?