TM-Tube :: Video conversion tutorial (by gecko235)

General information


The best quality can be achieved by using the H264 or the WMV9 codec. Use a resolution of 1280x720 and a framerate of 30 fps. The bitrate for encoding should be between 5 and 17.5 Mbps depending on the complexity of the video. For best audio quality use AAC/MP3/WMA with a sampling frequency of 44 KHz and a bitrate of 256-320 Kbps.
Note: Neither higher FPS nor an extreme high resolution gives you better quality. Whenever the encoder on the server needs to do much conversion you will have an equal big quality loss.

Exporting from TrackMania


For exporting from TM and for storing videos, you should always use the following codecs: Huffyuv/Lagarith (Huffyuv/Lagarith are true lossless codecs), Indeo 5.2 (100% quality) or x264 (lossless profile). Note, that the files get pretty big with these :) Try to keep the same base configuration through the whole creation process (1280x720@30FPS) so you don't lose quality or the aspect ratio.

Optimal settings


» H264
Make use of H264 profiles and levels, they exist for a good reason. For 720p use the "High" profile and the "3.1" level if you can choose them. They set paramters and limits which are best suited for 720p video at 30fps. For "normal" videos you can use from 5 to 10 Mbps. If there are a lot of movements/changes/effects, something between 10 an 17.5 Mbps may be better. The video should be clean and smooth before the upload (it is possible that your processor won't show the video lag-free, but everything from a Core2Duo/Athlon X2 should run without problems).
If you do not have Adobe Premiere or other software with an included H264 Codec, use the opensource x264vfw codec.
In Premiere and Vegas you should always choose 30 Frames-per-second or "FPS", "progressive" for Field Scan and "1" or "squared" for Pixel Aspect Ratio. You also want to make a "twopass" variable bitrate encoding (VBR) to ensure high quality, and set the "Average" or "Target" bitrate to what is suited best for you. Set the maximum bitrate 20% higher than the target bitrate. Never set keyframes manually! H264 is intelligent enough to decide on it's own when to use them.
For x264 VFW go to the third tab and set the number of threads to the number of CPU cores your computer has. To encode in a twopass encoding you have to export the video the first time with the option "Multipass - 1st pass" set the bitrate to the desired bitrate. When the encoding is finsihed, you will see 2 files. A .mp4 (can be different, depending on your software) and a .stats file. Do not tamper with them, they contain important information for the encoder! Just export your video again to the same file but change the x264 mode to "Multipass - Nth pass". When the second encoding is finsihed, check your video file. All other settings for the VFW codec are already good, there is no need to play with them. If you can set keyframes in your video-editing software, don't set them ;)

 

» WMV
For WMV in Adobe and Vegas use always the Windows Media 9.x codecs, both audio and video. There are almost the same settings like for H264, so read the text above :) If you are not sure about a setting, let it at it's default value. Especially the keyframe setting which is 1 keyframe every 5 seconds and the buffer size which is 20 seconds. Since encoding with a WMV VFW interface is a pain in the **s it won't be covered here. But many applications support it.



» FLV
Flash video is already deprecated and shouldn't be used anymore. It is also very inefficient :)

» DIVX/XVID
The DivX codec family can be used too, but they are specialized for movie content. Thus there will always be problems with videogame content at high resolutions. If you have a codec version and setting that works good for you, consider yourself lucky and share that information with other users.


For experts: MEncoder tutorial (for best results) - by X2X

First of all I have to say, that MEncoder is a command line interface tool, which means, that it doesn't have a graphical user interface. So it is a little bit more work, but the final results are very good. Just follow the instructions completly and nothing should go wrong ;)

First of all, you need to download MEncoder. You can grab it from here: http://sourceforge.net/projects/mplayer-win32/files/
Use the package called MPlayer-athlon-svn-29355.7z (revision number can differ) and extract it somewhere on your hard drive.
If that version doesn't work for you, you may try the old revision used for that tutorial: http://www.tm-tube.com/downloads/MPlayer-athlon-svn-29355.7z



Now you have to download the codec package: http://www.mplayerhq.hu/MPlayer/releases/codecs/windows-essential-20071007.zip
If the codec of your source file isn't available in this package, use the additional codecs package: http://www.mplayerhq.hu/MPlayer/releases/codecs/windows-all-20071007.zip
Extract the files located in the folder windows-essential-20071007 to the "codecs" folder of your MEncoder installation.

To make it easier, put your source video into the MEncoder directory. Now hold the windows button on your keyboard and press R (alternatively you can click on Start » Run). Type in cmd and click OK.



Now you have to locate to your MEncoder installation. Type cd C:\MEncoder for example. If your MEncoder installation is on another drive than C, just type D: (for example) after executing the cd command.



Now the encoding process can start. Type in the following command for the first pass:
mencoder.exe sourcevideo.mp4 -o tempvideo.mp4 -oac copy -ofps 30 -of lavf -ovc x264 -x264encopts cabac:bitrate=5000:subq=1:8x8dct:frameref=1:threads=auto:bframes=3:b_pyramid:weight_b:pass=1 -lavfopts format=mp4 -vf harddup,scale=1280:720



The marked parts of the commands may be changed regarding your source file and the bitrate you want to use in your final video.
In your MEncoder directory there is now a file called divx2pass.log - don't remove it, you'll need it for the second pass. The file tempvideo.mp4 is crap and can be removed.
No let's start with the second pass, type in the following command:
mencoder.exe sourcevideo.mp4 -o finalvideo.mp4 -oac mp3lame -lameopts cbr:br=128 -channels 2 -srate 44100 -ofps 30 -of lavf -ovc x264 -x264encopts cabac:bitrate=5000:subq=6:8x8dct:frameref=8:partitions=all:me=umh:threads=auto:global_header:bframes=3:b_pyramid:weight_b:pass=2 -lavfopts format=mp4 -vf harddup,scale=1280:720



You can change the marked parts to gain better quality (see the tutorial of gecko235 above or this page for further details on the particular settings).
Now you should have a great looking video which should still look great after uploading it on TM-Tube ;)