I am looking for an media conversion library that can convert and compress various media i.e both audio and video files to various formats.
FFMPEG-PHP is a popular choice for extracting information. It doesn't re-encode files, though. http://ffmpeg-php.sourceforge.net/
But if you have an instance of FFMPEG installed on the machine, you can call FFMPEG via the exec function in php.
Eg: exec(’ffmpeg -i ‘.$SourcePath.’ ‘.$Destination);
I think your best bet is ffmpeg-php (can be used for both audio and video conversions). Imagemagick has a few basic video conversion options as well.
A second option would be to use mencoder from the MPlayer project (again, you'll have to call this as a command line tool). The main difference between ffmpeg and MPlayer is that the former comes with open source codecs while the latter comes with a host of codecs from all kinds of sources plus it uses ffmpeg.
So ffmpeg is a little more simple to use, MPlayer can convert between many more formats but the command line gets pretty complex.
Related
In some situations (automated testing) I need to screencast my display(s) to video file(s), but currently i can only save a series of PNG files using Robot and ImageIO classes, I know there are other third party programs to convert this set of image files into a video file but I want to make it in my code without a need to third party applications, so how to convert from a series of PNG files into a video file in any format ? Thanks in advance.
I would just get FFmpeg and use that to convert your images to video. You can make syscalls in Java if what you mean by "third party application" is "I don't want to do it manually" as FFmpeg supports command-line.
For example, maybe something like
String[] cmds = {"path/to/ffmpeg", args ... }
Runtime.getRuntime().exec(cmds);
There are many tutorials available on how to use ffmpeg to convert a sequence of images to a video file.
I want to take a few still images and an audio file and turn them into an mp4 file. I am most familiar with java, so that is what I'd prefer to do the coding in. Is there any way to do this, or any library I should look into? I looked at mp4parser, but I couldn't see how to do what I am looking for.
Is there a reason to be doing this in java? Something like ffmpeg can do this, but it's a command line tool.
Well, also a C++ library. I guess there's a Java binding for it, too: https://code.google.com/p/jjmpeg/
For that matter, you could take a look at the ffmpeg source, figure out what they're doing here:
ffmpeg -start_number n -i test_%d.jpg -vcodec mpeg4 test.mp4
Mux in some audio, and you're off. Anyhow, that's how I'd start out. Perhaps someone else will chime in with better specifics.
Some video files contain multiple audio tracks. Multiple languages for example. Is there a library which gets information about these audio tracks? Names of the audio tracks would be sufficient.
It should support common formats (mkv, avi,...)
I believe the best monolithic media file library available is that for VLC player. I seem to remember there was a Java wrapper, but it's probably not maintained (like all Java wrappers more than a few weeks old heheh).
I have found a solution to my problem. From Java I call the following command:
ffmpeg -i myvideo.mkv
Then I read the commands output and filter the lines which start with Stream #.
This works on all my files with multiple audio tracks.
I can capture video and audio separately, but the createMergingDataSource method of the javax.media.Manager class in FMJ just throws an UnsupportedOperationException. Is there another way to capture audio and video and encode them in AVI (or any other format).
In short, the answer is yes - but only by resorting to native code. Fortunately though, native code and associated jars are freely available for Mac, Windows and Linux which is all most people need.
One such option might be lti-civil: http://lti-civil.org/
VLCJ might also do the trick: http://code.google.com/p/vlcj/
what is the easiest way to merge two flv videos into one?
Would be awesome if its possible without command-line-tools like ffmpeg.
It would be great if someone knows a simple java solution =)
(on the server side)
Do you want it server side or client side?
You can simply play one after the other, using a flv player that has a playlist.
You can use avidemux to manualy merge the two
The ffmpeg command for the server side process is really simple:
ffmpeg -i joined.flv -vcodec copy -acodec copy final.flv
According to ffmpeg FAQ:
Some formats allow you to directly
append video data to existing video
files. The easiest would be to use one
of these formats as intermediate
conversions, append files as desired,
and finally convert to format of
choice:
ffmpeg -i input1.avi -sameq intermediate1.mpg
ffmpeg -i input2.avi -sameq intermediate2.mpg
cat intermediate1.mpg intermediate2.mpg > intermediate_all.mpg
ffmpeg -i intermediate_all.mpg -sameq output.flv
Thanks
I suggest trying avidemux. It understands FLV, is easy to use and you can easily append videos to each other and save them out in the same or different formats.
If you're looking to append two FLV's from Java code, you can find source code (using Xuggler) here.