Candid’s brain

Encoding videos for Samsung mobile phones

Posted on: July 6th, 2010

I have tried around a bit with encoding videos to play them on my Samsung B2100 mobile phone. I could not find any information about which format it supported, no matter what video I tried to play, it said “Unsupported content”.

Then I tried to record a video on the mobile and encode a film with ffmpeg to match the container format, video and audio codec and bitrate and same resolution and framerate. The device still complained about “Unsupported content”.

So I looked for Samsung PC Studio (an official application by them to encode videos for Samsung mobile phones) and found it after hours of search in some corner of their website. It takes a huge amount of hard disk space, requires Windows and crashes regularly. But at least it managed to convert some WMV and AVI films (it couldn’t read MKV and MOV though). The resulting video was way too dark, but at least it was “supported content”.

“Supported content” has exactly these properties:

Filename
Not too long, ending in .mp4
Container format
MP4
Video format
mpeg4, 176×144, 95 kb/s, 15 fps
Audio format
aac (bitrate is variable, I use 64 kb/s, 128 kb/s also work)

The command to encode a video with ffmpeg is: ffmpeg -i <Input file> -s "176x144" -r 15 -ab 64k -acodec aac -strict experimental -b 95k -vcodec mpeg4 <Output file> (Note: I added the -strict experimental parameter later as ffmpeg 0.6 refused to use aac without it.)

This actually resizes your video to 4:3, which might not be desirable. I have written a small shell script to perform the conversion and adding black paddings to the sides to keep the correct aspect ratio. It needs bash, bc and ffmpeg. Usage:

  • video2samsung <Input file> <Output directory> – The encoded file will be placed inside he output directory, with .mp4 as extension. If no output directory is specified, the directory of the input file is used.
  • video2samsung <Input file> <Output file> – Specify the filename for the encoded video.