Linux Video Playback: Difference between revisions

From BakaBT Wiki
Jump to navigation Jump to search
m (just fixing some style things)
(Unbolded reasons for compiling, redid the config file, various minor fixes.)
Line 1: Line 1:
This article explains the best video playback options for Linux and provides installation instructions.
This article explains video playback options for Linux and provides installation instructions.


==List of recommended players==
==List of recommended players==
Line 6: Line 6:
==MPlayer==
==MPlayer==
===Compiling MPlayer from source===
===Compiling MPlayer from source===
The PREFERRED way of installing mplayer is compiling from source, due to the fact that every linux distro ships various levels of horribly outdated versions of it.
The preferred way of installing mplayer is compiling from source due to the fact that most Linux distros ship various levels of horribly outdated versions of it. The reasons for compiling from a new mplayer source are many:
the reasons for compiling from a new mplayer source are many:
* vdpau support, (gpu decoding)
;* vdpau support, (gpu decoding)  
* better ffh264 asm (faster decoding)
;* better ffh264 asm (faster decoding)  
* newer libass (better subtitle rendering)
;* newer libass (better subtitle rendering)
* no need for external windows codecs for some files anymore
;* no need for external windows codecs for some files anymore
* various bug-fixes
;* various bug-fixes


The preferred source repository among actual users is uau's git for the following reasons
The preferred source repository among actual users is uau's git for the following reasons
;* It has ordered chapters support (which a lot of modern dvd/bluray rips use)
* It has ordered chapters support (which a lot of modern DVD/bluray rips use)
;* It can be compiled with ffmpeg-mt (multithreaded decoding)
* It can be compiled with ffmpeg-mt (multithreaded decoding for multicore processors)
;* It uses svn libass, (even better subtitle rendering)
* It uses svn libass (even better subtitle rendering)
;* It's easier to compile
* It's easier to compile (Python scripts that set up your build environment)
;* It includes various fixes for bad mplayer behavior
* It includes various fixes for bad mplayer behavior


