i am currently working on a web application that needs to accept video uploaded by users in any format (.avi, .mov, etc.) and convert them to flv for playing in a flash-based player.
Since the site is OpenCms-based, the best solution would be a ready-made plugin for OpenCms that allowed to upload and play videos doing the transcode operation in background, but just a set of Java classes to do the transcode would be great and then i could make the uploading form and playback part on my own.
You can encode video in Java using Xuggler, which is a Java API that natively uses FFmpeg's C code behind the scenes.
This can be slightly tangential, but I have found Panda Stream to be a very useful solution to all kinds of video encoding problems.
All you have to do is to upload the video file to an Amazon EC2 instance running Panda and it will encode the video to your desired formats and quality and will issue a callback to your application server with the details when it's done. You can then use the bundled Flash Video player or your own player to play the videos on your site.
It's a very scalable (thanks to Amazon EC2 & S3), cost-effective and customisable solution compared to rolling your own.
Highly recommended.
Update:
The architecture of Panda is as follows:
Architecture of Panda Stream http://pandastream.com/images/panda_arch.gif
Encoding files in one format to another takes a lot of development time to get right, which is why there is so little in terms of decoders/encoders that are able to accomplish those feats. The ones that are well known and used the most are ffmpeg and mencoder.
What you may want to look into is to see if the platform you are running on (Windows/Mac OS X/Other unix) has an underlying set of API calls you can use that is able to decode the files, and re-encode them. Windows has DirectShow and Mac OS X has Quicktime. Not sure if you can access those API's using Java though.
FFMpeg does have a Java wrapper available: FFMPEG Java, and there is also FOBS which has a JNI available for their C++ wrapper around ffmpeg. The last one that I found jFFmpeg, however there are some posts that I found with Google suggesting that the project may not be alive any longer.
Your best bet would be either mencoder from mplayer and or ffmpeg. Ffmpeg can be installed as a separate binary and then called from other code using the default "shell" commands. If you are however not able to execute commands you may need to look at using an online conversion website like Mark Robinson suggested.
FFMpeg is the best when it comes to video transcoding.
You can use java wrappers for ffmpeg - http://fmj-sf.net/ffmpeg-java/getting_started.php http://sourceforge.net/projects/jffmpeg/
You could try using an online service like HeyWatch to convert your video. Never used it but they claim
Not a java solution, but you wouldn't have to worry about what OS your web application is on.
If OS wasn't an issue I agree with the answer theBadDawg gave. I don't know of and have had not any luck finding a pure java solution.
You might also be interested in hearing that we've now released Panda as a hosted service as well, which makes the setup and scaling easier :)
http://pandastream.com