How to encode h264 video

Started by
5 comments, last by Stainless 8 years, 8 months ago

Hello,

I have been asked to take a series of images defined as simple bitmaps and encode them into a h264 file. I did manage to download and build the h264 libraries, but I'm having a tough time sorting through the documentation or examples to come up with a simple way of doing this through their API (I am required to use the h264 API directly).

Can somebody point me to some simple examples on how to do this?

Thanks.

Advertisement
This stackoverflow thread seems fairly straightforward:

1. Configure h264.
2. Alloc a picture.
3. Convert frame from RGB to YUV.
4. Send YUV frame to h264.
5. ...
6. Profit!

Thanks fastcall22! I'll take a look at that thread.

Much appreciated!

I don't have the code to hand, but I used Cuda.

Have a dig around in the online docs for it, but for me it was a single line of code to generate h264

Stainless,

Isn't CUDA specific to NVIDIA graphics? Or am I missing something here? I'm supposed to assume that the only library I have is the original h264 library. Having to rely on CUDA would restrict usage to those using NVIDA graphics.

Am I correct?

This stackoverflow thread seems fairly straightforward:

1. Configure h264.
2. Alloc a picture.
3. Convert frame from RGB to YUV.
4. Send YUV frame to h264.
5. ...
6. Profit!

I did exactly this using what is now libav for MPEG/H.264 encoding 5+ years ago. What encoder are you using, @amtri, x264?




Am I correct?

The list of supported graphics cards is here ... https://developer.nvidia.com/cuda-gpus

If you have a compatible card, use CUDA. Not only is it very easy to use, it's very fast. I had real time video compositing working a few years ago using CUDA.

Your original post implied it was a one off job. If so you don't have to worry about compatibility. You either have a CUDA card and can use it, or you don't and you can't.

This topic is closed to new replies.

Advertisement