I want to make an app that downloads a specific MP3 file, allow the user to crop/trim it and re-upload it back to our server. How can I trim MP3 files inside my app ? Do I need to achieve this in C and then port it/use NDK ? If MP3 is tough, I can switch over to other easy formats too.
Will be great if anyone can show me the right path.
I think of all the alternatives, using something like LAME and compiling for the NDK is your best option. Be warned that there are patent restrictions on the MP3 format (most of which I don't understand), and you may run into problems if you distribute your app. YMMV
I didn't test it on Android yet, but there is a pure Java MP3 decoder / player I wrote a while ago. Maybe you can use parts of it. The code is based on JLayer from JavaZoom (also LGPL).
This library helps to trim MP3,AAC/MP4,WAV,3GPP/AMR...
http://code.google.com/p/ringdroid/
Related
First, I'm new in this Import thing
I've compiled latest version of ffmpeg with NDK r14b,
and managed to get some Library after compiling(like libavutil.so,libavcodec.so,libavfilter.so,etc)
Click here for pic
but im a bit confused importing it to my android project.
First, I want to make an Audio editing app that can merge several mp3 file at specific time, and adjust volume (Increase or Decrease its sound) mp3 file.
I've read about ffmpeg recently, since most people recommended to use this Library.
For merging :
-https://superuser.com/questions/1092291/merge-many-audio-files-with-specific-positions/1092346#1092346
For adjust volume :
-Decode MP3, then increase the audio volume, and then encode the new audio
What i want to ask is:
-from guardian's ffmpeg project and WritingMinds ffmpeg lib (can't post the link since i got not enough rep and this 2 are often mentioned in stackoverflow), does this 2 Libraries have what i needed? I'm a bit confused in this thing. An explanation would be a help.
-from http://ffmpeg-android.blogspot.co.id/ i cant run the ndk-build command at the last part. How should i use it?
Thank you in advance!
I am new to android. I have two files of same length, One is audio file and one is video file with no audio. I want to make a video with audio by combining these two files. Help me to achieve this task.
I assume you have native Android app and familiarity with Java (or know porting the code in native C) and are willing to use other open-source classes in your project.
This is what you might give a head-start: Since this project is not actively maintained now, you might have to fork and use their logic into your code.
https://github.com/tqnst/MP4ParserMergeAudioVideo
Another alternative is using ffmpeg port for Android (however I am not sure how this works natively).
https://github.com/WritingMinds/ffmpeg-android-java
I play an mp3 file from url with android MediaPlayer class.
(everything works fine)
I want to amplify the sound, make it sound louder.
I don't mean just raise the device volume but to actually amplify the sound.
even in cost of loosing some quality.
(I want it to be done in code and not with 3rd party software) maybe with some kind of java library.
MediaPlayer doesn't have a out-of-the-box method for this. Doing what you try to do really goes in the direction of audio-manipulation. This means, that you should get the byte stream and modify it for your needs. E.g. read the MP3 specification and try to rise the amplitude.
A better approach would be to edit your current mp3 files with a professional desktop editing program and play the files just the usual way.
As per my understanding, this may not be directly allowed in MediaPlayer and you may need some mp3- manipulation algorithm or library to do this. I am looking into this, but you can use the following as a starting point:
Audio Effect
Looks like you're not supposed to directly use, that but one of its subclasses:
Equalizer
Virtualizer
BassBoost
PresetVerb
EnvironmentalReverb
Maybe it will help you, but I'm not exactly sure how to implement it. Will look into it.
Requirement
Android open a .wav file in sd card, play it , add some effect (like echo, pitch shift etc), save the file with effect. Simple :(
What I know
I can open and play file using Soundpool or MediaPlayer.
I can give some effect while playing using both. ie for Media Player
I can set Environmental Reverb effect. Using SoundPool I can set
playing rate, which is kind of like pitch shift. I am successful in
implementing these right now.
But either of this classes doesn't have any method to save the
played file. So I can only play, I cannot save the music with
effect.
What I want to know
Is there any other classes of interest, other than MediaPlayer or
SoundPool. Never mind about saving, you just mention the class, I will do the
research about saving file with them.
Any 3rd party libraries where I can add effects and save? Happy if
it is open source and free. But mention them even if it is
proprietary.
Any other areas where I can look into. Does OpenAL support voice
filtering along with voice positioning? Will it work with Android?
Ready to do the dirty work. You please lend me the path..
EDIT: Did some more searching, and come across AudioTrack. But it also won't support saving to a file. So no luck there also..
EDIT Ok, what if I do it myself? Get raw bytes from a wav file, and work on that. I recorded a wav file using AudioRecord, got a wav file. Is there any resource describing low level audio processing (I mean at the bytes level).
EDIT Well bounty time is up, and I am giving bounty to the only answer that I got. After 7 days, what I understood is
We can't save what we play using MediaPlayer, AudioTrack etc.
There is no audio processing libraries available to use.
You can get raw wav files, and do the audio processing yourself. The
answer gave a good wrapper class for reading/writing wav files. A
good java code to read and change pitch of wav files is here.
The WavFile class http://www.labbookpages.co.uk/audio/javaWavFiles.html claims to read and write wav files and allow per-sample manipulation through arrays of sample values. It's certainly reasonably small, 23kbytes total source code.
I did struggle for a while to build an android app with the Wavfile Class included. This turned out to be because both WavFile and ReadExample (from the above link) were intended as standalone java programs, so include a method main(String [] args){}. Eclipse sees this and thinks the Class is a standalone runnable program, and, when I click the run button, tries to execute just the one Class with the java in the development machine, instead of launching the whole app to my phone. When I take care to run the whole app with the little drop-down menu on the run button, I don't have any trouble, and the WavFile Class and examples drop straight in, give zero warnings in the IDE, and work as advertised running on my phone.
We need an Android app that can encode a folder of images to a video. I have been looking for solutions a while now, but cannot find anything good. The Android API does not support it. We are trying ffmpeg, but cannot get it to work. We need a working solution, using ffmpeg is not mandatory. A full Android Java solution is also a possibility, since this would work on all Android devices, possibly at the cost of some performance.
The app also needs to be able to add an audio track to the movie if the user chooses to do this.
Any help would be appreciated.
Kind regards,
AƤron
From the FFmpeg FAQ entry "How do I encode single pictures into movies?":
First, rename your pictures to follow a numerical sequence. For example, img1.jpg, img2.jpg, img3.jpg,... Then you may run:
ffmpeg -f image2 -i img%d.jpg /tmp/a.mpg
Adding an audio track should just involve add another input (e.g., -i audio.mp3), but could also require explicit -maping with older versions.