Extract RGB values from a AVFrame (FFMPEG) in C++

后端 未结 1 594
再見小時候
再見小時候 2021-02-06 09:04

I am currently trying to read in video frames by using FFMPEG. The format is PIX_FMT_RGB24; For each frame, the RGB values are all combined together in frame->data[0] (Where fra

相关标签:
1条回答
  • 2021-02-06 09:33

    My guess:

    int p=x*3+y*frame->linesize[0];
    r=frame->data[0][p];
    g=frame->data[0][p+1];
    b=frame->data[0][p+2];
    

    I might have r, g, and b backwards. And there's a lot of room for speedup.

    0 讨论(0)
提交回复
热议问题