how to convert rgb/rgb32 to i420

libvidcap has methods like “vidcap_rgb32_to_i420″ in its source.
swscale also does it with optimized MMX instructions :) (for sure if compiled with –enable-gpl not sure about otherwise)

The naive way works! sweet!

https://github.com/rdp/screen-capture-recorder-to-video-windows-free/commit/465decb20d89bb7e26f8a4e16c27a0e26490cbf8 (note: I changed it later see comments)

(non optimized, ping me with questions)

4 thoughts on “how to convert rgb/rgb32 to i420

  1. I noticed that the libvidcap rgb32toi420 method has been actually re-used in several other projects including my own. So thanks!

    Also I noticed that it shows some odd behavior, for instance a “diagonal green line on black” becomes a grey line with green splotches every so often. I think what it “should” look like would be a slightly blurry green line (mplayer’s i420 does).

    Anyway so this modified version fixes that, and seems to work all right:

    https://gist.github.com/2502032

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>