Howto compile for various distros is comming soon  
How to compile for various distros is coming soon, but cloning [http://repo.or.cz/w/mplayer-build.git this git repository] will get you started.
===Installing Mplayer from Distro reps===
 
===Installing Mplayer from distro repos ===
Perform the one of the following commands as root, depending on your distribution.
Perform the one of the following commands as root, depending on your distribution.
====Debian based distributions (Includes Ubuntu)====
====Debian based distributions (Includes Ubuntu)====
  aptitude install mplayer
  aptitude install mplayer
For additional codecs:
1. Visit http://debian-multimedia.org/ and add it as a package repository using the instructions in the red boxes.<br/>
2. sudo aptitude update && sudo aptitude install mplayer w32codecs
=====Ubuntu PPA=====
=====Ubuntu PPA=====
Usually the version in ubuntu default repos is pretty old, you might want to check [https://launchpad.net/ubuntu/+ppas PPA] for updated versions.
Usually the version in Ubuntu default repos is pretty old, you might want to check [https://launchpad.net/ubuntu/+ppas PPA] for updated versions.
 
====OpenSuse====
====OpenSuse====
  zypper in mplayer
  zypper in mplayer
Line 33: Line 38:
====Fedora/Red Hat based distributions====
====Fedora/Red Hat based distributions====
  yum install mplayer
  yum install mplayer
====Arch Linux====
====Arch Linux====
  pacman -S mplayer
  pacman -S mplayer
====Gentoo====
====Gentoo====
  emerge -ptva mplayer
  emerge -ptva mplayer
Line 45: Line 52:
3. Copy the codecs (but not the directory) to the MPlayer codec directory. Default is /usr/lib/win32<br/>
3. Copy the codecs (but not the directory) to the MPlayer codec directory. Default is /usr/lib/win32<br/>


Debian/Ubuntu users:<br/>
1. Visit http://debian-multimedia.org/ and add it as a package repository using the instructions in the red boxes.<br/>
2. sudo aptitude update && sudo aptitude install mplayer w32codecs
====NVidia vdpau====
====NVidia vdpau====
If you use nvidia GPU, be sure to install their latest binary drivers, as they offer offloading video decoding from CPU to GPU which provides far smoother playback, especially for h264 video, while keeping CPU usage at vero low level. Check your mplayer configuration to use both vdpau video codec (-vc) and video output (-vo). Type "mplayer -vo help" to list available outputs.
If you use nvidia GPU, be sure to install their latest binary drivers, as they offer offloading video decoding from CPU to GPU which provides far smoother playback, especially for h264 video, while keeping CPU usage at vero low level. Check your mplayer configuration to use both vdpau video codec (-vc) and video output (-vo). Type "mplayer -vo help" to list available outputs.
Line 56: Line 60:
These are some sample configuration files tailored for specific preferences. The MPlayer configuration file can be found at: (<tt>~/.mplayer/config</tt>)
These are some sample configuration files tailored for specific preferences. The MPlayer configuration file can be found at: (<tt>~/.mplayer/config</tt>)


 
For Japanese audio preference, subtitles on, with 4 audio channels for surround sound files.
For English audio preference, then Spanish<!--(?? Correct if wrong, delete this part otherwise.)-->, with 4 audio channels for surround sound files.  
# If no GPU-specific video output driver is available, xv is the best choice,
# followed by x11 (which doesn't not do software zooming unless passed "-zoom" or "zoom=1")
  vo=xv
  vo=xv
  ao=alsa
  ao=alsa
# 4 audio channels for surround sound files
  channels=4
  channels=4
alang=en,es


For Japanese audio preference, subtitles on. SDL A/V output for performence.
# Default audio and subtitle tracks.
  ao=sdl
  alang=jp,jpn
  vo=sdl
  slang=en,eng
#Note: SDL video output does not work well with xinerama. Those wishing to watch video on a TV or other display should use "vo=xv"
  # Not all files use the correct tags, so sometimes it will be necessary to switch streams manually with '#' and 'j'
alang=jpn,Japanese
# or from the command line with "-aid x" and "-sid x", where "x" is the number of the stream.
  #Not all files use the correct tags, so sometimes it will be necessary to switch audio streams manually or from the command line with "-aid x", where "x"   is the number of the audio stream.
 
  sid=0
# Find ASS subs and use the fonts provided in the file if possible
ass=1
embeddedfonts=1
fontconfig=1
  # The highest level of subtitle anti-aliasing
spuaa=4
  subfont-autoscale=1
  subfont-autoscale=1
  ass=1
 
  # Less stdout text
quiet=1


====MPlayer Tricks====
====MPlayer Tricks====

Revision as of 20:33, 12 October 2009

This article explains video playback options for Linux and provides installation instructions.

List of recommended players

MPlayer

Compiling MPlayer from source

The preferred way of installing mplayer is compiling from source due to the fact that most Linux distros ship various levels of horribly outdated versions of it. The reasons for compiling from a new mplayer source are many:

  • vdpau support, (gpu decoding)
  • better ffh264 asm (faster decoding)
  • newer libass (better subtitle rendering)
  • no need for external windows codecs for some files anymore
  • various bug-fixes

The preferred source repository among actual users is uau's git for the following reasons

  • It has ordered chapters support (which a lot of modern DVD/bluray rips use)
  • It can be compiled with ffmpeg-mt (multithreaded decoding for multicore processors)
  • It uses svn libass (even better subtitle rendering)
  • It's easier to compile (Python scripts that set up your build environment)
  • It includes various fixes for bad mplayer behavior

How to compile for various distros is coming soon, but cloning this git repository will get you started.

Installing Mplayer from distro repos

Perform the one of the following commands as root, depending on your distribution.

Debian based distributions (Includes Ubuntu)

aptitude install mplayer

For additional codecs: 1. Visit http://debian-multimedia.org/ and add it as a package repository using the instructions in the red boxes.
2. sudo aptitude update && sudo aptitude install mplayer w32codecs

Ubuntu PPA

Usually the version in Ubuntu default repos is pretty old, you might want to check PPA for updated versions.

OpenSuse

zypper in mplayer

Fedora/Red Hat based distributions

yum install mplayer

Arch Linux

pacman -S mplayer

Gentoo

emerge -ptva mplayer


MPlayer codecs

Not all distributions include the full set of mplayer codecs in their repositories. To install the full set follow these easy steps.
1. Download: http://www4.mplayerhq.hu/MPlayer/releases/codecs/all-20071007.tar.bz2
2. Extract with: tar xvf all-20071007.tar.bz2
3. Copy the codecs (but not the directory) to the MPlayer codec directory. Default is /usr/lib/win32

NVidia vdpau

If you use nvidia GPU, be sure to install their latest binary drivers, as they offer offloading video decoding from CPU to GPU which provides far smoother playback, especially for h264 video, while keeping CPU usage at vero low level. Check your mplayer configuration to use both vdpau video codec (-vc) and video output (-vo). Type "mplayer -vo help" to list available outputs.

ATI

The upcoming (as of 2009.10.04) open source driver should provide hardware accelerated video decoding for R600+ based GPUs. This will happen probably sometime around linux 2.6.32 release.

MPlayer tweaks

These are some sample configuration files tailored for specific preferences. The MPlayer configuration file can be found at: (~/.mplayer/config)

For Japanese audio preference, subtitles on, with 4 audio channels for surround sound files.

# If no GPU-specific video output driver is available, xv is the best choice,
# followed by x11 (which doesn't not do software zooming unless passed "-zoom" or "zoom=1")
vo=xv
ao=alsa
# 4 audio channels for surround sound files
channels=4
# Default audio and subtitle tracks.
alang=jp,jpn
slang=en,eng
# Not all files use the correct tags, so sometimes it will be necessary to switch streams manually with '#' and 'j'
# or from the command line with "-aid x" and "-sid x", where "x" is the number of the stream.
# Find ASS subs and use the fonts provided in the file if possible
ass=1
embeddedfonts=1
fontconfig=1
# The highest level of subtitle anti-aliasing
spuaa=4
subfont-autoscale=1
# Less stdout text
quiet=1

MPlayer Tricks

MPLayer has a huge collection of filters included. Some of them are magical.

  • View styled subs, even if you only have plain subs:
    • mplayer -ass -embeddedfonts myvideo.ext
  • View external subs:
    • mplayer -ass -sub mysubs.srt myvideo.ext
  • Play interlaced video without combing:
    • mplayer -vf pullup myvideo.ext
  • Increase saturation and contrast:
    • mplayer -vf eq2=0.8 myvideo.ext
  • Remove "mosquito" noise:
    • mplayer -vf hqdn3d myvideo.ext
  • Make crappy video look good:
    • mplayer -vf pp7 myvideo.ext
  • Combine:
    • mplayer -ass -embeddedfonts -vf pullup,eq2=0.8,unsharp=l3x3:0.2,hqdn3d myvideo.ext

SMPlayer

MPlayer by itself is fine but SMPlayer provides an easy to use interface to MPlayer so it is a better choice for most. It contains a couple of nice features, including autosaving the playback position so you can continue watching your anime the next time you start it (this feature can be disabled of course). SMPlayer is not a player per se, it is just a GUI (QT) frontend for MPlayer, hence you still need MPlayer to actually play the video.

Installing SMPlayer

Debian/Ubuntu

If you are using Debian Lenny/Sid or Ubuntu Intrepid Ibex (8.10), then you can simply

sudo apt-get install smplayer

Otherwise, you have 2 options:

  • Download the .deb file from the SMPlayer website or
  • Add the SMPlayer repository to your /etc/apt/sources.list.

8.04 (hardy):

deb http://ppa.launchpad.net/rvm/ubuntu hardy main

8.10 (intrepid):

deb http://ppa.launchpad.net/rvm/ubuntu intrepid main

OpenSUSE

You can find .rpm's via the search page.

Fedora/RedHat

Build from source. See below.

Arch Linux

pacman -S smplayer

Gentoo

emerge -ptva smplayer

Building from Source (Compiling)

Grab the tarball from the SMPlayer download page. Decompress it, cd into the directory, and run

./configure
make
sudo make install

If you don't have sudo installed/configured, then the last step will be instead

su
make install

SMPlayer tweaks

After installation you'll need to configure it a little: Start SMPlayer, open the options (Ctrl + P), go to the subtitles section, within the section go to the SSA/ASS library tab and check the check box for using SSA/ASS library. With this you can see the subtitle's colors and fonts (Note: the used fonts must be installed on the system for this).

If you see a black screen at playing, or the colors doesn't seems to be right, or the playing is too slow or wrong you may need to change the video rendering mode. To do this go to the options, general section, general tab, output drivers, Video, and set it to x11 - this will use software rendering. Alternatively you can use xv for XVideo rendering or either gl or gl2 for OpenGL rendering. In general you should try these options in the following order for best quality and performance: xv, gl2, gl and finally x11.