I am looking for a 100% Java solution for encoding software generated images into an AVI stream together with an uncompressed audio track.
At the moment I am using JMF, but its size and installation problems make it a bad solution for my purpose.
While it does not support audio, I created an MJPEG AVI Java class some years ago. You basically just tell it the resolution of your output video, along with the frame rate, then you just keep adding images to it. When you are done, you tell it to finish and it'll close out the AVI. It is based off of the Microsoft documentation on AVI, RIFF, and BITMAP file formats.
Other than not supporting audio, the only real problem is it implements the version of the AVI format limited to 2GB per file. While the class will write out a much larger file, I am uncertain that any players or video editors would be able to read it.
The way I've used this code in the past, is to generate an MJPEG AVI for processing in a video editor (adding audio, etc. in the editor). It helped me with automating some tedious slide show generation. Not sure if this code will help you, as is, but it might help if you are trying to roll your own solution. MJPEGGenerator.java is available if you are interested!
You can use JMF, see this nice example.
There is a nice blog entry here:
http://www.randelshofer.ch/blog/2008/08/writing-avi-videos-in-pure-java/
By Werner Randelshofer
Related
I am trying to convert a mp3 file into WAVE format in my Android application. This operation should take little time, as the application is social, and it is not acceptable for the user to wait for too long.
So here is where I am :
I have already tried to use JLayer (proposed in a similar question Convert mp3 to wav on Android), but the conversion is too slow: it takes about 40 seconds for a 2 minutes mp3 file.
Concerning the library LAME (as in Lame4Android), I also tried it (with Android NDK) but the result is still too slow (15s to 10s).
I came across another library: JUCE, but it is too vast, and including the entire library in the project in order to do that simple conversion seems a bit... excessive. And I am also afraid it will slow the application.
So what I am currently looking for is a C/C++ library to use in order to do that.
Do you know any fast libraries?
Thank you.
Not sure if the license will work for you (GPLv2), but have you considered libmad?
As I understand it, there's not a NDK build available for download, but here is a page describing how to make one yourself...
Another option is libmpg123, which is LGPLv2.1. The same blog has an article describing how to use it in Android.
I have been searching on this. I Need to build an independent utility that should:
Convert image sequence to .mov format
Take input from user and display it inside the mov.
I plan to do this using Java since this is a cross platform language.
How to do it?
See JpegImagesToMovie.java it requires the x-plat version of the JMF (or more importantly jmf.jar).
For a more modern alternative, look to JFFMPEG (JMF with more formats & encodings).
I have earlier used XUGGLER for making videos from image frames. It is easy to use XUGGLER with the help of the comprehensive tutorials available here. You can also add audio to the video generated from the image frames.
Xuggler supports a large number of video codecs and video container formats so you will have the option of creating the video in different formats, leave alone .mov. Hope this helps. I can post my own code for this utility if required.
Does anyone know of a library for either python, c(++), or java , or even an external app, that I can use to check for a specific audio distortion in an mp3? My problem is this:
I have a very robust Django app that automatically does podcasting for a radio station for all the different shows, but about once a week the computer that does the actual recording records corrupted audio, that has a specific interence pattern, it's a chopping sound almost like a helicopter where the audio drops several times a second. I'm not hoping to fix those audio files(as I've tried manually with good editing software and it's just a lost cause) but rather detect weither or not that type of corruption is present so I can switch to the back-up version of the recording automatically. external tools should ideally run on linux, but windows is acceptable as long as it is headless(no forced gui).
Thanks.
I think all you will need to do is do an fft on the mp3 and you should see a really low frequency spike which corresponds to the big drops. I'm no dsp guru though so not sure that this will work, but its easy to try.
You can use the numpy library for python for this. Link
just read in the mp3 file into an array and then do an fft, for a test I would recommend just plotting it first (using maptlotlib for example), with both versions, corrupt and good and see if you can easily detect the corrupt version. Then hopefully you can write a simple algorithm to detect corrupted files from there fft's.
For reading in the mp3 into a data buffer you can use PyMedia http://pymedia.org/
I haven't used PyMedia so i'm not sure on reading the mp3 into a buffer (it shouldn't be too complicated I imagine), but after that plotting the fft is as simple as:
from numpy import *
from numpy.fft import *
import pylab
# place code to read the mp3 file into buf[] here.
buf_fft = fft(buf, 1024)
pylab.plot(fftfreq(1024, 0.1), abs(buf_fft))
pylab.show()
Try BASS Library and see if it has what you are looking for.
I'm looking for fellow users, who are using Xuggler to produce video encoded with Theora. I've tried a lot of different options to get "good" quality using presets to no avail. I would love to get quality anywhere close to what I can produce with the Miro converter tools defaults. Sadly, the web doesn't seem to have much to say except that we should all "use ffmpeg2theora" which is not an option when using Xuggler, and I have to use Xuggler in this case.
My listener which configures the codecs is here: http://pastebin.com/MX2r5KsC
And my reference preset file is here: http://pastebin.com/fBeZxSGr
A solution was found by a colleague / client on a related project. The resolution is surprisingly simple, and consists of the following three lines of code:
coder.setFlag(IStreamCoder.Flags.FLAG_QSCALE, false);
coder.setBitRate(200000);
coder.setTimeBase(IRational.make(1,25));
This forces Xuggler to encode using a constant bitrate of 200kbps and with a frame rate of 25 fps. I hope this helps my fellow Xuggle users out there.
Howdy! For a research project (in Java), I've got to find some way to save an animation of a graph into some file format. Now I've already got the program working fine drawing each frame. The problem is, short of learning the whole GIF or AVI file format, I have no idea how to assemble the frames programmatically into some sort of animation or video file. File formats don't really matter--input or output. I just need some way to put the frames together and save!
Right now I'm thinking the easiest format would be either animated GIF or AVI. Again, though, it really doesn't matter so long as it works.
Thanks a bunch!
They might not be the best options, but I just thought of these:
You might be able to use some QuickTime APIs. I know they're used fairly often for webcam input, and that they can also generate video.
You could also generate each frame and then assemble them with ffmpeg.
Try Xuggler -- it'll let you save graphics into pretty much any video format.