How to Transcode Video to H.263 with FFmpeg
This guide provides a straightforward tutorial on how to transcode video files into the H.263 format using FFmpeg. You will learn the specific command-line syntax required for H.263 encoding, resolution and framerate constraints inherent to the format, and a practical command-line example to convert your files for legacy system compatibility.
The Basic H.263 Transcoding Command
To transcode a video to H.263, you must use the h263
video encoder. Because H.263 is a legacy format designed for video
conferencing and early mobile devices, it has strict limitations
regarding resolution, framerate, and containers.
Here is the standard command to transcode a video to H.263:
ffmpeg -i input.mp4 -c:v h263 -s 352x288 -r 15 -b:v 300k -c:a libopencore_amrnb -ar 8000 -ac 1 output.3gpUnderstanding the Parameters
-i input.mp4: Specifies the source video file you want to transcode.-c:v h263: Selects the native FFmpeg H.263 video encoder.-s 352x288: Resizes the video. The H.263 standard only supports specific resolutions. The most common are QCIF (176x144) and CIF (352x288). If your input video is not set to one of these dimensions, the encoder will return an error.-r 15: Sets the framerate to 15 frames per second. H.263 requires standardized framerates (usually 15 or 29.97 fps).-b:v 300k: Sets the video bitrate to 300 kbps, which is typical for this format.-c:a libopencore_amrnb: Sets the audio codec to AMR-Narrowband, which is the standard audio pairing for H.263 in.3gpcontainers. Alternatively, you can use-c:a mp3if outputting to an.avicontainer.-ar 8000 -ac 1: Resamples the audio to 8000 Hz and 1 channel (mono), which is required by the AMR-NB codec.output.3gp: The output file. The 3GP and AVI formats are the most compatible containers for H.263 video.
Using H.263+ (H.263p) for Custom Resolutions
If you need to transcode video without being locked into strict
CIF/QCIF resolutions, you can use the H.263+ encoder (which FFmpeg
refers to as h263p). H.263+ allows for custom video
sizes.
ffmpeg -i input.mp4 -c:v h263p -s 640x480 -b:v 500k -c:a copy output.aviUsing h263p gives you more flexibility with resolutions
and container formats, but may reduce compatibility with older,
hardware-restricted legacy devices.