Generating an mp3/wav/ogg Waveform using Java - java

Like soundcloud and zippyshare1, how can I generate an audio waveform image using java? are there any frameworks or open source libraries available for such case?
I wanted to generate an audio waveform as an image, and upon loading a track, the waveform image with will be loaded.

Start with this answer. The "further processing.." in this case might be to add each instantaneous value to a GeneralPath, then (scale that path to fit within the painting area and) draw it.

Here are two questions with answers on SO:
Java Program to create a PNG waveform for an audio file
How can I draw sound data from my wav file?
I like my answer to the second question the best because it explains how to do it in all cases, but it doesn't give code.
There are lots of other answers, too.

Related

How to program a GIF using any type of image/ object with processing?

I have used Java language for beginners is used with object type calling so there's an app or software called processing that I used that's a bit easy at making programs... (https://processing.org/)
What could be the best shortest example to make a animated GIF using shapes/ images?
What way could be the best way to make a GIF animated in regular Java without using processing software?
What could be the easiest examples for a beginner to do an animated GIF?
Stack Overflow isn't really designed for general "how do I do this" type questions. It's for specific "I tried X, expected Y, but got Z instead" type questions. But I'll try to help in a general sense:
You need to break your problem down into smaller steps and then take those steps on one at a time. Can you create a simple animation? Something simple like a circle moving around the screen. Separately from that, can you export a single .png image from a sketch? Again, just something simple. Work your way forward in small steps: can you then export each frame of a simple animation as a .png file?
Then when you have those .png files, you can use something like Image Magick to convert them into an animated gif file.
The Processing reference is your best friend for questions like this. The save() and saveFrame() functions could come in handy for exporting an animation as a gif.
Please try something, and if you get stuck, post a MCVE along with a more specific technical question in a new post. Good luck.

Capturing SurfaceView into video file based on google/grafika examples

I would like to load video from file, make some transformation on it and render it back into file. Said transformation is mainly two videos overlapping and shifting one of them in time. Grafika has some examples relevant to this issue. RecordFBOActivity.java contains some code for rendering video file from surface. I'm having trouble changing two things:
instead of rendering primitives in motion I need to render previously decoded and transformed video
I would like to render surface to file as fast as posible, not along with playback
My only success so far was to load .mp4 file and add some basic seeking features to PlayMovieActivity.java. In my reasearch I came across these examples, which are also using generated video. I didn't found them quite useful, because I couldn't swap this generated video with decoded one from file.
Is it posible to modify code of RecordFBOActivity.java so it can display video from file instead of generated animation?
You can try INDE Media for Mobile, tutorials are here: https://software.intel.com/en-us/articles/intel-inde-media-pack-for-android-tutorials
Sample code showing how to enable editing or make transformation is on github: https://github.com/INDExOS/media-for-mobile
It has transcoding\remuxing functionality in MediaComposer class and a possibility to edit or transform frames. Since it uses MediaCodec API inside encoding is done on GPU so is very battery friendly and works as fast as possible.

Modify Exif tags in Java for mp4 videos

Is there any API or library in Java available that will let me modify tags in the metadata for mp4 files? I need to modify the orientation (or rotation) tag in order to get videos to playback in the correction orientation. Something for Android would be preferrable.
Full disclosure: I'm the creator and maintainer of the mp4parser lib.
Use http://mp4parser.googlecode.com for opening the MP4 file. Navigate to the exif box (I have never seen that box) and modify it. Then write the file back to disk.
But are you really sure the exif box is changing the playback behavior? It rather seems to be an info box that tells you something about the recording situation.
I'd rather think you should modify the matrix in the Track Header Box (/moov/trak/tkhd) to retate the video. You might want to have a look a the Matrices part of the quicktime format specification (same as MP4 - at least for the matrices)
This answer here helps you with the matrix: https://stackoverflow.com/a/8177749/829133

How to improve the image quality before the image processing start in javacv or opencv?

I have an image with 400x400 image to identify different components from it. But when I try to identify components using that most of time it doesn't provide correct answers. So I need to know whether there are some kind of methods in javacv or opencv to improve the quality of the image or increase the size of the image without effecting to its quality ?
This is the sample image that I use. (This is the maximum size that I can get and I can't use any photo editing softwares in the project, because it's dynamically generated image.)
In my image processing I need to identify squares and rectangles that connects those squares. And specially I need to get the width and height of those using pixel values.
You can scale it to any size, if you can vectorize it... and in your case vestorization is quite simple as you have some simple geometrical objects in image.
So, in my view your approach should be like this:
detect edges in the image with a high threshold (as you have very distinct objects)
vectorize them
scale them to any size
You should also look at the following link: Increasing camera capture resolution in OpenCV.
If you stick to image processing the easiest way to do it is to apply an equalizeHist(). This will increase contrast and will improve subsequent steps.
But, and this is a biiiig 'but', why are you doing it? Just reading this post, I saw another solution, and a quick google proved me I am right:
Kabeja is a Java library for parsing, processing and converting
Autodesk's DXF format. You can use Kabeja from the CommandLine or
embed into your application. All parsed data are accessible with the
DOM-like API.
That means you can extract directly all the data you want from that image in a text format. Probably something like "at position x, y there is a transistor, or whatever." So why would you render that file into an image, then analyse that image to extract the components?
If you do it for school (I know that many school projects are like this) I would recommend you to find a real problem to solve, and propose it to your teacher. You will be happier to do something that is not complete nonsense.
vectorizing the image is best option I guess as suggested by mocap.
you can also use enhancement tools like sharpening, saturating etc.

Produce a simple Video - uncompressed, frame by frame

I need to an algorithm, to write frames (Pictures) into a file, which can be read by some Video-Cutting/Producing-Software to work with.
So I got frames, and I want to give them a input into a function/Method.
Let's do i in Java.
How can I do this?
Is there a simple way, I can write videofiles without using any systemcodecs?
I just need a uncompressed video with a constant Framerate (25 fps or 50 fps)
that will take my true-Color pictures (2D-arrays of Colors), so that I can use that video in my Videoprogramm to work with.
I never found any fileformat that fits to that.
Can You help me?
Greetings from Austria, and thanks. Flo.
Depending on the program you want to use to further process your movie you can also simply create PNGs (or TGAs or BMPs) for the single frames. VirtualDub e.g. can use images as frames for a movie.
The AVI container format can contain streams of uncompressed video, of which there are many types to choose from. Have a look here http://fourcc.org/ at the RGB and YUV formats, and here http://www.alexander-noe.com/video/documentation/avi.pdf for details on the AVI file format.

Categories