Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 226
nguoitotkhomaisao Avatar asked Dec 06 '13 04:12

nguoitotkhomaisao


Video Answer


2 Answers

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.

like image 109
Guy Avatar answered Oct 17 '22 18:10

Guy


This is a full sample source code to merge wav audio file to mp4 video file :

https://github.com/tqnst/MP4ParserMergeAudioVideo

like image 20
nguoitotkhomaisao Avatar answered Oct 17 '22 17:10

nguoitotkhomaisao