"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects." (Robert A. Heinlein)

Monday, 12 October 2009

Converting videos to AMV format using Linux

Many cheap, “made in China”, MP3 players also have video playing capabilities. In spite of the low display quality these devices can be used to view in a satisfying way many low quality videos like for example Youtube videos.
Unfortunately the video format used, identified by the AMV or by the MTV extension, is out of common video format standards because specifically studied to be suitable to very low-end hardware. In addition conversion software provided with the players is Windows-only (and often a little buggy).
I recently discovered how to use Linux to convert videos to AMV video format. (It's a recent discover only to me since the project is dated 2007)


The conversion program I used is essentially a patched version of the ffmpeg video conversion tool and can be downloaded from here. Once downloaded all I had to do was enable it to execution, rename (just for commodity) and move it in a suitable folder.
mv amv-ffmpeg-linux-i386-20071030 amv-ffmpeg
chmod +x amv-ffmpeg
mv amv-ffmpeg /usr/bin/
I also installed a Youtube download tool
sudo apt-get install youtube-dl
So to convert a video all I have to do is to download it
youtube-dl http://www.youtube.com/watch?v=ZOwHiGCzZjo

and convert it with these parameters
amv-ffmpeg -i ZOwHiGCzZjo.flv -f amv -s 160x120 -r 16 -ac 1 -ar 22050 -qmin 3 -qmax 3 ZowHiGCzZjo.amv
the video resolution parameter can change with the device display capabilities while the remaining parameters seems to be the only supported by the devices.