LukasBommes / mv-extractor

Extract frames and motion vectors from H.264 and MPEG-4 encoded video.
MIT License
279 stars 56 forks source link

Regarding the source parameter of motion vector #3

Closed sandra-vs-nair closed 2 years ago

sandra-vs-nair commented 2 years ago

The source parameter in the numpy array "motion_vectors" is always -1 or 1. I need the exact reference frame number used by the macroblock (Not just whether it used past/future frame). Could you please help me with that?

LukasBommes commented 2 years ago

Hey sandra-vs-nair, there is nothing in my code which fixes the source value to -1 or 1. The value is propagated from the underlying AVMotionVector struct. However, FFMPEG never sets the source attribute to anything else than -1 or 1. At least, that is how I interpret the comment in https://github.com/FFmpeg/FFmpeg/blob/master/libavutil/motion_vector.h