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:
public void convertVideo(String input, String output) throws IOException, InterruptedException
{
String args = ffmpeg + "-i" + input + "ffmpeg encoding paramaters..." + "-f mp4" + output;
Runtime r = Runtime.getRuntime();
Process p = r.exec("/system/bin/sh" + "-c" + args);
p.waitFor();
}
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!