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)
http://msdn.microsoft.com/en-us/library/aa917087.aspx
http://read.pudn.com/downloads99/sourcecode/zip/406465/app/img.c__.htm is a clue RGB565toYCbCr
also http://en.wikipedia.org/wiki/Talk%3AYUV
opencv may be a clue (or swscale)
http://www.tech-archive.net/Archive/Development/microsoft.public.win32.programmer.directx.video/2007-09/msg00087.html may be a clue
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