c++11 - FFMPEG中lineSize,width,height之间的关系
问题描述
我对 AVFrame 中的linesize
,height
,感到困惑。width
根据我的理解,linesize
是步幅,理想情况下应该是图像的宽度,对吗?
但是,和的值width
不linesize
匹配。
AVFrame pFrame;
cout<<"PFrame Linesize :"<<pFrame->data.linesize[0]<<endl;
cout<<"PFrame Width :"<<pFrame->width<<endl;
输出 :
PFrame Linesize : 64
PFrame width : 12
我的框架尺寸为 12*12。
根据对这篇文章的回答,linesize 应该与 width 相同。但我无法理解为什么它们在这里不同。
解决方案
我在这里引用文档:
* For video, size in bytes of each picture line.
* For audio, size in bytes of each plane.
*
* For audio, only linesize[0] may be set. For planar audio, each channel
* plane must be the same size.
*
* For video the linesizes should be multiples of the CPUs alignment
* preference, this is 16 or 32 for modern desktop CPUs.
* Some code requires such alignment other code can be slower without
* correct alignment, for yet other it makes no difference.
*
* @note The linesize may be larger than the size of usable data -- there
* may be extra padding present for performance reasons.
所以视频的 linesize 是
宽度 * 每个像素的字节数 + 行填充
它将您从一行图像/帧数据的开头带到下一行的开头。
推荐阅读
- ionic-framework - 离子不能在 LoginComponent 中使用 IonicStorageModule
- javascript - ajax后重新加载数据表
- python-3.x - 创建时未设置问题的受让人
- python - 如何使用 Python 更改日期格式?
- java - HtmlUnitDriver 调用本地 html 文件
- python - Google Drive API 仅在“我的云端硬盘”中搜索文件
- node.js - AWS 提供的上传文件端点的 URL 导致 Error: SignatureDoesNotMatch after access it
- python - 如何在python中同一类的不同函数的文本框中显示文本
- android - Android NFC 标签 ID 识别不同的 NFC 卡类型
- python - Python 循环无法遍历 html 表的所有值