Multimedia Dynamite
What should the Linux movie player of your dreams do? It should play any movie/video that you throw at it. No questions asked—just play. It should allow seeking and volume control with the keyboard and mouse. It should work with an infrared remote controller and also play television. It should play DVDs and VCDs too. MPlayer can do all of this and much, much more.
MPlayer also is an award-winning, mature, open-source program that still is actively in development. Perhaps one day in the not-too-distant future, support for DVD menus, color subtitles, picture in picture video, MIDI and audio effects plugins like the ones for SoX will be added.
MPlayer is admirably stable for the job it does. However, it does crash under certain circumstances, such as with certain video drivers.
It is a mature application that has no parallel. MEncoder, its companion video encoder program, does a much better job than FFMPEG in transcoding videos, although it is a bit difficult to use and learn.
Now, let's take a look at MPlayer's magic. The following command plays a stream URL after resampling it to 48,000Hz and combining channels into left-right stereo:
$ mplayer -af lavcresample=48000,hrtf ↪'http://mp3.streampower.be/radio1-mid.mp3'
The following command grabs the same URL stream and dumps it to a file named stream.aac:
$ mplayer -dumpstream -dumpfile stream.aac ↪-softvol -softvol-max 2000 -af ↪lavcresample=48000,volnorm=2:0.5 ↪'http://mp3.streampower.be/radio1-mid.mp3'
You can open the stream file from another terminal window with this command:
$ mplayer stream.aac
Then what happens? The first instance of MPlayer continues to dump the network stream to a file and the second plays it for you—time-shifted Internet radio. Cool, eh?
Most of the switches are not necessary to accomplish this, but they show MPlayer's ability to use the Linux command line so elegantly. The -softvol and -softvol-max switches invoke the software volume control feature of MPlayer. It reduces the signal-to-noise ratio, but it can amplify the signal to very high levels.
The volnorm=2:0.5 filter invokes the volume normalization audio filter. The first argument, 2, specifies that several samples are to be used to smooth the volume variations. The 0.5 sets the maximum amplitude to which you want the volume normalized. As you can see, MPlayer provides a high level of customization.
The other options on the command line should not be difficult to decipher.
The following is a command similar to the first one above. In this case, however, you specify a playlist URL. Unlike the above command, this one may not work for you, depending on whether the file happens to be available from the SHOUTcast site when you try it:
$ mplayer -af lavcresample=48000,hrtf -playlist ↪'http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn ↪=1025&file=filename.pls'
The -playlist option is used only with stream URLs that have a .pls extension in the stream.
You can create your own playlists in a variety of ways. Here is one way to do it with the find command:
$ find /home/girish/music -name "*mp3 ↪-or -name "*ogg" > ~/playlist.txt
Now, fire up MPlayer with:
$ mplayer -playlist ~/playlist.txt
The following variant shuffles the list and plays songs in random order without repeating songs:
$ mplayer -shuffle -playlist ~/playlist.txt
Naturally, MPlayer is a media player. You don't have to limit yourself to audio files. You could add any MPlayer-playable media file into the mix, including videos, movies, television, radio and, of course, Internet streams.
In addition to this simple line-based playlist format, MPlayer also has excellent support for ASX, M3U and other popular playlist formats.
There is good support for audio effects, and the karaoke effect especially gets interesting with certain songs. It is not perfect, but you can attenuate the voice in a song a great deal. Use the following command to activate karaoke mode:
$ mplayer -af karaoke song.mp3
MPlayer also has a ten-octave band equalizer. The following command ignores the middle frequency bands and amplifies the frequencies around 31.25Hz by 7dB, 62.5Hz by 8dB, 125Hz by 5dB and all of the frequencies around 4, 8 and 16Hz are attenuated by 2dB:
$ mplayer -af equalizer=7:8:5:0:0:0:-2:-2:-2 video.mpg
The following command gives a live effect to playback. Try it with songs that sound monotonous:
$ mplayer -af extrastereo song.mp3
You can issue a command like the following to play the third song five times:
$ mplayer song1.mp3 song2.ogg file.wav -loop 5
If you want to repeat the whole list five times, type the following instead:
$ mplayer { song1.mp3 song2.ogg file.wav } -loop 5
You also can use -loop 0 to play something over and over again.
Additionally, there are many audio effect plugins designed especially for multichannel and 3-D audio. If you want some really advanced audio effects, try the SoX Swiss Army knife. It is another command-line application that excels in professional audio effects.
You can specify multiple audio filters on the command line and they are applied one after another in a chain.

