从在C AVFrame(FFMPEG)提取RGB值++ [英] Extract RGB values from a AVFrame (FFMPEG) in C++
本文介绍了从在C AVFrame(FFMPEG)提取RGB值++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
目前我正在试图通过使用FFMPEG在视频帧的读取。格式是PIX_FMT_RGB24;对于每一帧,将RGB值都在框架>数据组合在一起[0](其中帧是类型AVFrame的)。
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 frame is of the type AVFrame).
我如何提取单个的R,G和B值的每一帧?这是用于处理视频。我认为它会工作相同的方式从位图太提取RGB值。谢谢!
How do I extract the individual R, G and B values for each frame? This is for processing the video. I would think it would work the same way as extracting the RGB values from a bitmap too. Thanks!
推荐答案
我的猜测:
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];
我可能有R,G,B的倒退。而且有很多的空间加速。
I might have r, g, and b backwards. And there's a lot of room for speedup.
这篇关于从在C AVFrame(FFMPEG)提取RGB值++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文