1

I need to extract information about motion vectors and DC coefficients from an MPEG4 video. I've searched relevant sites and topics and I found that a good solution is to work with the code of ffmpeg codec. Especially the ff_print_debug_info function in libavcodec/mpegvideo.c calculates relevant information.

However, I'm new on the C/C++ field and if there is any example code that describes or explains how to extract MVs and DC coefficients that would be very helpful.

In the more recent version I use (FFmpeg 0.10.2 from http://ffmpeg.org/download.html) there is another file mpeg4videodec.c. Is there any chance to retrieve the needed information by this code?

Lampis
  • 328
  • 1
  • 3
  • 13
  • 1
    I found that ffmpeg can provide information about motion vectors and DC coefficients by defining the appropriate values as origins while executing. Section 4.11 on [link] (http://ffmpeg.org/ffmpeg.html#Advanced-Video-Options) describes how to print specific debug info, which in my case it would be -debug dct_coeff and -debug mv. Does anyone knows what is the appropriate command to use? All I want is to decode a mpeg4 video to its frames with ffmpeg, while in parallel, extract information about mv and dct on these frames. – Lampis Apr 20 '12 at 13:34

1 Answers1

1

Check out this piece of code: http://www.princeton.edu/~jiasic/cos435/motion_vector.c

It gives the basic idea of accessing motion vectors withing ffmpeg-decoded frame.

As for DC coefficients, I don't see any other way than to inject your own code into the decoder to dump coefficients as you decode.

Tosha
  • 998
  • 1
  • 10
  • 22