Simple API to encode movies
Started by floatingwoods, Feb 09 2012 07:52 AM
6 replies to this topic
#1 Members - Reputation: 187
Posted 09 February 2012 - 07:52 AM
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!
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!
Ad:
#2 Members - Reputation: 443
Posted 09 February 2012 - 11:01 AM
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
#3 Members - Reputation: 1216
Posted 09 February 2012 - 11:16 AM
Krypt0n, on 09 February 2012 - 11:01 AM, said:
otherwise maybe ffmpeg or x264, those are open source, cross platform, but I don't know how simple the interface is
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.
[ Realistic Rendering ] [ School + Dublin = Boom ] [ I've been ninja'd 70 times ] [ f.k.a. MikeTacular ] [ My Blog ]
#4 Members - Reputation: 443
Posted 09 February 2012 - 11:26 AM
Cornstalks, on 09 February 2012 - 11:16 AM, said:
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.
Quote
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.
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.
#5 Members - Reputation: 1216
Posted 09 February 2012 - 11:49 AM
Krypt0n, on 09 February 2012 - 11:26 AM, said:
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.
Krypt0n, on 09 February 2012 - 11:26 AM, said:
Quote
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.
Krypt0n, on 09 February 2012 - 11:26 AM, said:
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.
[ Realistic Rendering ] [ School + Dublin = Boom ] [ I've been ninja'd 70 times ] [ f.k.a. MikeTacular ] [ My Blog ]
#6 Marketplace Seller - Reputation: 1413
Posted 09 February 2012 - 12:05 PM
Theora, maybe? You could try to find or create a wrapper around that.
All glory be to the Man at the right hand...
On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.
On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.
#7 Members - Reputation: 187
Posted 10 February 2012 - 10:11 AM
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!
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!


















