'How to view/save AVFrame have format AV_PIX_FMT_YUVJ420P to file
I have a AVFrame and I want to save it to file. If I only store frame->data[0] to file, the image will be Grey image, how to view full color? I use C language.
Do you have any suggestions on what I should read to understand and do these things by myself?
Solution 1:[1]
AV_PIX_FMT_YUVJ420P is a planar format.
data[0] is just a Y frame (grayscale), for the full image with the color you need to take into consideration:
data[1] and data[2] for the U and V part of the frame respectively.
And it seems this format (AV_PIX_FMT_YUVJ420P) is deprecated in favor of the more common AV_PIX_FMT_YUV420P format, use this if it's up to you.
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 | the kamilz |
