I am trying to extract motion vector data from an encoded mp4 file. In a previous post I found an answer http://www.princeton.edu/~jiasic/cos435/motion_vector.c . But I am not able to run the code without errors . What are the other files that have to be included in the file ? I am a newbie here . So any help would be appreciated .
Asked
Active
Viewed 7,796 times
4
-
What errors do you get when you try to compile it? – user1118321 Nov 15 '13 at 04:53
-
You can take a look at [MV-Tractus](https://github.com/jishnujayakumar/MV-Tractus). – Jishnu P Apr 28 '18 at 22:39
1 Answers
7
I had modified the source code of mplayer (ffmpeg) to extract motion vectors for any compressed video, I have uploaded the modified mplayer code which can be used for extracting motion vectors here http://www.cs.umd.edu/~bharat/modmplayer.zip
You need to do the following to extract motion vectors if you use the modified version of mplayer
./mplayer -nosound -fps 200 -vo null -lavdopts vismv=1 path_of_video_file 2> path_of_output_file.txt
Pre-compiled executable and some useful files are available in the outputs folder

Bharat
- 2,139
- 2
- 16
- 35
-
-
1Can you offer the changes in the form of a patch file? That way we could apply it to pretty much any version of mplayer. (mplayer is not ffmpeg, btw. It just uses ffmpeg.) – Evi1M4chine Feb 23 '16 at 14:14
-
2yes, its a change in the ffmpeg folder. If I remember correctly, I had added 5 tprintf statements each in ffmpeg/libavcodec/h264_cabac.c and ffmpeg/libavcodec/h264_cavlc.c which print the motion vectors. Hopefully, the structure of this file would be the same in newer versions of ffmpeg, so that these edits can be made. – Bharat Feb 23 '16 at 20:58