[MPlayer-users] extracting motion vectors from MPEG4 stream/file

Janez Pers janez.pers at fe.uni-lj.si
Fri Feb 15 12:06:33 CET 2008

Dear All,

first, apologies if I missed the audience with the question.

I have the following problem:

I want to extract motion vectors from MPEG4 stream.
Currently I do it in a kind of idiotic way - I modified the
mplayer/ffmpeg code in the libavcodec section, which
visualizes motion vectors.

I run mplayer with vismv option on, NULL display and benchmark
(fullspeed, regardless of FPS) option. For every vector drawn,
a set of values is written to file, and the file is read by
other application.

It works for academic research, but I would really need to
do it online, and, for remote streams (rtsp:// etc).

My questions are:

- is it possible to read motion vectors from the file/stream
in any other way without studying 100+ pages of specs,
and implementing, say 1/2 of the decoder (I studied
MPEG2 for some other project, I don't want to touch specs ever

- is there a software, mplayer option, or simple mplayer/ffmpeg
mod (I can code in C/C++, so this is not a problem) that would
achieve this functionality?

- (most important) - is it a way to do it in a processing
inexpensive way (my solution above requires essentially that
the whole stream is decoded, played and motion vectors are
drawn in addition to ordinary decoding) which is severe
overkill, since I only need small amount of data which is
essentially available in the stream itself, right? Which
parts of the mplayer/ffmpeg pipeline could be relatively
painlessly disabled so the actual IDCT and other cpu intensive
stuff does not happen?

- vaguely related: has anyone achieved playing MPEG4 stream from
Axis 207 camera with mplayer?

final explanation of what I am trying to do: get Axis 207 camera
to obtain motion vectors from its own MPEG4 stream. It has ARM
processor (~ 200 MIPS), the mpeg4 encoding is done in hardware,
if I understand correctly.


Janez Pers

More information about the MPlayer-users mailing list