Figure 1. MPlayer Audio/Video Filter Chaining
What if you like a certain audio filter chain and you want to save the resulting audio to a file? The following command saves the output of filtering to the file named filtered.wav rather than playing it:
$ mplayer -ao pcm:file=filtered.wav -channels 4 -af lavcresample=48000,hrtf,pan=2:1:0:0:0.3:0.5:0.5:0:12 audio.ogg
The lavcresample filter resamples the frequency of audio.ogg to 48,000Hz.
The pan filter is a very powerful and sophisticated filter. It mixes the input audio channels into the specified output channels in various amplitudes.
In this example, we use the -channels switch to specify four input channels. The first argument to pan is 2 to specify two output channels. In the first pair of arguments after that, the 1:0 specifies the amplitude of the first input channel that is fed into the two output channels. It goes into the left channel with an amplification factor of 1. The second input channel goes into the right channel with an amplification factor of 0.3 (0:0.3), and the third input channel is divided equally into both output channels (0.5:0.5). The fourth channel goes into the right channel with an amplification factor of 12.
You can use the following command to re-encode the WAV file to Ogg:
$ oggenc -q 9 filtered.wav
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Designing Electronics with Linux | May 22, 2013 |
| Dynamic DNS—an Object Lesson in Problem Solving | May 21, 2013 |
| Using Salt Stack and Vagrant for Drupal Development | May 20, 2013 |
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
- New Products
- Linux Systems Administrator
- Senior Perl Developer
- Technical Support Rep
- UX Designer
- Web & UI Developer (JavaScript & j Query)
- Designing Electronics with Linux
- Dynamic DNS—an Object Lesson in Problem Solving
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Using Salt Stack and Vagrant for Drupal Development
- Reply to comment | Linux Journal
5 hours 13 min ago - Nice article, thanks for the
15 hours 54 min ago - I once had a better way I
21 hours 40 min ago - Not only you I too assumed
21 hours 57 min ago - another very interesting
23 hours 50 min ago - Reply to comment | Linux Journal
1 day 1 hour ago - Reply to comment | Linux Journal
1 day 8 hours ago - Reply to comment | Linux Journal
1 day 8 hours ago - Favorite (and easily brute-forced) pw's
1 day 10 hours ago - Have you tried Boxen? It's a
1 day 16 hours ago
Enter to Win an Adafruit Pi Cobbler Breakout Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Pi Cobbler Breakout Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- 5-21-13, Prototyping Pi Plate Kit: Philip Kirby
- Next winner announced on 5-27-13!
Featured Jobs
| Linux Systems Administrator | Houston and Austin, Texas | Host Gator |
| Senior Perl Developer | Austin, Texas | Host Gator |
| Technical Support Rep | Houston and Austin, Texas | Host Gator |
| UX Designer | Austin, Texas | Host Gator |
| Web & UI Developer (JavaScript & j Query) | Austin, Texas | Host Gator |
Free Webinar: Hadoop
How to Build an Optimal Hadoop Cluster to Store and Maintain Unlimited Amounts of Data Using Microservers
Realizing the promise of Apache® Hadoop® requires the effective deployment of compute, memory, storage and networking to achieve optimal results. With its flexibility and multitude of options, it is easy to over or under provision the server infrastructure, resulting in poor performance and high TCO. Join us for an in depth, technical discussion with industry experts from leading Hadoop and server companies who will provide insights into the key considerations for designing and deploying an optimal Hadoop cluster.
Some of key questions to be discussed are:
- What is the “typical” Hadoop cluster and what should be installed on the different machine types?
- Why should you consider the typical workload patterns when making your hardware decisions?
- Are all microservers created equal for Hadoop deployments?
- How do I plan for expansion if I require more compute, memory, storage or networking?




Comments
There is good support for
There is good support for audio effects
Alaçatı konaklama
thank you for all
good content
thanks admin
hi. thanks for sharing
hi. thanks for sharing
new
thanks admin
no
thanks admin
hello
thanks
hi. thanks for sharing. my
hi. thanks for sharing. my friend
is that true?
see... mplayer can't fully display substation alpha subtitles, it messed up the whole karaoke effects
There is good support for
There is good support for audio effects, and the karaoke effect especially gets interesting with certain songs.