[Libav-user] Meaning of AVMotionVector values decoded from h.264

the8427.libav at infinite-source.de the8427.libav at infinite-source.de
Sun Jul 2 23:51:07 EEST 2017


I'm trying to use the AVMotionVector information exported by by the h264 decoder to avoid doing costly motion estimation myself.
So far it has been fairly useful, but a few cases are difficult to handle or confusing.

1) How is intra-prediction represented in the vectors?
I have not seen any vectors with the source 0, so it must either be part of the areas not covered by vectors or incorrectly labeled as coming from a past or future frame.

2) a) are areas not covered by motion vectors always de-novo content?
   b) are areas with 0-motion vectors always being inter-predicted?

3) The wiki[0] mentions skip frames, can this property be obtained through the API?
It would be useful to know when blocks are fully identical to a previous frame, but this does not appear to be reflected in the flags of the motion vectors.

4) How difficult would it be to implement the 'XXX: set exact relative ref frame reference instead of a +/- 1 "direction".' issue mentioned in the docs?
Being able to attribute vectors to individual frames and scaling the lengths of the motion vectors accordingly would help with estimating true motion.
It would also allow the inverted vectors to be transplanted onto I-frames and de-novo blocks in general, to know how they participate in the motion flow.

5) Absent exact relative ref frame information, what can I infer inverse motion vectors between adjacent frames?
Can B-frames only refer to other frames in the interval between the nearest P- or I-frames?
Similarly, can P-frames only refer to previous frames up-to and including the previous P-frame?
Can I rely on presentation order for these constraints?

- The 8472

[0] https://trac.ffmpeg.org/wiki/Debug/MacroblocksAndMotionVectors

More information about the Libav-user mailing list