views:

57

answers:

2

Currently, the functioning prototype has everything it needs to work: A semi-transparent window for easy resizing on the place you want to record, multiple threads to manage screen shot taking, etc., but one last task I need it to do has eluded me for months. I need to convert all of the images I dumped in a folder I made called temp (that I delete after everything is done) into a movie.

I already have found this, but it is a standalone sort of thing you use in a shell. I need to just tweak it so that it just converts all the images (screencapture1.jpg, screencapture2.jpg, etc.) into a single movie.

Why can't I do this myself? Because I suck at understanding the work of other people, programming language-wise. I don't know why, but unless it's the simplest thing, I can never seem to understand it.

+1  A: 

I suggest to use Xuggler for this. Here's an introduction.

BalusC
Is there a tutorial for the kind of thing I'm looking for? Thanks.
Stuart
+1  A: 

I'd suggest just learning how to call external programs from your java program. Then you can just run that example program you linked to. Or if you want even more capability, use ffmpeg which will do this automatically from the command line as well:

ffmpeg -i screencapture%d.jpg -vcodec mpeg4 outfile.avi

ffmpeg allows you to customize a lot of things about the output video. Just check out the documentation for all the options.

The Java command Runtime.getRuntime().exec(...) will let you run whatever command line you pass it. There are many examples of how to do this if you Google it.

Jason
Adding the FFmpeg library would multiply my application's size by over 300 times... =( Also, how do I use it? I'm not good with shells, but I know for certain I have to tell my shell where the FFmpeg library is before typing `ffmpeg -i screencapture%d.jpg -vcodec mpeg4 outfile.avi` will work.
Stuart
You may have to specify the full path. If in Windows, it may be something like `Runtime.getRuntime().exec("C:\\Program Files\\ffmpeg\\ffmpeg.exe -i screencapture%d.jpg -vcodec mpeg4 outfile.avi");` replacing the path to your executable accordingly. I know this will increase your application size a lot, but it is pretty hard not to when you think about the capabilities you need. You need a JPEG decoder and an MPEG video encoder, both of which are quite complex. Also, you probably want it to be pretty fast. No matter what solution you use, it's going to take space.
Jason
Okay. Would it be possible to take out unnecessary parts of the FFmpeg library to shrink it down?
Stuart
Also, I don't see an ffmpeg.exe. I only see C files. I am also on a Mac, so I don't think a windows executable would work.
Stuart
Yeah, the ffmpeg site doesn't actually offer any compiled binaries. Windows and Linux versions are easy to find, but I have never searched for Mac OS versions. You can build your own, which shouldn't be too hard (although I've never done so for the Mac). See: http://stephenjungels.com/jungels.net/articles/ffmpeg-howto.html. Possibly a simpler option is to use the ffmpeg binary that is bundled with ffmpegX: http://www.ffmpegx.com. I don't know exactly where ffmpegX will install it to, but you should be able to do a search and find it.
Jason
Also, if you build your own ffmpeg executable from source, you may be able to reduce the size of the binary somewhat by disabling certain things. This is done when running the configure script.
Jason