After the -vismv command I have seen a number of different values given. I can't find any explanation of what the number does and from changing it – can't see any difference!

Also, I am working with the -debug vis_mb_type command and can visualise the block types. Red being new, but what do the green and uncoloured represent? I also saw purple in some files when on an I-frame!

Example command on an MP4 file:

ffmpeg -debug vis_mb_type -vismv 1 -i inputfile.mp4 -vcodec mjpeg -q:v 0 output.avi

Edit: Doing a bit more digging on this.... I believe that the Green blocks are predicted but not moved and then the monochrome uncoloured blocks are unchanged from the I frame. Still can't figure out the red/purple though!

  • See the update of my answer. – slhck Dec 28 '13 at 10:24
  • Nice one! That will help... I will do a bit more research now on the various conditions. – Spreadys Dec 29 '13 at 15:29

vismv options

There are no numbers to be passed to -vismv as arguments. Only these are supported:

  • pf – forward predicted MVs of P-frames
  • bf – forward predicted MVs of B-frames
  • bb – backward predicted MVs of B-frames

I assume that if you use integers these are mapped to 1, 2 and 3, respectively.


I looked through the code and found the matching part in mpegvideo.c, starting from line 2029. It converts COLOR(theta, r) values into U and V values from a YUV color space using the following function:

#define COLOR(theta, r) \
    u = (int)(128 + r * cos(theta * 3.141592 / 180)); \
    v = (int)(128 + r * sin(theta * 3.141592 / 180));

Here are the color values per macroblock type, including their UV values and the matching RGB color at Y = 128.

  • COLOR(120, 48), UV(104, 169.57), RGB(184, 107, 86)
    Condition: IS_PCM (== MB_TYPE_INTRA_PCM)

  • COLOR(30, 48), UV(169.57, 152), RGB(160, 97, 200)
    Condition: IS_INTRA && IS_ACPRED) || IS_INTRA16x16

  • COLOR(90, 48), UV(128, 176), RGB(193, 94, 128)
    Condition: IS_INTRA4x4

  • COLOR(150, 48), UV(86.43, 152), RGB(160, 125, 55)
    Condition: IS_DIRECT

  • COLOR(170, 48), UV(80.73, 136.34), RGB(139, 138, 46)
    Condition: IS_GMC && IS_SKIP

  • COLOR(190, 48), UV(80.73, 119.66), RGB(116, 149, 46)
    Condition: IS_GMC

  • COLOR(240, 48), UV(104, 86.43), RGB(71, 165, 86)
    Condition: !USES_LIST(mb_type, 1))

  • COLOR(0, 48), UV(176, 128), RGB(128, 111, 211)
    Condition: !USES_LIST(mb_type, 0))

  • COLOR(300,48), UV(152, 86.43), RGB(71, 148, 169)
    Condition: USES_LIST(mb_type, 0) && USES_LIST(mb_type, 1)) – this is an assert so it may or may not abort program execution when the assertion fails.

I haven't tested this, but it seems about right to me. Information about the debugging switches and macroblock colors are also explained on the FFmpeg wiki.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.