Simple API to encode movies

Started by
5 comments, last by floatingwoods 12 years, 2 months ago
Hello,

I am looking for a cross platform (Windows, Mac and Linux) library tat allows me to create movies from my openGL buffer content. It doesn't need to be anything fancy, best would be if I simply had following routines:

- char recorderInitialize(int resolutionX,int resolutionY,cont char* fileAndPath,int framerate);
- char recorderAddFrame(const unsigned char* buffer);
- char recorderEnd();

Of course I could wrap an api into above's routines, but I am at a loss about what API to use.
Any help or hint is greatly appreciated!
Advertisement
if you just want to capture something, maybe an existing capturing solution would be enough? e.g. FRAPS or http://camstudio.org/ (I don't know if there is something for linux).

otherwise maybe ffmpeg or x264, those are open source, cross platform, but I don't know how simple the interface is

otherwise maybe ffmpeg or x264, those are open source, cross platform, but I don't know how simple the interface is

x264 is GPL, so unless he's going to GPL his code or fork over the money for a commercial license it probably won't work.

I'm a maintainer for FFmpeg, and I'll be honest. If you can use it, do. It's awesome. But there's a pretty steep learning curve. FFmpeg is LGPL, so as long as you use dynamic libraries and don't link to any GPL libraries (like libx264), you're fine in terms of licensing.

One option is using Google's VP8 encoder, libvpx. It's completely free and doesn't have any kind of restrictive license (it's a BSD style license). You can use libvpx through FFmpeg, and personally I'm a fan of this idea. The VP8 codec is very competitive to H.264, and it gives good quality and compression ratio.

One thing you'll need to be aware of is the cost of encoding a video. It's a very CPU intensive process. This is one reason why I advocate using FFmpeg in this case: it gives you access to lots of different codecs, and you can easily play around with which ones work for you (in terms of CPU and memory requirements) and which ones don't, without having to change lots of code.

If you go with FFmpeg, you'll pretty much have to create a wrapper that'll do those functions for you. You'll have to setup the encoder, push frames to the encoder and encode them, and then clean up the encoder. It's pretty much a write once, use many times kind of thing. There are samples you can google that'll show you how to setup and initialize FFmpeg, encode a frame, and then clean up FFmpeg. Just write the code in some wrapper functions and then you'll have your easy API that you're asking for. I can help if necessary and answer questions should you have them (as best as I can), but just remember there is a steep learning curve to FFmpeg and you probably won't finish it in a day if you aren't already familiar with video encoding.
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]

[quote name='Krypt0n' timestamp='1328806866' post='4911356']
otherwise maybe ffmpeg or x264, those are open source, cross platform, but I don't know how simple the interface is

x264 is GPL, so unless he's going to GPL his code or fork over the money for a commercial license it probably won't work.[/quote]he didn't mention any restriction regarding license, another alternative is to use intel's IPP, it cost something, but is damn fast and it's about a page of code (which can be copied from some tutorial's on intel's site) to create mpeg2/mpeg4/h264 movies.



One option is using Google's VP8 encoder, libvpx. It's completely free and doesn't have any kind of restrictive license (it's a BSD style license). You can use libvpx through FFmpeg, and personally I'm a fan of this idea. The VP8 codec is very competitive to H.264, and it gives good quality and compression ratio.[/quote]I think the main x264 developer disagrees with you about this: http://x264dev.multimedia.cx/archives/377

something to keep in mind is also that, in case the project is distributed as binary, you might need to pay licensing fees to the codec/patent owners.

[quote name='Cornstalks' timestamp='1328807768' post='4911361']
[quote name='Krypt0n' timestamp='1328806866' post='4911356']
otherwise maybe ffmpeg or x264, those are open source, cross platform, but I don't know how simple the interface is

x264 is GPL, so unless he's going to GPL his code or fork over the money for a commercial license it probably won't work.[/quote]
he didn't mention any restriction regarding license
[/quote]
I know, I wasn't saying libx264 was a bad suggestion, I just think it's important to make it clear that it is indeed GPL and it's something to be aware of, seeing as most of the projects I've seen on GameDev are not GPL. Maybe I should've said that a little better.


One option is using Google's VP8 encoder, libvpx. It's completely free and doesn't have any kind of restrictive license (it's a BSD style license). You can use libvpx through FFmpeg, and personally I'm a fan of this idea. The VP8 codec is very competitive to H.264, and it gives good quality and compression ratio.

I think the main x264 developer disagrees with you about this: http://x264dev.multi...cx/archives/377
[/quote]
I never said VP8 is better than H.264, I said VP8 is competitive to H.264. The differences between the two are very small in real life.


something to keep in mind is also that, in case the project is distributed as binary, you might need to pay licensing fees to the codec/patent owners.

This is very true, and something worth looking into for your own protection, floatingwoods.
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
Theora, maybe? You could try to find or create a wrapper around that.
Thank you very much for all the replies and detailed information!

I will definetely have a look at ffmpeg and x264. I am open to any solution, also non-free solutions, as long as I don't have to spend one week to have it working on all 3 platforms ;)

Cheers!

This topic is closed to new replies.

Advertisement