2

How to write bitmaps (RGB) as frames to H.264 with x264 in C\C++?

Some Examples with source would be great!

Stu Thompson
  • 37,698
  • 19
  • 105
  • 155
Rella
  • 62,177
  • 103
  • 350
  • 621
  • 1
    Almost identical: http://stackoverflow.com/questions/1736304/how-to-write-bitmaps-as-frames-to-ogg-theora-in-c-c Depending on your OS, it may be possible to very easily encode to either codec with very similar code, so perhaps open just one question for now and ask how to programattically encode video in multiple codecs, including both h264 and theora? – bdonlan Nov 15 '09 at 01:56

1 Answers1

2

Here is how:

  1. Look at the bitmap spec and work on loading a single bitmap
  2. Check out the x264.exe source code. That takes YUV uncompressed data as the source.
  3. Do some search on RGB->YUV conversion.
  4. Put it all together and modify x264.exe to load your bitmaps, convert them to YUV and pass them to the encoder
Stu Thompson
  • 37,698
  • 19
  • 105
  • 155
Warpin
  • 6,846
  • 12
  • 50
  • 74
  • 1
    This answer is usless and arrogant. You find a useful answer to the quesion with code sample here: https://stackoverflow.com/questions/34511312/how-to-encode-a-video-from-several-images-generated-in-a-c-program-without-wri#34688916 – Elmue Mar 03 '20 at 01:04