Convert Video to 3GP Mobile Format with FFmpeg
This article provides a quick overview and practical guide on how to use the FFmpeg command-line tool to create 3GPP (3GP) compatible video containers. You will learn the specific video and audio codecs required for 3GP compatibility, the constraints of the format, and the exact FFmpeg commands needed to convert modern video files into formats playable on legacy mobile devices.
Understanding 3GP Compatibility Constraints
The 3GP container format was designed for 3G mobile phones to deliver media over high-latency and low-bandwidth networks. To ensure a 3GP file plays correctly on a mobile device, you must adhere to strict codec, resolution, and bitrate constraints:
- Video Codecs: Typically H.263 or MPEG-4 Part 2.
- Audio Codecs: AMR-NB (Narrowband), AMR-WB (Wideband), or AAC-LC.
- Resolution: Usually limited to QCIF (176x144) or QVGA (320x240).
- Framerate: Typically 15 or 30 frames per second (fps).
Command 1: Maximum Compatibility (H.263 + AMR-NB)
For older, legacy 3G mobile devices, the safest combination is the H.263 video codec paired with the AMR-NB audio codec.
Use the following FFmpeg command:
ffmpeg -i input.mp4 -c:v h263 -s 176x144 -r 15 -b:v 128k -c:a libopencore_amrnb -ar 8000 -ac 1 -ab 12.2k output.3gpParameter Breakdown: * -i input.mp4:
Defines the source video file. * -c:v h263: Sets the video
encoder to H.263. * -s 176x144: Resizes the video to QCIF
resolution (essential for older devices). * -r 15: Sets the
video frame rate to 15 fps. * -b:v 128k: Restricts the
video bitrate to 128 kbps. * -c:a libopencore_amrnb: Uses
the AMR-NB audio encoder (requires FFmpeg to be compiled with
--enable-libopencore-amrnb). * -ar 8000: Sets
the audio sampling rate to 8000 Hz (required for AMR-NB). *
-ac 1: Downmixes audio to a single channel (mono). *
-ab 12.2k: Sets the audio bitrate to 12.2 kbps.
Command 2: Better Quality (MPEG-4 + AAC)
If the target mobile device is slightly newer and supports higher-quality media, you can use the MPEG-4 video codec paired with AAC audio. This allows for higher resolutions and better audio fidelity.
Use this command:
ffmpeg -i input.mp4 -c:v mpeg4 -s 320x240 -r 25 -b:v 300k -c:a aac -ar 22050 -ac 1 -b:a 48k output.3gpParameter Breakdown: * -c:v mpeg4: Sets
the video encoder to MPEG-4. * -s 320x240: Scales the
resolution up to QVGA. * -r 25: Increases the frame rate to
25 fps. * -b:v 300k: Increases video bitrate to 300 kbps
for better image quality. * -c:a aac: Uses the native
FFmpeg AAC audio encoder. * -ar 22050: Sets a higher audio
sampling rate of 22050 Hz. * -b:a 48k: Allocates 48 kbps to
the audio track.