This is the followup of the More Video Compression series touching on the free, open sourced, fast, all-powerful…
Mplayer … ’s counterpart… Mencoder! And a little about converting to DVD/SVCD/KVCD.
First of all, do you have mplayer and mencoder?
Get it from http://www.mplayerhq.hu/design7/dload.html. Windows users, you can get win32 mingw32 ports from http://oss.netfarm.it/mplayer-win32.php. I think these ports are more optimised and faster.
Next, make sure you get the codecs you need. Fonts/skins/others are optional. Extract them to the correct directory. If you know how to play with those configuration files, do so.
Now windows mplayer user, here’s a tip to you. Never under-estimate what this command line/dos/linux style(whatever you call it) can do. First, its very portable. Zip them up and it takes maybe only 20+MB which plays almost any video format. Download a mega codec pack and its already tripple that size. Place it on your thumbdrive and you don’t even need any installtion to use. Remember the key bindings and you have a full control of media player at the keyboard. F for fullscreen, O for elapsed/total time, 9 and 0 for volume, D for frameskipping options, Q/Esc to escape, x/f for subs delay, up/down&page up/down, home/end for fastwarding/rewinding quickly.
Using mencoder
IIRC, I did cover this before, but only providing links to how to convert files. Example, using Easy Realmedia Producer, you converted all your media files to rmvb. Now you need to convert to some other common formats so 1) you can send to your friend 2) you want to burn it 3) copy into some media devices which dont support real media.
(I was at a shop and overheard this conversation that no devices can play rm. Not true I think, ngage can, and even a hacked ipod can do the job imho. A interesting equiment i found was a 2.5″ harddisk casing with capabilities to backup sd/cf cards, and ability to play media files, and tv output, using a recharable nokia battery. )
As mentioned before, MediaCoder is a powerful frontend to the free tools including mencoder which helps you convert to whatever format you want just using mouse-and-click.
Basic Mencoder Usage
mencoder convertme.rmvb -ovc lavc -oac mp3lame -o encoded.avi
This is what I call a simple, default encoding. “-o” specify the output file. mp3lame by default uses mpegII layer III compression, and ffmpeg libraries for video compression. The result, about 400mb for a vcd/60mins, in (ffmpeg’s)mpeg-4, for a very quick processing rate (400+fps? so maybe a mere 10mins job at 50% cpu on a hyperthreading machine) .
Next I’m teaching, is something quite primitive but still very useful for a windows user - batch files.
Open notepad, paste this in.
@echo off
echo Encoding %1
"J:\a\mencode\mplayer\mencoder.exe" %1 -quiet -ovc lavc -oac mp3lame -ffourcc XVID -o %1encoded.avi
pause
save it as Encoder.bat or something. Drag a video clip into the newly create bat file and see what happens. I used to place batch files in the SendTo folder (C:\Documents and Settings\User\SendTo), so I could right-click a file, and “send to” encoder.
line 1 @echo off means dont display the lines of code in the batch files.
line 2 echo Encoding %1 echo means display. %1 is the file which is dragged/passed to the batch file.
line 3 "J:\a\mencode\mplayer\mencoder.exe" %1 -quiet -ovc lavc -oac mp3lame -ffourcc XVID -o %1encoded.avi
“J:\a\mencode\mplayer\mencoder.exe” is the path to my mencoder. -quiet is used when you do not want to see the status of the encoding (estimated encoded filesize, encoding fps, time remaining) -ffourcc changes the FourCC or encoding codec identifier used in the file. By default its “FMP4″, mplayer’s encoding. However this identifier will cause encoded files to be unplayable by older players or codecs. Changing it to XVID allows any xvid decoder to playback the file. DX50, codename for DIVX5) can be used also. %1encoded.avi appends encoded.avi to the specified the encoded output file.
line 4: pause Pause the screen and waits for key to be pressed before terminating. You can see some final statistics from mencoder.
Happy encoding, remember, since it pretty fast, if you are on a dual/hyperthreading processor, you can run 2 encoding sessions at the same time.
NOTE: I was confused by MPEG4, DIVX, XVID, ffmpeg, libavcodec terms at first. Mpeg4 is standards for this video compression format. DivX was actually a hack to improved microsoft implmentation of mp4 format. Xvid is a open source mp4 implmentation, (was a reverse engineered DivX - spell it backwards?). ffmpeg is a set of tools (at first on linux) which record, convert and stream digital audio and video. Included is libavcodec, LGPLed C coded codec libraries which encode&decode video&audio.
Dare to try more challenging switches?
-ovc copy -oac copy -ffourcc XVID is for “fixing” any files you encoded as “FMP4″.
-af channels=1 -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=400 -quiet -oac mp3lame -lameopts br=54:mode=2 -ofps 24 af does audio channel mapping. vbitrate sets video bitrate to 400kbits/s. br=54:mode=2, means mono at 54kbits/s for the audio. ofps is the output frame per seconds.
-oac copy -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:576,harddup -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=15:aspect=16/9 -ofps 25 -vobsuboutindex 2 is to produce a mpeg II, DVD compatible video format.
For more, RTM! (Read the Manaul). Check out
http://tivo-mplayer.sourceforge.net/docs/mplayer-man.html and
http://www.mplayerhq.hu/DOCS/HTML/en/index.html
Converting to DVDs.
Cut the long story short, try the free software Avi2Dvd Yeah it supports dvd and svcd/kvcds.
Back on topic, using mencoder to convert?
Check http://wiki.clug.org.za/wiki/Making_DVD/SVCD/VCD’s_under_Linux using open source software to author a dvd.
http://gentoo-wiki.com/HOWTO_Mencoder_Introduction_Guide A very good walkthrough on mencoder also touches on dvd conversion.
As for how to burn using free tools, (eg. CD-R tools, CDBurnerXP pro), I havent figured that yet and am now in a rush. Maybe the next article in the series. Till then, tata.
Sidenote: If you are interested in creating subtitles, or manipulate them (like join, cutting, converting) try the free Subtitles Workshop or dl here.


Here are links to guide on using VLC to convert DVDs
http://wiredblogs.tripod.com/cultofmac/index.blog?entry_id=524404
http://software.newsforge.com/article.pl?sid=06/04/19/1711245&from=rss