vector - Extending the ffmpeg extract_mvs.c example -
i'm using ffmpeg extract motion vectors using example doc extract_mvs.c
. issue code seems give few pieces of information: frame number, size of macroblock, source (future or past), source (x , y), , destination (x , y).
unfortunately, doesn't which frame source comes in past or future (it come both, several past, or several in future). doesn't macroblock type (which tells useful info). example, if source (x , y) equals destination (x , y) impossible tell if information same last frame or if entered new information.
see lines 60-63 in extract_mvs.c code in ffmpeg
final question mp4, motion vectors have quarter pixel resolution , resolution given here rounded closest integer. how supposed extract "true" motion vector information before rounding?
the source (future or past) based on relative frame reference given direction parameter add_mb(), i'm not sure make of logic:
mb->source = direction ? 1 : -1;
in libavutil/motion_vector.h there's comment, xxx: set exact relative ref frame reference instead of +/- 1 "direction", looks known todo not addressed creator of patch. value of direction comes ff_print_debug_info2() add_mb() called.
as quarter pixels, think in ff_print_debug_info2() don't know enough motion_val means:
const int shift = 1 + quarter_sample; ... int mx = (motion_val[direction][xy][0]>>shift) + sx; int = (motion_val[direction][xy][1]>>shift) + sy;
the initial commit shows major pieces of motion vector code. gets going in right direction (no pun intended).
Comments
Post a Comment