[FFmpeg-devel] Changing the color of the pixel

Vitor Sessak vitor1001
Sun Apr 6 11:00:15 CEST 2008


Sisir Koppaka wrote:
>> About your original question about the AVFrame struct, there are two
>> ways data can be set. Either YUV or RGB. The most common case is planar
>> YUV (if you don't know what YUV is, ask wikipedia). If you want the
>> pixel line x, column y
>>
>> Y = data[0][x + y*linesize[0]]
>> U = data[1][x + y*linesize[1]]
>> V = data[2][x + y*linesize[2]]
>>
> Is RGB similar to this or just using data[0] will suffice?

Planar RGB should be similar, but it is not used in FFmpeg. Packed RGB 
(what we actually use) is different:

R = data[0][3*x + y*linesize[0]    ]
G = data[0][3*x + y*linesize[0] + 1]
B = data[0][3*x + y*linesize[0] + 2]

-Vitor




More information about the ffmpeg-devel mailing list