I'm looking for a way to convert 3gp to mp4 in Android. I'm using the device's camera through 'MediaStore.ACTION_VIDEO_CAPTURE', and the video is transferred to my server. My server allows only mp4 files. Almost all devices save video as a mp4 files, but some devices save as a 3gp file. So, I have to convert 3gp to mp4 for some devices.
Please help!!
You can pretty easily use ffmpeg via a shell command with java's Runtime.getRuntime().exec(...) to convert your video from 3gp to mp4. Get the ffmpeg binary for arm devices (the majority of android devices) here: https://www.dropbox.com/s/nxjnrb71qdrq5jn/ffmpeg.zip?n=138005726. You'll want to package this with your rom, detect when a file is 3gp, and then use ffmpeg to convert it to mp4 before uploading it to the server.
To execute the binary in your java code, you'll want to make a method like this where input is the location of input video, output is the location of output video, and fmpeg is the location of the ffmpeg binary you include:
Your ffmpeg command parameters may need to be optimized for a target video size. I would also build a static x86 ffmpeg for the minority of x86 androids out there. Then you can detect the device architecture with the shell command "uname -a" and pick which one to use.
Hope this helps!