I tried to find what each cell of AVFrame.linesize[]
means, but I didn't found.
As I understood linesize[0]
is the width, linesize[1]
is the height.
- If I'm right what does other cells mean?
- why after
avcodec_decode_video2(codecCtxDecode, frameDecoded, &frameFinished, &packet);
only linesize[0] has the value and other cells are always 0?
UPDATED
I think AVFrame.data[i] and AVFrame.linesize[i] are the data of specific color in the row and the length of the row, am I correct?
Have a look at description of video frame formats:
You will see that formats are split into two big groups: packed and planar, depending on whether the components are kept separately or interleaved. Strides have slightly different meaning for those, and basically they are number of bytes you need to skip to advance by a row.
In the case of planar data, such as
YUV420
,linesize[i]
contains stride for thei
-th plane.For example, for frame
640x480
data[0]
contains pointer toY
component,data[1]
anddata[2]
contains pointers toU
andV
planes. In this case,linesize[0] == 640
,linesize[1] == linesize[2] == 320
(because theU
andV
planes is less thanY
plane half)In the case of pixel data (
RGB24
), there is only one plane (data[0]
) andlinesize[0] == width * channels
(640 * 3
forRGB24
)