Convert any video to AMV format using ffmpeg – For use with Chinese portable media players

Yes, really AMV format – the bane of many Chinese portable media players… Using Nautilus Actions Configuration, FFMEG, FFMPEG AMV Codec Tools

Sometime last year, I needed a tough portable media player that I could use with my electronic projects. I bought the Zebronics Zebmate Cinema 1.8 player thinking that I was getting 8 GB space and video playing ability for Rs. 1600. The touchscreen is resistive, not capacitative, but that exactly fits my needs. Ordinary users will not like the player and should steer clear of this device. The menu interface is difficult.

The Zebronics Zebmate 1.8 portable media player has a resistive screen and will not work with any video format except the obscure AMV

It will play videos in only one format – AMV. No video converter that I have in Linux and Windows supports this format. On my Linux system, I have a custom-compiled ffmpeg installation that I thought covered everything. Surprisingly, it did not support AMV. There was a Google Code project titled “amv-codec-tools” that seemed to tailor-made for my requirement. I installed that but the video that it generated was full of artifacts. I had given up.

Today, I tried several Windoze software but all the video files they generated gave a “Format Error” message. I then decided to give ffmpeg-amv another attempt. Apparently, the guys who coded this tool seem to be all-Windows folk. The video does not accept OGV or other new formats. When I tried converting a WMV file with ffmpeg-amv, it produced a AMV video file that played both on Linux and the player without any issues. Totem Media Player does not play AMV but not so with VLC. VLC plays everything.

Here is how you convert any video file to AMV in Linux:

  1. Compile and install FFMPEG as per the guide at https://trac.ffmpeg.org/wiki/UbuntuCompilationGuide
  2. Install amv-codec-tools from http://code.google.com/p/amv-codec-tools/
  3. Use your regular FFMPEG executable to convert your existing videos (be they FLVs or MP4s) to WMV.
    ffmpeg -i "to-be-converted.mp4" -qscale 2 -vcodec msmpeg4 -acodec wmav2 wmv-converted.wmv
    
  4. Use ffmpeg-amv to convert the resultant WMV file to AMV format
    ffmpeg-amv -i "wmv-converted" -f amv -s 160x120 -r 16 -ac 1 -ar 22050 -qmin 3 -qmax 3 converted.amv
    

animation-chinese-amv-player-videos

UPDATE: I then wrote a Nautilus Actions Configuration. That way, I can just right-click any video file and then convert it to AMV. I use two BASH scripts so that I can monitor the conversion process in a Terminal window. The first bash script opens the terminal window and executes the second bash script inside it. The script converts the file first to WMV and then converts the WMV file to AMV format. After this conversion, the script deletes the WMV file leaving only the AMV file on the desktop.

amv-convert-na.txt
gnome-terminal -x sh -c "bash $HOME/Scripts/amv-convert.txt ""$1"""
amv-convert.txt
sWMVFile=$(basename "$1")
sWMVFile=$HOME/Desktop/${sWMVFile%.*}.wmv
sAMVFile=${sWMVFile%.*}.amv

ffmpeg -i "$1" -qscale 0 -vcodec msmpeg4v2 -acodec wmav2 "$sWMVFile"
ffmpeg-amv -i "$sWMVFile" -f amv -s 160x120 -r 16 -ac 1 -ar 22050 -qmin 3 -qmax 3 "$sAMVFile"

rm "$sWMVFile"
read -p "Press Enter to quit" oNothing

Use this filter for Caja Actions or Nautilus Actions Configuration: *.3gp;*.asf;*.avi;*.dat;*.flv;*.ogv;*.ogm;*.mov;*.mp4;*.mpg;*.mpeg;*.mp4;*.swf;*.webm;*.wmv

screenshot-nautilus-actions-configuration-convert-any-video-to-amv-format

Advertisements
This entry was posted in news. Bookmark the permalink.