How to detach audio stream bitrate from video file in Android? - android

I want to get audio bitrate from video file and save it.
Is it possible to get audio track bitrate alone form video file using ffmpeg ?
if possible then how to do it?...Any suggestion will be appreciated.

Related

Can FFmpeg record audio on Android?

Since MediaRecoreder not supports encoding to mp3 format.
Can ffmpeg to record audio directly from Android audio source (how to specify this) or it only encodes one file to other format?
You mean using Android to record audio and save it as mp3?
If so, you can code mp3 using libmp3lame. And this is very useful.
Since Android Record outputs a pcm, liblmp3lame can use pcm as input and then output mp3 data.

Android RTSP Live Streaming Issue

Android Video Live Streaming Problem
I am using Vitamio library. The RTSP streaming is working well, Now I want to record that RTSP live streaming in my SD card locally. please help !!!
Or can i use media recorder to record RTSP live streaming ?
Media Recorder is not the good way to record RTSP video, I have used the FFMPEG library to record RTSP recording locally in sd card.
Steps to do this.
Capture or decode the RAW frames from live stream and pass them to ffmpeg and save them to sdcard in .h264 format.
Then again pick .h264 raw file and decode the file using ffmpeg, and save the file with extention .mp4 into sd card.
delete the .h264 file programmatically, and save only .mp4, or which format you want.
Try .mp4 playback.
I am able to record long time such as upto 5mb video's into my sd card.

Possible to use Android MediaMuxer to overlay an audio clip?

I am trying to add a short audio clip on top of a video clip. I have been able to use Android's MediaMuxer to combine a .mp4 with video only and a .mp4 with audio only, but my current task is to overlay an .mp4 audio clip on top of a video+audio .mp4 clip in the middle. I have tried using the mp4parser library that has been suggested in other threads but have found troubles with that route (SampleDescriptionBoxes never match).
My idea was to use writeSampleData() to the MediaMuxer with data extracted from separate .mp4 clips. I would write the audio from the original video, then at the given point start writing the new audio. Finally, I would return to the audio from the original video again. Does anyone know if this is feasible? I am having troubles mostly because I don't understand how presentationTimeUs is supposed to work and the result is not streamable.
Any suggestions/help are appreciated!

Impossible to mix audio file and video file using MediaMuxer?

I'm developing an Android App that records screen video and audio.
I recorded these 2 files : mp3 audio file and mp4 video file(no sound).
Now I want to mix them and create a new mp4 video file(with sound).
From Android 4.3, Google suggests using the MediaMuxer class to mix stream audio and video. I have tried many times without success.
Any solution to resolve my issue with MediaMuxer API from Google?
Any help will be greatly appreciated.
MediaMuxer does not transcode.
If you write out an MPEG4 file, it will expect the video file to be MPEG4/AAC and the audio file to be an AAC file (m4a) as well.
Once you feed it with an m4a, muxing will succeed.
This is a full sample source code to merge wav audio file to mp4 video file :
https://github.com/tqnst/MP4ParserMergeAudioVideo

Android AudioRecord and MediaRecorder

I'm developing an audio processing application where I need to record audio, and then process it to obtain features of that recording. However, I want the audio in a playable format to play it after with MediaPlayer.
I've seen that to record audio to process it it's better to use AudioRecord, because I can get the raw audio from there. But then I can't write the data to a file in a playable format (is there any library to do this in android?).
I used this method to record raw data and then write it into a file:
http://andrewbrobinson.com/2011/11/27/capturing-raw-audio-data-in-android/
But when i try to play this file on the device, it is not playable.
Then if I use MediaRecorder I don't know how to decode the data to extract the features. I've been looking at MediaExtractor, but it seams that MediaExtractor doesn't decode the frames.
So.. what's the best way to do this? I imagine that's common in any audio processing application, but I wasn't able to find the way to manage this.
Thanks to your replies.
Using AudioRecord is the right way to go if you need to do any kind of processing. To play it back, you have a couple options. If you're only going to be playing it back in your app, you can use AudioTrack instead of MediaPlayer to play raw PCM streams.
If you want it to be playable with other applications, you'll need to convert it to something else first. WAV is normally the simplest, since you just need to add the header. You can also find libraries for converting to other formats, like JOrbis for OGG, or JLayer for MP3, etc.
For best quality result you have to use AudioRecord class instead of MediaRecorder.
Please have a look to below link:
Need a simple example for audio recording
Also have a look to this link: http://i-liger.com/article/android-wav-audio-recording
If you use AudioRecord object to get the raw audio signal, the next step to save it save as a playable file is not so difficult, you just need to add a WAV Head before the audio data you capture, then you get a .WAV file which you can play it on most mobile phones.
A .WAV file is a file under the RIFF format. the RIFF header for WAV file is 44 byte long and contains the sample rate, sample width and channel counts information. you can get the detail information from here
I did the sample function on Android phones and it worked.

Categories

Resources