The Linux video "Swiss Army knife", which plays almost every movie format imaginable .
- The player is rock solid playing damaged MPEG files (useful for some VCDs), and it plays bad AVI files which are unplayable with the famous windows media player. Even AVI files without index chunk are playable, and you can temporarily rebuild their indexes with the -idx option, or permanently with MEncoder, thus enabling seeking! As you see, stability and quality are the most important things, but the speed is also amazing. There is also a powerful filter system for video and audio manipulation. 
In addition, MPlayer can also serve as:
- a TV viewer application for both analogue TV or DVB.
- a Radio listening application
- a Webcam viewing application
- 1 Using MPlayer to Watch TV
- 2 Using MPlayer for Radio Listening
- 3 Using MPlayer for Webcam Viewing
- 4 High Quality Video Playback
- 5 Also See
- 6 External Links
Using MPlayer to Watch TV
Useful MPlayer Global Keyboard Hotkeys When Watching TV
These are global settings applicable for either analogue or DVB.
You can change the channel and control the volume with those keys:
|/ and *||Decrease/increase volume|
|9 and 0||Decrease/increase volume|
|h and k||Select previous/next channel|
For more info about MPlayer command line parameters and other control keys, please read the MPlayer man page
Watching Analogue TV
A sample MPlayer command line that will play TV for Europe, channel E2, for devices that use analog audio wired from the TV card audio output into the aux or cd audio input on the motherboard or on the audio card:
mplayer tv:// -tv driver=v4l2:norm=PAL:input=0:amode=1:width=384:height=288:outfmt=yv12:device=/dev/video0:chanlist=europe-west:channel=E2
If your board provides a digital audio input, don't forget to load the alsa module for it. In this case, you'll need to teach mplayer to read the audio stream as well. This is an example of using mplayer for viewing TV on a NTSC video stream, reading also the audio stream:
mplayer -tv driver=v4l2:device=/dev/video0:norm=NTSC:chanlist=us-bcast:channel=10:alsa=1:adevice=hw.1:audiorate=48000:immediatemode=0:amode=1 tv://
In this case, it is assumed that the -alsa module created as the second audio adapter (hw:1), and supports an audio rate of 48 kHz. There are more useful information about audio setups with alsa modules on Saa7134-alsa.
To avoid having to specify all the above parameters, it is recommended to write them to the ~/.mplayer/config:
zoom = yes vo = x11 tv = "driver=v4l2:device=/dev/video0:norm=NTSC:chanlist=us-bcast:channel=10:alsa=1:adevice=hw.1:audiorate=48000:immediatemode=0:amode=1" monitoraspect = "16:9"
Watching DVB Streams
One method of using MPlayer to watch DVB streams is outlined in the Testing your DVB device article. However, it is a convoluted solution, and is much more suited for testing purposes rather then daily use. A much simpler and convenient method is outlined below.
If you have a single DVB device, which itself has a single frontend(a usage case which will be true for most persons; See the section below for MPlayer usage with more complex DVB device configurations), you can start watching DVB streams with MPlayer simply by typing:
$ mplayer dvb://
That command will result in your DVB device receiving the first channel listed in your channels.conf and displaying that stream's contents in MPlayer. You can then move forward through your channel list by pressing h (next) on your keyboard. Conversely, pressing k (previous) on your keyboard will move backwards through your channel list.
If you wish to open a specific DVB stream (as listed in the channels.conf file), type:
$ mplayer dvb://"STREAM NAME"
"STREAM NAME" is, of course, a generic descriptor and you will have to substitute the correct name accordingly (e.g. BBC, CBS, CBC, ....)
Of course, for even better results, you may wish to run MPlayer with some options (
mplayer dvb:// <options>). For example, to utilise linear blend deinterlacing for display/playback, run:
$ mplayer dvb:// -vf pp=lb
You may have to force demuxer type for better results. For example, for a DVB-T device (all DVB devices?):
$ mplayer dvb:// -demuxer mpegts
See the MPlayer man page (i.e. in a console run "man mplayer") for a lengthy list of available options (an online version is found below in the links section).
Usage with more complex DVB device configurations
If you choose not to specify a device adapter and/or frontend, as was the case in the examples shown in the section above, then MPlayer will default to using
/dev/dvb/adapter0/frontend0. Alternatively, you can be very specific with MPlayer in terms of which hardware is to be used -- a point of interest to those:
- with multiple DVB device adapters in their system, or
- whose device adapter has multiple frontends, or
- who have multiple adapters and some, or even all, of which have multiple frontends!
If you have more than one DVB device adapter installed in your system you can specify the device to use by passing the device number in the command syntax. MPlayer uses device numbers of 1-4. For example:
$ mplayer dvb://"DEVICE NUMBER"@"STREAM NAME" <options>
Which will open the default frontend ("frontend0") on the adapter you specify.
Some device adapters also have multiple frontends. In which case, you can specify which frontend on the adapter to use by passing the frontend number along with the device adapter number. For example:
$ mplayer dvb://"DEVICE NUMBER":"FRONTEND NUMBER"@"STREAM NAME" <options>
Again, to avoid having to specify all the above parameters, it is recommended to write them to the ~/.mplayer/config file.
Limitations with DVB Streams
- Only free-to-air broadcasts are supported. Decryption through CAM is not implemented in MPlayer.
But you can use virtual interface such as sasc-ng or utilite ca_zap from dvb-apps/util:
cat ~/.mplayer/channels.conf: #Eutelsat W4 36' Sport 1:11727:h:0:27500:101:201:1 Sport 2:11727:h:0:27500:102:202:2 First Automotive:11727:h:0:27500:103:203:3 BIZ TV:11727:h:0:27500:105:205:5 RUTV:11727:h:0:27500:109:209:9 O2TV:11727:h:0:27500:110:210:10 RTVi:11727:h:0:27500:111:211:11
ca_zap -m -c ~/.mplayer/channels.conf -t sat -a 0 -n 'Sport 1' mplayer dvb://'0@Sport 1'
- There is (presently) no DVB subtitle support in MPlayer.
Recording DVB Streams
If you want to record a DVB stream with MPlayer, you can use:
$ mplayer -dumpstream dvb://"STREAM NAME" -dumpfile stream.ts
This will dump the stream in MPEG-TS format to the file stream.ts (Note that this file can be very large - ~1GB for 30 minutes).
You can then use MPlayer or MEncoder, a command-line encoder built on the MPlayer code, to convert that file to a usable video format.
There is even more functionality in MEncoder when it comes to recording streams.
MPlayer and Satellite Dishes
If you are using MPlayer with a satellite dish that has a C-Band lnb LO: 5150 or standard Ku Band lnb LO: 10750 such as are commonly used in North America, MPlayer will tune the channel if you use the L Band frequency in your .mplayer/channels.conf file instead of the C or Ku Band frequency. To calculate the L Band frequency for C Band, 5150 minus frequency in Mhz equals L Band frequency in Mhz. For Ku Band, frequency in Mhz minus 10750 equals L Band frequency in Mhz.
For example to tune C Band 4.060 Ghz
5150 - 4060 = 1090
Use 1090 for the frequency in channels.conf instead of 4060.
For Ku Band 11.799 Ghz
11799 - 10750 = 1049
Using MPlayer for Radio Listening
You can do a lot of things with MPlayer. An example of commandline syntax used for radio listening is:
mplayer -rawaudio rate=48000 radio://2/capture -radio adevice=hw=2:arate=48000:channels=93.8-Radio_Zones,94.7-SSR_1
Note that this command will work even without audio cable between the output of the radio card and a line input of the audio card.
This will start MPlayer with sample rate = 48 kHz (using the same sample rate that the sound card is using gives best results), listening to the second station on the list, the tuner is the third sound card (ALSA device hw:2). For more examples and syntax: MPlayer radio tips.
You can add as many stations as wanted and use LIRC to control MPlayer.
If you are, say, running JACK all the time, you can add
into ~.mplayer/config (for MPlayer) and mplayerplug-in.conf (for Firefox mplayerplug-in). For recording, you can use any JACK aware recording application.
A XDialog wrapper can be made for radio listening using MPlayer and v4l2-ctl. The authour found that it was so good that they decided to make it public under the name XDRadio. You will have to make a list of your stations during the installation (very easy to do). After that, all that is required is to just to run it and enjoy the radio.
Using MPlayer for Webcam Viewing
Can be used to view webcam video by invoking 'mplayer tv://'.
High Quality Video Playback
MPlayer will play almost anything with the default settings, but with careful selection of the command line parameters (i.e. test samples, trial-and-error and patience) it is possible to achieve very high quality video playback. When you are satisfied with the results provided by certain parameters, you can add them to the ~.mplayer/config file so that they are used persistently and don't have to be manually passed to the application. Type "man mplayer" for a detailed listing of available options. Pay particular attention to:
- Video Output Driver (-vo option)
- xv is reliable
- vdpau may be useful if you have an nvidia card (and not enough CPU)
- See http://guru.multimedia.cx/deinterlacing-filters/
- -vf yadif=1 is good, doubles the frame rate to preserve information (at the cost of CPU)
- -vf scale with -sws 9 is very good (at the cost of CPU)
- Vertical sync (check for tearing artefacts in the video)
- check video card options, desktop compositing, OpenGL
- video card frame rate should equal (or be a multiple of) video frame rate
- Audio sync
- -delay option
- ensure it is disabled when playing video and reenabled afterwards
- you will probably need different settings for SD and HD
- check news tickers for smooth flow and readability
- BBC HD (Patches and Info for Watching BBC HD on Astra 28.8e)