Video encoding
Contents
Foreword
AMV format is the video format used by the video enabled S1mp3s. This pages list tips to encode videos to AMV format in order to get the best results.
Pre-converting videos with virtualDUB
You can check VirtualDub corrections, and also SUPER.
Video encoding tips
- The "middle" framerate is of inferior quality! It drops frames unevenly, the video "jumps" every second or so. Go to "high" instead. If you need a small file no matter what, just go to "low".
- Make some VirtualDub corrections: crop, rescale, sharpen, adjust levels. Deliver an uncompressed format to the AMV converter.
- Another option (faster than preprocessing with VirtualDub first) is to install the ffdshow filters, configure them (both audio and video) to process RAW input, then configure the needed filters: resize, sharpen, crop, normalize / max audio, etc. These filters will be applied in real-time before the file is played by the encoder, at the cost of much more CPU power, but with the advantage of not having to preprocess first.
EDIT: Actually, the "video jumping issue" is resolved by modifying the source video frame rate. Any multiple of 8, larger than 16 will do perfectly for a frame rate. I'm not sure of the reason, but it has something to do with the frame rate downsampling algorithm of the AMV encoder. Most of the time I go with 24 or 23.976 FPS for the smoothest possible playback. I've tried 32+ FPS also but there's only a small improvement at the cost of a lot more time needed for encoding. For the FPS adjustment use VirtualDub as mentioned above.
- The focus thing works best when put to mode0. If you want to zoom the video, crop it with VirtualDub for a much better quality.
- Always encode video in the exact same resolution as the screen of your player. If it's smaller it can get either too tiny or too blurry when automaticly resized. If it's bigger it'll get choppy. If the aspect ratio doesn't match the screen ratio of your player, make the video fit on width and add a black frame. That'll preserve the proportions of the video when played.
- Some VirtualDub tips:
- For such small resolutions it's best to use the Lanczos3 algorithm when resizing. The results are a little bit better compared to the other resizing methods.
- You can also add subtitles to movies using the subtitler plugin. You'll need Sub2SSA or Srt2SSA to convert the subtitles to the Sub Station Alpha format. Use simple and clean fonts not bigger than 8-12 px depending on the screen size and resolution of your player, such as Arial/Arial Narrow, Tahoma and Segoe.
- There are no universal settings for anything, so make sure to preview the filtering before finally encoding.
Audio encoding tips
It doesn't matter what audio compression (mp3, pcm, wma, ac3) is used in your video, it gets decoded and re-encoded to AMV format. While encoding, the AMV tool downsample the audio to 22khz, Mono, 8 bits.
If you want a very small file, then you can downsample your audio (ie. VirtualDub), to 16, 11 or 8 khz or no audio at all.
How to encode on Unix or Linux
Linux support
There is Open Source implementation of decoder written in perl for this format. See this blog post with announcement.
There is also AMV codec tools for the S1mp3 players which is currently fork of ffmpeg to support encoding into amv format.
Using amv-ffmpeg by Google
Download amv-ffmpg-linux by Google [1]. Make the file executable. Open a terminal and navigate to the directory where you have put this file and execute
./amv-ffmpeg-linux-i386-20071030.sh -i INPUTFILE -r 16 -qmin 3 -qmax 3 -s 160x120 -mbd 2 -g 1 -ac 1 -ar 22050 OUTPUT.amv
(replacing INPUTFILE by the file you want to convert)
Note: This native solution works well for most movies. Some files and mp4-players may require special parameters. Refere to the download page for further details.
Using media-convert online service
A quite user-friendly method to create amv's (works from every pc without installing software and also with mac) is to use the online service of www.media-convert.com.
There you can upload your videos and select amv as output format. After a while a converted download-file is ready for you.
Note that this is not recommended for large files (limit 150MB) and is quite slow.
Using AMV converter with wine
This has been tested in Wine (0.9.7 and later), but you need to install Windows Media Player 9 (not 10) first.
Follow these steps:
- You will first need msxml.dll, quartz.dll and qedit.dll (google for the files and copy to ~/.wine/drive_c/windows/system32) and run regsvr32 msxml.dll && regsvr32 qedit.dll. If msxml.dll fails to register, you need a different version (the one that depends on msxmlr.dll can't be used).
- Run winecfg and add a native DLL override for qedit.
- (Probably not necessary for Wine 0.9.7 and later) Run winecfg and add native DLL overrides for msiexec.exe and msi (exactly as spelled).
- (Probably not necessary for Wine 0.9.7 and later) Install Windows Installer by running the InstMsiA.exe that comes with the MP3 Player Utilities, after setting Windows version in winecfg to Win98.
- Download and install WMP 9 (MPSetup.exe). Don't worry if it doesn't start.
- Install the MP3 Player Utilities by running the setup.exe or similar installer.
- Install other codecs for XviD/DivX etc (e.g. ffdshow) so you can convert AVI files.
Things to note about using AMV tools:
- The Settings window (to change encoding settings) doesn't display unless you press the Alt key (or possibly Alt-Tab) TWICE. Very weird.
- The AMV convert tool uses CPU time when displaying progress so minimise the window when converting so it doesn't get slowed down.
- You might not be able to change the output folder. The default is "C:\" (i.e., ~/.wine/drive_c).
(original on the forums by trisk)
Subtitles
Convert movie to amv with subtitle - Converting movies to AMV with subtitle, without VirtualDub. under windows.
Format error
On the 128X128 resolution (and 160x120 at 1.8" players), with CHIPTYPE=1, any compressed video like DivX, XviD or WMV will show format error on the player. But videos like VCD or Uncompressed AVI can convert and play normally. Remembering that with CHIPTYPE=0, the FPS is 16.
But with the same resolution on CHIPTYPE=0, any video can convert and play, but it jumps every second, using high FPS.
The videos that show format error can play normally on AMV Player on the PC.
The problem can also be solved by use VirtualDub to preprocess .avi file. For example standard TV-like file with 4:3 size ratio prepared for 1.8" player (160x120 max resolution) should be resized to 140x105 resolution and surrounded by monocolor border (black, white, blue or anyone other) to full 160x120 resolution. You can make that with VirtualDub "resize" included filter. This trick shows clearly, that origin of "Format error" problem is in to big bitrate for proper work of ATJ2085W (the MP4 main board processor) with full-size AMV files.
Another option for solving the "format error" issue is to first cut the movie in (approximately) 45-minute parts, using software like VirtualDub or Avidemux. If it came in 60-minute parts, you might need to join it first, then split it again.
But, with Matroska media files (extension .mkv), there might be some error on the converted video, or it won't convert at all. The recommended way is to install the appropriate codecs (like Haali Media Splitter) and it will probably solve the problem. If there are subtitles in the video file, it might not show due to the the embedded fonts feature in .mkv files. This can be solved by converting the .mkv video into another format such as .avi.
Correcting bugs on amv conversion tool
If you are having problems with the files generated by the conversion program (upside down, mirrowise, wrong size), you may try to change these .ini files located on the instalation folder of the mp3 utilities.
Editing AmvTransform.ini
You can try these operations:
BMPADJUST=0 - Normal BMPADJUST=1 - Flip vertical BMPADJUST=2 - Flip horizontal (mirror) BMPADJUST=3 - Rotate 180 degrees BMPADJUST=4 - Rotate 90 degrees clockwise BMPADJUST=5 - Rotate 90 degrees counterclockwise
If changing BMPADJUST does not work, change this from 0 to 1
[Option] [...] CHIPTYPE=1
Editing transformsetup.ini
To encode a large video (1.8" players), open transformsetup.ini and change 96*64, 128*96 or whatever it is to 160*120 and save. Then open the converter program and convert your video file like you usually do but do NOT go into settings, it will change it back to the stock sizes. Other sizes besides 160x120 do not work.
Related pages
- AMV - About the AMV movie format
- MTV - About the MTV movie format
- Examples of MP4 Players from the Chinese Electronics Wholesaler Chinavasion
- Play Small Videos on Snow Leopard