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 firstname.lastname@example.org.
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems
Join editor Bill Childers and Bit9's Paul Riegle on April 27 at 12pm Central to learn how to keep your Linux systems secure.
Free to Linux Journal readers.Register Now!
|diff -u: What's New in Kernel Development||Aug 20, 2014|
|Security Hardening with Ansible||Aug 18, 2014|
|Monitoring Android Traffic with Wireshark||Aug 14, 2014|
|IndieBox: for Gamers Who Miss Boxes!||Aug 13, 2014|
|Non-Linux FOSS: a Virtualized Cisco Infrastructure?||Aug 11, 2014|
|Linux Security Threats on the Rise||Aug 08, 2014|
- diff -u: What's New in Kernel Development
- Security Hardening with Ansible
- NSA: Linux Journal is an "extremist forum" and its readers get flagged for extra surveillance
- Monitoring Android Traffic with Wireshark
- Tech Tip: Really Simple HTTP Server with Python
- [<Megashare>] Watch Mrs Brown's Boys Movie Online Full Movie HD 2014
- Readers' Choice Awards 2013
- RSS Feeds
- Linux Security Threats on the Rise
- IndieBox: for Gamers Who Miss Boxes!