Not surprisingly, MPlayer understands close to 12 subtitle formats, and it has its own MPSub format too. The options for subtitle display are the richest I have seen. You can display subtitles in any size, any position on the video, move them dynamically with the keyboard, adjust the delay, change the transparency, format them into multiple lines and so on.
Here is the most basic usage of the file subtitles.txt:
FORMAT=TIME # first number : wait this much after # previous subtitle disappeared # second number : display the current # subtitle for this many seconds 2 3 What is going on? 4 3 How are you doing? 8 3 You are wrong! 0 3 A long long, time ago... in a galaxy far away... 0 3 Naboo was under an attack. 0 200 I don't understand this.
Tell MPlayer to use this file with a command like this:
$ mplayer -sub subtitles.txt ↪-font ~/.ttffonts/Verdana.ttf video.avi
This next command dumps the subtitles file into the srt format into the file dumpsrt.sub in the current directory:
$ mplayer -sub subtitles.txt video.avi -dumpsrtsub
You can take a quick look at all subtitles in the file by pressing the Y and G keys. Of course, you can specify multiple subtitle files, and you can switch between them.
Want to take screenshots with MPlayer? It's easy. Here's a sample command to use when you start to play a video:
$ mplayer -vf screenshot video.avi
Press S when you want to take a screenshot. If you want a screenshot every five seconds, try the following command:
$ mplayer -vo png -vf screenshot -sstep 5 video.avi
What if you want to take a screenshot of every frame? Set MPlayer to accept slave commands with a FIFO, and type these commands:
$ mkfifo /tmp/fifo $ mplayer -input file:/tmp/fifo video.mpg $ echo 'screenshot 1' > /tmp/fifo
Toggle the screenshot process with the following command while the video is playing:
$ echo 'screenshot 1' > /tmp/fifo
You might want to use the -vf spp,scale=1024:768 switch to get full-screen screenshots.
There's much more MPlayer can do. You can encode image files into a video and extract frames into image files with MPlayer. You also can watch analog television with the tv:// option and watch DVB channels with the dvb:// option. It supports a wide variety of streaming protocols, including RTP, RTSP, MMS, SDP and LIVE5555 streaming.
The following command lists the available filters:
$ mplayer -af help
The man page and MPlayer's HTML documentation have more thorough descriptions of its options. Typing:
$ mplayer -vo help
lists the compiled video output drivers.
You can play an arbitrary audio file with the video using:
$ mplayer video.mpg -audiofile audio.aac
Of course, MPlayer can play a wide variety of audio and video media files. The following commands list them:
$ mplayer -vo help $ mplayer -ao help
Try using the -audio-demuxer switch along with -rawaudio.
I hope this gets you started in discovering the awesome power of MPlayer. Enjoy your multimedia experience!
Girish Venkatachalam is an open-source hacker deeply interested in UNIX. In his free time, he likes to cook vegetarian dishes and actually eat them. He can be contacted at email@example.com.
- Smoothwall Express
- Machine Learning Everywhere
- Own Your DNS Data
- Bash Shell Script: Building a Better March Madness Bracket
- Simple Server Hardening
- Understanding OpenStack's Success
- From vs. to + for Microsoft and Linux
- Returning Values from Bash Functions
- Understanding Firewalld in Multi-Zone Configurations
- The Weather Outside Is Frightful (Or Is It?)