[Libav-user] Confusion about extracted motion vectors

Gül, Serhan serhan.guel at hhi.fraunhofer.de
Tue Oct 20 15:38:12 CEST 2015

Hi, I'm using the provided example extract_mvs.c to extract motion vectors from H.264 encoded videos. When I look at the output, I'm getting a little bit confused about what src_{x,y} and dst_{x,y} actually mean in AVMotionVector struct. Until now, I thought dst ist the reference block in the reference frame from which the motion is estimated, and src is the current block in the current frame. So, the x and y components of a motion vector would be calculated as: 

MV_x = dst_x - src_x and MV_y = dst_y - src_y

However, in the output, I see that src_{x,y} are shifted by the magnitude of the motion vectors instead of dst_{x,y}. E.g. a certain block in one of the frames has: src_x = 312, src_y = 119; dst_x =  312, dst_y = 120. So this led me to think that src_{x,y} might actually be showing the coordinates of the reference block. Can someone please clarify this point? Thanks.

More information about the Libav-user mailing list