如何在 ffmpeg 的 extract_mvs.c 上用 'frame types' 替换 'flags'
How to replace 'flags' with 'frame types' on ffmpeg's extract_mvs.c
我正在从 ffmpeg 中提取运动矢量以用于计算机视觉项目。我一直在寻找一种简单的方法来以有意义的方式提取这些信息。
在阅读不同的帖子和其他网站时,我在 FFmpeg 的示例文件夹中遇到了 extract_mvs.c。我注意到在该文件生成的数据中(编译后)有一个我想修改的标志列,以使其打印帧类型而不是 0x0s,如下所示。
我从 the author of the code himself 那里得到的修改标志的想法。
编译后的extract_mvs.c文件,returns信息如下:
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,source,blockw,blockh,srcx,srcy,dstx,dsty,frametypes
2,-1,16,16, 8, 8, 8, 8,B
2, 1,16,16, 8, 8, 8, 8,B
2, 1,16,16, 24, 8, 24, 8,B
2, 1,16,16, 40, 8, 40, 8,B
2, 1,16,16, 56, 8, 56, 8,B
2, 1,16,16, 72, 8, 72, 8,B
2, 1,16,16, 88, 8, 88, 8,B
...
297, 1,16,16, 248, 280, 248, 280,P
297, 1,16,16, 264, 280, 264, 280,P
297,-1,16,16, 278, 279, 280, 280,P
297, 1,16,16, 280, 280, 280, 280,P
297, 1,16,16, 296, 280, 296, 280,P
297, 1,16,16, 312, 280, 312, 280,P
297, 1,16,16, 328, 280, 328, 280,P
297, 1,16,16, 344, 280, 344, 280,P
文件is shown here中需要修改的部分,其中mv->flags需要替换为帧类型变量。我想用指针引用 AVFrame 结构并调用 pict-type。但不确定积木会怎样。有帮助吗?
我设法找出如何用帧类型替换标志。我只是将 this line print function 更改为:
printf("%d,%2d,%2d,%2d,%4d,%4d,%4d,%4d,%c\n",
video_frame_count, mv->source,
mv->w, mv->h, mv->src_x, mv->src_y,
mv->dst_x, mv->dst_y, av_get_picture_type_char(frame->pict_type));
然后您可以 change this line for the header flags 阅读 frametypes:
printf("framenum,source,blockw,blockh,srcx,srcy,dstx,dsty,frametypes\n")
我正在从 ffmpeg 中提取运动矢量以用于计算机视觉项目。我一直在寻找一种简单的方法来以有意义的方式提取这些信息。
在阅读不同的帖子和其他网站时,我在 FFmpeg 的示例文件夹中遇到了 extract_mvs.c。我注意到在该文件生成的数据中(编译后)有一个我想修改的标志列,以使其打印帧类型而不是 0x0s,如下所示。
我从 the author of the code himself 那里得到的修改标志的想法。
编译后的extract_mvs.c文件,returns信息如下:
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,source,blockw,blockh,srcx,srcy,dstx,dsty,frametypes
2,-1,16,16, 8, 8, 8, 8,B
2, 1,16,16, 8, 8, 8, 8,B
2, 1,16,16, 24, 8, 24, 8,B
2, 1,16,16, 40, 8, 40, 8,B
2, 1,16,16, 56, 8, 56, 8,B
2, 1,16,16, 72, 8, 72, 8,B
2, 1,16,16, 88, 8, 88, 8,B
...
297, 1,16,16, 248, 280, 248, 280,P
297, 1,16,16, 264, 280, 264, 280,P
297,-1,16,16, 278, 279, 280, 280,P
297, 1,16,16, 280, 280, 280, 280,P
297, 1,16,16, 296, 280, 296, 280,P
297, 1,16,16, 312, 280, 312, 280,P
297, 1,16,16, 328, 280, 328, 280,P
297, 1,16,16, 344, 280, 344, 280,P
文件is shown here中需要修改的部分,其中mv->flags需要替换为帧类型变量。我想用指针引用 AVFrame 结构并调用 pict-type。但不确定积木会怎样。有帮助吗?
我设法找出如何用帧类型替换标志。我只是将 this line print function 更改为:
printf("%d,%2d,%2d,%2d,%4d,%4d,%4d,%4d,%c\n",
video_frame_count, mv->source,
mv->w, mv->h, mv->src_x, mv->src_y,
mv->dst_x, mv->dst_y, av_get_picture_type_char(frame->pict_type));
然后您可以 change this line for the header flags 阅读 frametypes:
printf("framenum,source,blockw,blockh,srcx,srcy,dstx,dsty,frametypes\n")