wiki:

Debug

/

MacroblocksAndMotionVectors


Version 1 (modified by slhck, 5 years ago) (diff)

--

You can use ffmpeg or ffplay to analyze the macroblocks / coding tree units and motion vectors in a video file.

Analyzing Macroblock Types

You need to specify the -debug vis_mb_type option. For example:

ffplay -debug vis_mb_type input.mp4
ffmpeg -debug vis_mb_type -i input.mp4 output.mp4

The output would look something like this:

In the output video, each macroblock will be colored according to its type. Additionally, you can see the macroblock partitions as small lines. The following table lists the possible colors and the associated macroblock types. Note that these are parsed in order (from top to bottom).

Color Macroblock Type Condition
IS_PCM (MB_TYPE_INTRA_PCM)
(IS_INTRA && IS_ACPRED) || IS_INTRA16x16
IS_INTRA4x4
IS_DIRECT
IS_GMC && IS_SKIP
IS_GMC
!USES_LIST(1)
!USES_LIST(0)
USES_LIST(0) && USES_LIST(1)

Note that the decoding of macroblock types is MPEG-specific, so this option will not work for VP8 video, for example.

Analyzing Motion Vectors

The -vismv option can be used to show motion vectors as small arrows for each macroblock. It takes one parameter, which specifies the type of motion vector to be drawn:

  • -vismv pf – forward predicted motion vectors of P pictures
  • -vismv bf – forward predicted motion vectors of B pictures
  • -vismv bb – backward predicted motion vectors of B pictures

For example, you can use:

ffplay -vismv pf input.mp4
ffmpeg -vismv pf -i input.mp4 output.mp4

Example:

Attachments (12)

Download all attachments as: .zip