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.
- Readers' Choice Awards 2013
- Mars Needs Women
- Linux Kernel News - November 2013
- Sublime Text: One Editor to Rule Them All?
- RSS Feeds
- Raspberry Pi: the Perfect Home Server
- December 2013 Issue of Linux Journal: Readers' Choice
- Tech Tip: Really Simple HTTP Server with Python
- IBM Will Minimize Impact of Future Disasters
- Linux Systems Administrator
- The kernel doesn't really
1 hour 57 min ago
2 hours 28 min ago
2 hours 29 min ago
4 hours 33 min ago
- This should be very helpful
5 hours 47 min ago
- As much as I share your point
8 hours 7 min ago
- So girls had it better ?
11 hours 39 min ago
- Reply to comment | Linux Journal
11 hours 59 min ago
- why is GNOME 3 in the fifth position at 14.1 %?
17 hours 31 min ago
- Sublime Is Brilliant!
22 hours 34 min ago