On Linux, a great way to play video files with the terminal. Going this route means you bypass all of the fancy UI elements in favor of simplicity. Introducing Mplayer, it’s a powerful command-line based video player that you can use to play video from the Terminal. It supports many different media formats, and works very well on computers that are low on RAM.
Before using Mplayer, you’ll need to install it on your PC. Follow the instructions below next to your Linux distribution. Keep in mind that you’ll need to be running Ubuntu, Debian, Arch Linux, Fedora, or OpenSUSE.
sudo apt install mplayer
sudo apt-get install mplayer
sudo pacman -S mplayer
sudo dnf install mplayer
sudo dnf install mplayer
Build From Source
Need to build Mplayer from source? To do so, you’ll need to first install a couple packages. These packages are important for the build process. Open up your package manager, search for “build-essential”, “subversion”, “check install”, “yasm”, “dockbook-xml”, “git”, “xsltproc” and “libxm2-utils”.
Note: If you can’t find these dependencies on your version of Linux, consider looking at the officialÂ Mplayer website for guidance.
When all the dependencies are taken care of, download the latest version of the source code.
RunÂ configure. TheÂ configureÂ script will scan yourÂ Linux PC and prepare it for the build process.
‘); if (navigator.appVersion.indexOf(“Mac”)!=-1) document.write(”);
Next, use theÂ makeÂ command to compile the source code.
Install the program with:
make install Each time there is a MplayerÂ update you'll need to re-run the building process. For more information on compiling Mplayer from source, check the website.Â
The Mplayer tool is simple yet powerful. It’s a command-line based app, so to interact with it you’ll need to open up a terminal window. Inside the terminal, useÂ lsÂ to view theÂ /home/ directory. Home is the basis for most files stored on a Linux PC so this is a good place to start. In this tutorial, we’ll assume video files are inÂ /home/username/Videos/.
Ls reveals that there is a “Video” folder. The next step is to use theÂ CDÂ command to change working directories.
Moving the terminal into Videos only makes it so that the terminal works from that directory. You’ll need to runÂ lsÂ again to view the names of video files.
Mplayer works with nearly every video codec on Linux, as it makes heavy use of the FFmpeg encoding tool. Use the mouse to highlight the name of the video files. Alternatively, pipe all of the video file names to a text file.
ls > video-files.txt
Open upÂ video-files.txtÂ in Gedit (or whatever GUI text editor tool you use on Linux).
Now that you’ve got a list of file-names, use theÂ mplayer command to playback a file. Here are some playback examples to follow.
or, play multiple files with:
mplayerÂ video1.mp4 video2.avi video3.3gp
Running a basic playback command (like above) opens up a GUI window and instantly starts the video. To quit the video, close the window. Alternatively, the player can be quit by pressing “Q” on the keyboard.
MPlayer Keyboard Shortcuts
Given that Mplayer is primarily command-oriented, it relies heavily on shortcuts. If you’re new to using a program like Mplayer, follow along with the post to get acclimated.
To skip through a video (back or forward), useÂ leftÂ orÂ rightÂ arrow keys.Â UpÂ andÂ downÂ arrow keys also skip back and forward in the video playback. Pressing space on the keyboard pauses playback,Â andÂ f switches Mplayer to full-screen mode.Â Additionally, users can skip between files by pressingÂ < and >. The < goes left in the playlist, and > goes right.
Mplayer has several different audio settings. To control the volume levels for playing videos, useÂ 0Â andÂ 9. The numberÂ 9Â in the number row decreases volume, and theÂ 0Â increases it. To mute things altogether, pressÂ m. Need to switch between audio tracks? HitÂ theÂ #Â key.
The Mplayer video tool has pretty good audio balance control. Users can shift the balance around (left and right) easily with the press of a button. To shift the balance of the audio in a video to the left, press Shift + ( to move left, and Shift + ) to move right.
The Mplayer video tool has a few video-specific settings. These settings pertain to the contrast, hue, saturation, framerate, and brightness of the video. To manipulate the contrast levels in Mplayer, useÂ 1Â andÂ 2. TheÂ 1Â key decreases contrast, whileÂ 2Â increases it.
Brightness, hue, and saturation work roughly in the same way, and have shortcuts on the number row as well.Â Change brightness levels in Mplayer withÂ 3Â andÂ 4, hue levels withÂ 5Â andÂ 6, and saturation withÂ 7Â andÂ 8.
Along with the visual settings covered above, the user can change “frame drop” settings in Mplayer by pressingÂ d.
Subtitles are important in video playback, especially for users that lack the ability to hear. As usual, with Mplayer, everything is done by shortcut. To view subtitles on any given video, press theÂ vÂ key. If a video file supports multiple subtitle tracks, switch between them withÂ j.
TheÂ yÂ button tells Mplayer to skip forward in the subtitle line, whileÂ g moves backward.
Users also have control over the subtitle delay. To add a +0.1 second delay to subtitles in Mplayer, press theÂ xÂ button. Decrease the delay (-0.1 sec) withÂ z.