Since the early days of cameraphones, common 3GP video clips have been stored as QCIF-sized H.263 video and AMR-NB audio.
Video
QCIF (Quarter Common Intermediate Format) has a 174×144 dimension, and a 1.22:1 display aspect ratio. Having a squarer ratio comparing to normal 4:3 (1.33:1) and widescreen 16:9 (1.78:1) ratios, QCIF videos should be “padded” on top and bottom once converted from wider (nearly every other) sources.
Failing to properly pad a wider-than-QCIF video clip while converting to QCIF 3GP, you’ll end up with a squeezed video, meaning fat people will look thin, and cars will lose their proportions and look ridiculously tall.
Intervening precise height/padding calculations, FFmpeg requires even numbers for screen height, top padding, and bottom padding.
Height = Picture Height + Top Padding + Bottom Padding
Width = Height × Aspect Ratio
A standard 1.33:1 (4:3) video should be resized to 132 pixels in height and padded with 6 pixels in both top and bottom:
144 = 132 + 6 + 6
176 ≈ 132 × 1.33
A widescreen 1.78:1 (16:9) video should be resized to 100 pixels in height and padded with 22 pixels in both top and bottom:
144 = 100 + 22 + 22
176 ≈ 100 × 1.78
A flat widescreen 1.85:1 video should be resized to 96 pixels in height and padded with 24 pixels in both top and bottom:
144 = 96 + 24 + 24
176 ≈ 96 × 1.85
A CinemaScope 2.21:1 video should be resized to 80 pixels in height and padded with 32 pixels in both top and bottom:
144 = 80 + 32 + 32
176 ≈ 80 × 2.21
A wide cinema 2.35:1 video should be resized to 76 pixels in height and padded with 34 pixels in both top and bottom:
144 = 76 + 34 + 34
176 ≈ 76 × 2.35
Calculations Behind
Name | Aspect Ratio | Exact Dimensions | Calculations | Height | Paddings |
QCIF | 1.22:1 | 176×144.0000 | 144-144.0000=0.0000÷2=0.0000 | 144 | 0 |
Standard | 1.33:1 (4:3) | 176×132.0003 | 144-132.0003=11.9997÷2=5.9998 | 132 | 6 |
Widescreen | 1.78:1 (16:9) | 176×98.9998 | 144-98.9998=45.0002÷2=22.5001 | 100 | 22 |
Flat Widescreen | 1.85:1 | 176×95.1351 | 144-95.1351=48.8649÷2=24.4324 | 96 | 24 |
CinemaScope | 2.21:1 | 176×79.6380 | 144-79.6380=64.3620÷2=32.1810 | 80 | 32 |
Wide Cinema | 2.35:1 | 176×74.8936 | 144-74.8936=69.1064÷2=34.5532 | 76 | 34 |
The maximum H.263 video bit rate for a flawless playback in an early Nokia is 339 kbps and the best practice for the frame rate is to use half its original. That is 12.5 fps (25÷2) for PAL and 14.895 fps (29.97÷2) for NTSC videos. Please note cheap 3GP/H.263/AMRNB-enabled Nokia cameraphones shoot QCIF video at 14.929 fps / 142 kbps.
Audio
The audio compatible with early Nokia phones is the monaural AMR-NB (Adaptive Multi-Rate Narrow-Band) with sample rate of 8000 and bit rate of 12.2 kbps.
FFmpeg 3GP Conversion Command
Important parameters including the “-f 3gp” forces the output format to 3GP, “-s 176xHEIGHT” defines video dimensions, “-aspect 176:144” corrects QCIF aspect ratio, “-padtop PADDING” and “-padbottom PADDING” define top and bottom paddings, “-vcodec h263” forces the video codec to H.263, “-b BITRATE” specifies the video bit rate, “-r FRAMERATE” specifies the video frame rate, “-acodec libamr_nb” forces the audio codec to AMR-NB, “-ac 1” specifies mono-channel (monaural) audio, “-ar 8000” specifies the audio sample rate, and “-ab 12.2k” specifies the 12.2 kbps audio bit rate.
Sample FFmpeg command to convert a PAL 4:3 AVI file into 3GP (H.263/AMR-NB):
ffmpeg -i test.avi -f 3gp -s 176x132 -aspect 176:144 -padtop 6 -padbottom 6 -vcodec h263 -b 339k -r 12.5 -acodec libamr_nb -ac 1 -ar 8000 -ab 12.2k -y output.3gp
Sample FFmpeg command to convert an NTSC 16:9 MP4 file into 3GP (H.263/AMR-NB):
ffmpeg -i test.mp4 -f 3gp -s 176x100 -aspect 176:144 -padtop 22 -padbottom 22 -vcodec h263 -b 339k -r 14.895 -acodec libamr_nb -ac 1 -ar 8000 -ab 12.2k -y output.3gp
Download FFmpeg for Windows with AMR Support
To download an AMR-enabled FFmpeg for Windows, visit my FFmpeg SVN-r17988-Komeil for Windows blog post.
Thank you so much for this you saved me big time!
All the best.
Thank you for this information…
Really helps me a lot no question.