HI all,
I am working on playing audio from URI using ffmpeg shared library in android.
I configured android-ndk and added ffmpeg shared library to project and able to compile the project using cygwin.
In ffmpeg library i see ffmpeg.c file, i donot know how i can use this file to implement audio player in my activity.
Please help me on this issue.
Thank you in advance
First, Use ffmpeg to open the URI and read frames and decode to raw PCM data, you can take a look at ffplay.c about the decoding part.
Next, using the Android AudioTrack class to play the raw PCM data, there is a tutorial: fun with audiotrack
Good luck!
Related
Please can anyone tell me the usages of ffmpeg file in android. Though I tried to browse but none of them satisfied me.
FFMPEG is library,it will used to decode and encode audio,video file , if you are streaming a video from your android application it will be used.
Is it possible to convert the format of the media source when playing a video with exoplayer? I thought that I could use FFMPEG to convert the format, but I do not really know how exoplayer works and the problem is that the media source is not a file, but a stream. It is avi format, which unfortunately is not supported by exoplayer, and I could not find any working player for android that has avi support.
I see there is a ffmpeg extension for exoplayer, but I do not know if that will solve my problem and I have no idea about NDK and compiling c++ for android and the instructions are very unclear. If someone could explain how to do it or give me a guide that would be nice. This is the link to the exoplayer extension:
ffmpeg extension
I am using Lame library to convert pcm file to mp3 in android.
using this link I compiled it and every thing is ok.
but I don't know how to use this library to convert .Pcm file to .Mp3 in android studio.
any sample code or any hint would be appreciated
This is an example: https://github.com/intervigilium/Lame4Android/blob/master/src/com/intervigil/lame/Main.java
It seems that you need to do a Lame object and onActivityResult do the conversion of the file or see this as a possible duplicated question: https://stackoverflow.com/a/34322713/6848782
I am trying to apply new audio pitch for my video file.
I want to replace audio of my existing video by android code. Is it possible in android. can any one help me to do this
Is there any Android library support this facility to change audio for video file?
Any Help is appreciated...!!!
Thanks in Advance
This is not the exact solution but you can try it:
When you play the video file set its volume to zero.
At the same time use the service in which you can play any audio you want.
As service runs at background it has no effect on your video streaming.
When your video end,end your service.
And remember to set volume of your audio file.
You can change video pitch easily by following these steps :-
Add this library in your android project : https://gitlab.com/soundtouch/soundtouch.
follow this link for integrate this library process : https://stackoverflow.com/a/52425255/7899427.
After successfully integrate this library first of all extract audio file in WAV audio format. You can use ffmpeg library for do this.
Than using the soundtouch library you can change the audio file pitch and tempo rate and export new audio file in WAV format.
After complete these steps merge that converted audio file with video file.
Now will get the converted audio file with same video file.
Happy coding.
How to play .aac audio format in android.
I tried using ffmpeg convert audio format and play in android-ndk. But im not able to implement.
Please let me know any ideas or any ref link to follow
You can check this native aac player implementation. It is ffmpeg-based, and I heard it is fairly light on CPU.
http://code.google.com/p/aacplayer-android/