Export divx (or even uncompressed video) : any C++ library out there?

category: general [glöplog]

I've been using opencv to export demoframes into an avi. For some reasons I don't want to do that anymore, is there an alternative library to use? The C++ library would:

* export a frame into a four-cc compressed or (worst case scenario) uncompressed .avi

* no directX pls.

added on the 2009-10-13 16:20:18 by Navis Navis
ffmpeg? it's horribly documented but with some examples you might get it working. gcc only, i believe, but i guess you could compile it into a dll (or maybe download one that others already compiled). or a lib, does that work?
added on the 2009-10-13 16:26:15 by skrebbel skrebbel
ahyes, http://ffmpeg.arrozcru.org/ may be a good starting point.
added on the 2009-10-13 16:26:56 by skrebbel skrebbel
I'm not sure, but perhaps a look into the sources of DivFix++ might help a bit.
added on the 2009-10-13 16:32:38 by ham ham
hmm, it's all getting back now. i believe that in my experience, it was easiest to first convert rgb to yuv yourself, and then pass that to ffmpeg's avcodec_encode_video() function. i can pass some code if ffmpeg is what you want to do and you can't find examples.
added on the 2009-10-13 16:32:57 by skrebbel skrebbel
thanks. is there something similar on the mac os X for .mov files ?
added on the 2009-10-13 16:35:53 by Navis Navis
If you're happy with VFW then there's some example code here: http://www.codeproject.com/KB/security/steganodotnet4.aspx

If you want something non-Windows-specific then just output uncompressed video frames + whatever you use for audio to an AVI container. Creating the chunks and index and whatnot doesn't take much effort. A few hundred lines of code and you're done.
added on the 2009-10-13 16:35:56 by mic mic
Navis: I know this will sound a bit too "d'oh" but, ever thought of checking the sources of .kkapture? It is open-source, and according to its change-log:
direct xvid/divx encoding works now.
added on the 2009-10-13 16:36:26 by decipher decipher
thanks all. I could use kkapture yes, but I'd like to control it myself from inside the application (and also have something similar on the mac too).
added on the 2009-10-13 16:39:19 by Navis Navis
i guess that's why he asked you if you checked the sources. :)
I think you can isolate the part of .kkapture that does exactly that and incorporate into your own code. Refactoring, so to speak.
added on the 2009-10-13 16:40:34 by decipher decipher
navis, ffmpeg seems to be able to write mov and it's cross platform.
added on the 2009-10-13 16:41:29 by skrebbel skrebbel
So is ffmpeg what people on macs use for mov export, or there is another more popular/straightforward solution. FFmpeg looks like a bit of hassle to get to compile/work.
added on the 2009-10-13 16:44:14 by Navis Navis
Navis: You know Mac's built-in video codecs include other formats than MOV as well :D. What's this obsession with MOV?
added on the 2009-10-13 16:45:42 by decipher decipher
ehm none, I'm new to it and I thought that .mov it is the "lingua franca" for video on macs. Isn't it so ?
added on the 2009-10-13 16:47:29 by Navis Navis
Navis: I am a full-time Mac user / coder and I have never heard such a thing. A video is a video. MOV is just a format.
added on the 2009-10-13 16:49:31 by decipher decipher
fair enough. Thanks.
added on the 2009-10-13 16:56:21 by Navis Navis
Keep in mind that ffmpeg has a viral license, if you care about that shit.
added on the 2009-10-13 17:14:26 by kusma kusma
Decipher: I guess you meant "a format is a format, MOV is just a container" right? :)
added on the 2009-10-13 17:53:33 by gloom gloom
-I used video for windows to output to an xvid avi. it was ok.

-Sometime later I then used quicktime sdk to do something similar. documentation could have been better, but it was ok after finding relevant sample code.

ffmpeg was awful. hard to get to work under visual studio, and documentation is very lacking. it seems to me the contributors enjoy having their little cult going on over there. complete waste of a good couple of weeks.

hope that´s of some help.
added on the 2009-10-13 18:15:10 by Reboot Reboot
oh, if for some reason you decide to go for ffmpeg, let me just say this to save some of your time:

you can´t compile ffmpeg under visual studio

but, you can get it to work with some libraries produced by gcc. or something like that.

yeah, portable code huh.
added on the 2009-10-13 18:17:32 by Reboot Reboot
gloom: point. :)
added on the 2009-10-13 19:41:09 by decipher decipher
What do you need it for? We use ffmpeg (as in using the commandline binary, so we think we're clear of the gpl virus) by stuffing jpegs down it's pipe and tell it to interpret it as mjpeg. Works pretty nice and we have easy access to all the encoder/format/processing options of ffmpeg.
added on the 2009-10-13 20:47:59 by Psycho Psycho
the kkapture aviwriter is available as a standalone c++ class:
if that helps.
added on the 2009-10-13 20:56:41 by ryg ryg
Cool thanks, I already worked it out how to do it with vfw.

ffmpeg in commandline is another option, sure. Sounds promising if I can't get it to work on the mac.
added on the 2009-10-13 22:17:57 by Navis Navis