Android_Can't play the mp4 file generated by MediaMuxer - android

I am trying to use MediaCodec and MediaMux to generate mp4 file. The code I am using is here.
I get some mp4 file. However, I can't play it with my player, which is just a normal software.
Does anyone has any idea? What should I do next?

I had a similar issue - in my case I simply wasn't calling muxer.stop() and ended up with a large unplayable file.

Related

Combine / merge / mix multiple audio files with MP4Parser on Android

I have two MP4 audio files and one MP4 video file. I need to combine them to reproduce the video and the two sounds at same time (Parallel, Not concatenate), in order to get an only MP4 file.
For example, I have an MP4 audio file with voice, another with music, and another with video. I need that they play all together like a videoclip.
I have been trying to add several audio tracks to movie with MP4Parser with:
video.addTrack(audioTrack1);
video.addTrack(audioTrack2);
But when I play it, I only can hear one of them. Maybe MP4Parser is working correctly and I didn't understand this functionality, for this cause I need an answer about it.
Is it possible to do this with MP4Parser or I am wrong and it is impossible?
If it is possible, please could you give me a working example code?
Thank you in advance.

Gstreamer streaming over udp

I have ported gstreamer to android and I am using eclipse (juno). Now, I am able to receive audio stream over udp, but when I try to give any video clip as input, I get the error, amcaudiodec-omxgoogleacdecoder - Gstreamer encountered an internal library error. I dont know how to solve this decoder problem. Any idea regarding what might the error could be?
Also, I wanted to know what is the difference between the plugins playbin and playbin2. Can anyone please explain?
You would have to add "androidmedia" plugin to the Android.mk file, as per plugins.mk file.
I suspect, as you have not included this in your Android.mk, playbin is trying to internally invoke this element, hence the lob
I'm not sure about this, but your problem may be that you cannot use a pipeline meant to play audio files to play a video file.
Video files are usually in a container format such as .avi, .mkv which need to be demultiplexed into separate audio and video streams. Once you have this audio stream you can apply your audio pipeline to play audio.
Here's an example pipeline to play audio while ignoring video: (Try it on the command line)
gst-launch filesrc location=test.mp4 ! qtdemux ! faad ! audioconvert ! audioresample ! autoaudiosink

streaming a mp4 file using RTSP?

I am developing an app. that will stream the video recorded from camera and stored as mp4 in sdcard...
I know there something called as RTSP which is used for that...
Please tell me where to start . .and is there any library that will do this for me...
I do not understand why you want to stream a local mp4 file, but maybe I misunderstood you problem. RTSP is used for live streaming, but you want to play a local mp4 file.
If you want to capture video and save it as mp4 onto a SD card, you need to use the Android MediaRecorder. Here a link to a simple example.
If you just want to playback a local mp4 file. Have a look at the Android API Demos.
These are part of the Android SDK installation and contain a good example of how to playback local media files.

How to merge an Audio and Video files in Android

I have a small video clip and an audio file. The problem is how to write code to merge them into a single file. i have never written code for multimedia applications for android and don't know if the merging is possible with android media framework. Is there any third party library to do that?
Can we right a merging code in Java and call it in Android?
Please guide me through this. Thanks
You can try INDE Media for Mobile, tutorials are here: https://software.intel.com/en-us/articles/intel-inde-media-pack-for-android-tutorials
It has a sample demonstating how to substitute audio track in mp4 video file by another audio track from another mp4 file. It's here: https://github.com/INDExOS/media-for-mobile/blob/master/Android/samples/effects/src/com/intel/inde/mp/effects/SubstituteAudioEffect.java
In sample app it's under Audio Effect:

Android change audio of any video file

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.

Categories

Resources