【问题标题】:How to extract frame types along with motion vectors using extract_mvs.c from ffmpeg如何使用 ffmpeg 中的 extract_mvs.c 提取帧类型和运动矢量
【发布时间】:2018-07-23 14:21:27
【问题描述】:

我一直在研究获取帧类型(I、P、B)以及从 ffmpeg 的示例文件夹中的 extract_mvs.c 返回的运动矢量数据的方法。

extract_mvs.c文件编译后,返回信息如下:

framenum,source,blockw,blockh,srcx,srcy,dstx,dsty,flags
2,-1,16,16,   8,   8,   8,   8,0x0
2, 1,16,16,   8,   8,   8,   8,0x0
2, 1,16,16,  24,   8,  24,   8,0x0
2, 1,16,16,  40,   8,  40,   8,0x0
2, 1,16,16,  56,   8,  56,   8,0x0
2, 1,16,16,  72,   8,  72,   8,0x0
2, 1,16,16,  88,   8,  88,   8,0x0
...
297, 1,16,16, 248, 280, 248, 280,0x0
297, 1,16,16, 264, 280, 264, 280,0x0
297,-1,16,16, 278, 279, 280, 280,0x0
297, 1,16,16, 280, 280, 280, 280,0x0
297, 1,16,16, 296, 280, 296, 280,0x0
297, 1,16,16, 312, 280, 312, 280,0x0
297, 1,16,16, 328, 280, 328, 280,0x0
297, 1,16,16, 344, 280, 344, 280,0x0

连同这些信息,我想输出帧类型,以便我知道 framenum = 2 是例如“B”帧。

我尝试了不同的方法,其中之一是使用单独的命令:

ffprobe input.mp4 -show_frames | grep -E 'pict_type|coded_picture_number'

但是这个命令的问题是它返回的数据是这样的:

pict_type=I
coded_picture_number=0
pict_type=B
coded_picture_number=2
pict_type=P
coded_picture_number=1
pict_type=B
coded_picture_number=4
pict_type=P
coded_picture_number=3
....
pict_type=P
coded_picture_number=293
pict_type=B
coded_picture_number=297
pict_type=B
coded_picture_number=296

coded_picture_numberframenum 之间我没有太多可以联系的地方。前者从 0 开始计数,后者从 2 开始计数。我假设 framenum 从 2 开始,意味着这个变量的计数实际上是从 1 开始,并且在提取过程中它忽略了 1,因为它可能是 I 帧,因此没有运动矢量。

那么,我们如何仅使用 extract_mvs.c 来获取它提供的信息以及返回表中的帧类型。任何语法/命令方式或编辑 c 文件的提示都将不胜感激。提前致谢。

【问题讨论】:

    标签: ffmpeg computer-vision video-capture video-processing video-compression


    【解决方案1】:

    我找到了获取帧的方法,发布了on this question,我将flags 参数替换为frametypes

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-12
      • 2018-07-03
      • 1970-01-01
      • 1970-01-01
      • 2022-07-22
      • 2020-05-18
      相关资源
      最近更新 更多