[FFmpeg-user] How to get raw frame data from AVFrame.data[] and AVFrame.linesize[] without specifying the pixel format?
vivienlwt
luthlee at gmail.com
Tue Oct 15 14:31:19 CEST 2013
I get the general idea that the frame.data[] is interpreted depending on
which pixel format is the video (RGB or YUV). But is there any general way
to get all the pixel data from the frame? I just want to compute the hash
of the frame data, without interpret it to display the image.
According to AVFrame.h:
uint8_t* AVFrame::data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int AVFrame::linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Does this mean that if I just extract from data[i] for linesize[i] bytes
then I get the full pixel information about the frame?
But according to some rendering code of RGB it seems that for one channel
(channel 0), it contains more data than linesize[0] suggested:
for (int y = 0; y < frameHeight; y++)
memcpy(img.scanLine(y), frameRGB->data[0] +
y*frameRGB->linesize[0], frameWidth*3);
the code suggests that frameRGB->data[0] actually contains frameHeight *
frameWidth * 3 bytes of data, where frameRGB->linesize[0] = frameWidth*3
So what should be the right way to get all the pixel information from
frame->data[]??
Thanks.
--
View this message in context: http://ffmpeg-users.933282.n4.nabble.com/How-to-get-raw-frame-data-from-AVFrame-data-and-AVFrame-linesize-without-specifying-the-pixel-format-tp4661827.html
Sent from the FFmpeg-users mailing list archive at Nabble.com.
More information about the ffmpeg-user
mailing list