View Single Post
Old 20th October 2015, 10:25   #1  |  Link
serhannn
Registered User
 
Join Date: Sep 2015
Posts: 11
Confused about extracted motion vectors from ffmpeg

Hi, I used the example file extract_mvs.c in ffmpeg documentation and extracted the motion vectors from a H.264 encoded video. I obtained a text file with the following format:

Code:
framenum, source, blockw, blockh, srcx, srcy, dstx, dsty, flags
I'm a little bit confused about what src and dst actually means. Until now, I thought dst ist the reference block from which the motion is estimated, and src is the current block in the current frame. So, the x and y compontents of a motion vector is calculated as:

Code:
MV_x = dstx-srcx
MV_y = dsty-srcy
However, in the text file, I see lines like this:

Code:
2,-1,16, 8, 167,  51, 168,  52, 1, 1,0x0
...
...
113,-1, 8, 8, 157, 156, 156, 156,-1, 0,0x0
So, for example in frame 2, the 16x8 source block seems to be located at (167,51), and in frame 113 8x8 source blocks is located at (157,156). This doesn't make sense to me. Shouldn't the center of the current block always be located at multiples of 8 or 16 along both x and y directions? I thought the "destination" blocks (in the reference frame) would be shifted by the magnitude of the respective motion vectors; but the situation seems to be the other way around here. Do I interpret the meaning of src and dst wrong? Or is this kind of motion prediction actually allowed?

I'm a beginner to H.264 standard so I'm sorry if the question is too naive... Thanks!
serhannn is offline   Reply With Quote