i want to build a app having video editing feature.
These are what I need:
Mix a new sound track(mp3) into a mp4.
Adjust sound volume proportion for original mp4 sound track and the new sound track.
Generate mp4 from images.
Remove some frames from mp4.
I've found FFMEPG but it's quite complicated.
Is there a easier one?
1.Mix a new sound track into a mp4.
2.Adjust sound volume proportion for original mp4 sound track and the new sound track.
--> Use MP4Parser for adding and removing audio tracks.
checkout this link http://code.google.com/p/mp4parser/
3.Generate mp4 from images.
4.Remove some frames from mp4.
--> Use JCodec to get all frames from mp4 or create mp4 from frames,
checkout this link http://jcodec.org/index.html
I think you are looking for JavaCv which wrapps OpenCV, FFmpeg, libdc1394, PGR FlyCapture, OpenKinect, videoInput, ARToolKitPlus, and flandmark. You can easily create video editing application using this.
Related
There is some good documentation on this site called big flake about how to use media muxer and mediacodec to encode then decode video as mp4, or extract video then encode it again and more stuff.
But it doesnt seem that there is a way to encode audio with video at the same time, no documentation or code about this. It doesn't seem impossible.
Question
Do you know any stable way of doing it that will work on all devices greater than android 18?
Why no one implemented it, is it hard to implement?
You have to create 2 Mediacodec instances, one for video and one for audio and then use MediaMuxer to mux the video with audio after encoding, you can take a look at ExtractDecodeEditEncodeMuxTest.java and at this project to capture camera/mic and save to mp4 file using Mediamuxer and Mediacodec
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 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!
Is there anything that does the opposite of a MediaExtractor on android?
Take one or multiple streams from MediaCodecs (e.g. 1 video and 1 audio)
and package them in a container format for streaming or writing to files?
Looks like the answer is no.
Mostly because of the underlying API is designed for video streaming and not for video compression.
Writing encoder's output to file you'll get raw h264 file. Which can be played using mplayer or ffplay for example.
Also ffmpeg can be used to mux this raw file into some container. But first of all you need to build ffmpeg for android.