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
Related
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.
I have MP4 (H264) video. created by jcodec. jcodec not support not encode mp3 audio. i want add mp3 audio to my mp4 video. MP4parser is good solution for this merge, but not support mp3 format. FFmpeg (javacv) is very large native library and complex and difficult to use.
so what is easy way to add mp3 audio to mp4 video? (this question is dublicate BUT awnsers is old and not working)
I have found a solution for resampling an .mp4 video taken with the camera on the device to make it smaller (resizing by resolution, bitrate, and framerate). The problem is, it doesn't carry the audio over.
I have looked at several different options for trying to get the audio out of my source (large) mp4 and push it into my smaller mp4 and I can't not seem to get any of these procedures to work correctly.
I've tried the following:
1) extracting the PCM audio from the source using: How do I extractor audio to mp3 from mp4 using java in Android?
2) converting the PCM to M4A and then adding the M4A to the smaller MP4 using: https://github.com/tqnst/MP4ParserMergeAudioVideo/blob/master/Mp4ParserSample-master/src/jp/classmethod/sample/mp4parser/MainActivity.java
that's the method I got closest with but the audio was really slow and didn't match up at all with the video in the smaller mp4.
I also tried a "direct copy" from one mp4 to the other with a variation of this: Concatenate multiple mp4 audio files using android´s MediaMuxer
that made my smaller mp4 actually larger (in file size) than my source mp4 and it didn't actually move the sound over.
The android documentation for MediaMuxer is pretty terrible and I can't make heads or tails of what I need to do to get this to work. It seems like it should be a pretty trivial task....
any suggestions or advice would be greatly appreciated.
TIA
I ended up just using ffmpeg with this solution:
https://github.com/WritingMinds/ffmpeg-android-java
I am developing app, in which I want to :
Mix two audio files ( most probably .wav files ). Mixing here means, output file will sound like two audio files are being played at same time and not concat.
Adding audio to video.
Thanks in advance.
I tested the StageFright record sample (frameworks/base/cmds/stagefright/record) to create a mpeg2 TS file. While it can be played on Android default Media player, it cannot be played in Windows Media Player or MPlayer. Any suggestions?
Note that I modified the original record sample source to create MPEG-TS file instead of MP4 file.
Which codec you used to create the mpeg2 TS file. May be difference in the codec used is the problem.