'Is there a way to use ffmpeg for RGB to true YUV (not YCbCr) conversion?
As far as I can see in the documentation, all conversions involving YUV actually use YCbCr. There are slight differences though, and I would like to convert to the actual YUV format. Is there any way at all using ffmpeg? As an afterthought, is there any other way that is as fast as ffmpeg?
Solution 1:[1]
It turns out it is possible: for example when processing an AVFrame
using an AVCodecContext
,
- use
AV_PIX_FMT_YUVJ420P
instead ofAV_PIX_FMT_YUV_420P
(deprecated), - or use
AV_PIX_FMT_YUV_420P
and set thecolor_range
toAVCOL_RANGE_JPEG
.
All links are relative to release 3.2.
Edit:
I believe the actual mathematical conversions are in yuv2rgb.c
.
Solution 2:[2]
No, it is not possible. YUV is PAL ITU-R BT.470 standard as used for analog TV, it is not in use anymore. You can use https://github.com/fsphil/hacktv with software defined radio instead.
These do not use YCbCr or YUV, those are pixel formats, not color matrices.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | ??????? ???????????? |