[FFmpeg-devel] determining the reference frame for motion_val

Michael Niedermayer michaelni
Thu Aug 23 01:43:09 CEST 2007


Hi

On Wed, Aug 22, 2007 at 09:21:25AM -0500, Martin Luessi wrote:
> Hi,
> 
> For my work I need to extract motion vectors from h264 video. By
> looking at the function ff_print_debug_info in mpegvideo.c and
> previous posts on this list, I figured out how to do that. Right now
> my motion vector extraction function accesses the motion_val table of
> the returned AVFrame and creates a table with one motion vector for
> each 8x8 block. However, I still have the following questions:
> 
> 1)
> How can I determine which reference frame is used for a given motion
> vector? I use the USES_LIST macro to find out if there is a forward or
> backward motion vector assigned to a a given block. Let's say we have
> a forward motion vector, how can I find out which previous frame  is
> used as reference? If the current frame is a P-frame and the previous
> one was an I-frame, obviously the previous frame is used. But what
> about if the current frame is a B-frame and the previous frame is B as
> well. As you know h264 has an option to support using B frames as
> reference, so the reference frame could be the previous B-frame or a
> I/P frame further back in the past. I hope you see what I'm getting
> at.

AVFrame.ref_index

> 
> 2)
> Is there an easy way to find out if a block uses 4x4 partitions in
> h264, if yes how can I access the motion vectors?

the vectors should be in AVFrame.motion_val

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Good people do not need laws to tell them to act responsibly, while bad
people will find a way around the laws. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070823/830d7d6f/attachment.pgp>



More information about the ffmpeg-devel mailing list