使用 ffmpeg/libavcodec 从 x265 (HEVC) 编码视频中提取运动矢量?
Extract motion vectors from x265 (HEVC) encoded video with ffmpeg/libavcodec?
我知道可以通过首先设置标志从 h264 编码中提取运动矢量
av_dict_set(&opts, "flags2", "+export_mvs", 0);
然后你可以通过这样做来查询运动矢量的边数据
sd = av_frame_get_side_data(frame, AV_FRAME_DATA_MOTION_VECTORS);
当我在网上查看是否可以对 HEVC 编码视频执行类似操作时,我找不到任何信息。我发现的只是 "AV_FRAME_DATA_MOTION_VECTORS"
的定义
Motion vectors exported by some codecs (on demand through the
export_mvs flag set in the libavcodec AVCodecContext flags2 option).
The data is the AVMotionVector struct defined in
libavutil/motion_vector.h.
但没有关于究竟是哪些编解码器导出此运动矢量信息的信息。我将如何找到它?
如果我没记错的话,h264 是唯一可以打印运动估计向量的编解码器。
我建议试用视频过滤器 mestimate。
此外,如果您想更好地了解 ffmpeg 中发生的事情,请查看函数 ff_print_debug_info2 libavcodec/mpegvideo.c
我知道可以通过首先设置标志从 h264 编码中提取运动矢量
av_dict_set(&opts, "flags2", "+export_mvs", 0);
然后你可以通过这样做来查询运动矢量的边数据
sd = av_frame_get_side_data(frame, AV_FRAME_DATA_MOTION_VECTORS);
当我在网上查看是否可以对 HEVC 编码视频执行类似操作时,我找不到任何信息。我发现的只是 "AV_FRAME_DATA_MOTION_VECTORS"
的定义Motion vectors exported by some codecs (on demand through the export_mvs flag set in the libavcodec AVCodecContext flags2 option).
The data is the AVMotionVector struct defined in libavutil/motion_vector.h.
但没有关于究竟是哪些编解码器导出此运动矢量信息的信息。我将如何找到它?
如果我没记错的话,h264 是唯一可以打印运动估计向量的编解码器。
我建议试用视频过滤器 mestimate。
此外,如果您想更好地了解 ffmpeg 中发生的事情,请查看函数 ff_print_debug_info2 libavcodec/mpegvideo.c