Mplayer

From init Q

Jump to: navigation, search

Contents

Introduction

MPlayer is a movie player which runs on many systems. It plays most MPEG/VOB, AVI, Ogg/OGM, VIVO, ASF/WMA/WMV, QT/MOV/MP4, RealMedia, Matroska, NUT, NuppelVideo, FLI, YUV4MPEG, FILM, RoQ, PVA files, supported by many native, XAnim, and Win32 DLL codecs. You can watch VideoCD, SVCD, DVD, 3ivx, DivX 3/4/5, WMV and even H.264 movies.

Another great feature of MPlayer is the wide range of supported output drivers. It works with X11, Xv, DGA, OpenGL, SVGAlib, fbdev, AAlib, DirectFB, but you can use GGI, SDL (and this way all their drivers), VESA (on every VESA compatible card, even without X11!) and some low level card-specific drivers (for Matrox, 3Dfx and ATI), too! Most of them support software or hardware scaling, so you can enjoy movies in fullscreen. MPlayer supports displaying through some hardware MPEG decoder boards, such as the Siemens DVB, DXR2 and DXR3/Hollywood+.

MPlayer has an onscreen display (OSD) for status information, nice big antialiased shaded subtitles and visual feedback for keyboard controls. European/ISO 8859-1,2 (Hungarian, English, Czech, etc), Cyrillic and Korean fonts are supported along with 12 subtitle formats (MicroDVD, SubRip, OGM, SubViewer, Sami, VPlayer, RT, SSA, AQTitle, JACOsub, PJS and our own: MPsub). DVD subtitles (SPU streams, VOBsub and Closed Captions) are supported as well.

Info

It is always best to compile mplayer and we always do that on linux machines. On the download page the mplayer site now has downloads for windows.

Download

http://www.mplayerhq.hu

Debian downloads

Please check http://debian-multimedia.org for debian apt-get source.

Playing DVD's

D:\mplayer dvd://1 −dvd-device G:\ -slang en -alang en
$ mplayer dvd://1 −dvd-device /dev/cdrom -slang en -alang en

Looping

Use the -loop flag to loop songs like beats or samples. the number indicates the number of loops, Zero means forever. If you don't want any gaps then put the -loop flag at the end.

mplayer disco.mp3 -loop 0

Encoding

This section will tell you the easiest and simplest way to do a quick and easy rip from dvd to xvid.

Find out which part and language you want

mplayer -alang en dvd://1 -dvd-device /mnt/cdrom

Keep changing the <1> to a higher number until you get to the desired movie.

Make the right crop

mplayer -ss 60 -vf cropdetect dvd://1 -dvd-device /mnt/cdrom

Find the part in parentheses, that will be your crop dimensions. example (720:432:0:72).

Encode

$ mencode -alang en dvd://1 -dvd-device /mnt/cdrom -ovc xvid -xvidencopts pass=1 
-oac mp3lame -vf crop=720:432:0:72 -o movie.avi
$ mencode -alang en dvd://1 -dvd-device /mnt/cdrom -ovc xvid -xvidencopts pass=2:bitrate=-700000 
-oac mp3lame -vf crop=720:432:0:72 -o movie.avi

With -700000, mencoder will calculate the bitrate for you that comes very close to 700 meg.

Convert wmv to avi

$ mencoder infile.wmv -ofps 23.976 -ovc lavc -oac copy -o outfile.avi

Subtitles

Matroska file format detected.
VIDEO:  [avc1]  864x480  24bpp  23.976 fps    0.0 kbps ( 0.0 kbyte/s)
SUB: Could not determine file format
Cannot load subtitles: file.ass

The remedy: 1. Convert the ASS file to UTF-8 (or whatever encoding you are comfortable with). I used iconv:

  • iconv -f utf16 -t utf8 < file.ass > result.ass

2.Play it by using the "-utf8" switch of mplayer: mplayer -sub file.ass -utf8 file.avi. If the ASS contains special characters (such as CJK chars), use a good font by "-font /usr/share/font/cjk.ttf"

DVD Ripping

mencoder dvd://1 -ofps 23.976 -ovc lavc -lavcopts vcodec=mpeg4:v4mv:mbd=2:trell:vbitrate=900:vpass=1:turbo=1 
-oac copy -o /dev/null
  • mencoder dvd://1 This tells mencoder to play track 1 of the dvd
  • -ofps 23.976 This is specifing the typical NTSC DVD framerate. Read sections 8.2.x for more details on NTSC, interlaced and telecine
  • -ovc lavc This is saying we are going to use the libavcodec family as our "output video codec, ovc"
  • -lavcopts vcodec=mpeg4:v4mv:mbd=2:trell This is telling mencoder, that the libavcodec options are, use mpeg4 (aka Divx5) as our encoding codec, use the 4 motion vectors (per macroblock) option, use the highest setting of the Macroblock decision algorithm (mbd), also use Trellis quantization during the encoding process.
  •  :vbitrate=900:vpass=1:turbo=1 This means our bit rate is 900, this is the first video pass, and "turbo" is enabled, turbo only works on the first pass, rather when used with vpass=1
  • -oac copy -o /dev/null This tell mencoder that the output audio codec (oac) is an exact copy of the audio stream, -o = output file name, and outputting to /dev/null is the "bit bucket" nothingness.
Second pass
mencoder dvd://1 -ofps 23.976 -ovc lavc -lavcopts vcodec=mpeg4:v4mv:mbd=2:trell:vbitrate=900:vpass=2 
-oac mp3lame -lameopts vbr=3 -o Something-About-Mary.avi
  • Almost everything is the same
  • vpass=2 this time as it's the second pass
  • -oac mp3lame -lameopts vbr=3 The output audio codec is mp3lame, it's options are variable bitrate equals 3 (bitrate is 128 with this setting)
  • -o Something-About-Mary.avi is the output file name

Interlaced DVD's, Tv Series, Catoons and other Animation

mencoder dvd://1 -vf pp=md -ovc lavc -lavcopts vcodec=mpeg4:v4mv:mbd=2:trell:vbitrate=900:vpass=1:turbo=1 
-oac mp3lame -lameopts vbr=3 -o Invader-Zim.avi
  • -vf pp=md video filter is pp=md (post-processing median deinterlacer)
  • -oac mp3lame -lameopts vbr=3 -o Invader-Zim.avi With this cartoon series, the deinterlacing filter does a fine job of creating a good quality rip on the first pass. Most cartoons tend to have solid colors, more stationary objects/backgrounds etc... that make it less difficult for mencoder to process the data. The first pass doesn't have to go to /dev/null, you can overwrite the file by using the same name on the next pass, or renaming the output file, and then maybe compare a first pass to a second/third pass.

Rescaling movies

mencoder input.mpg -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell \
-vf scale=640:480 -o output.avi

Join Movies

mencoder -oac copy -ovc copy -idx -o output.avi video1.avi video2.avi video3.avi

Extra Help

Personal tools