MPlayer — Mastering Multimedia from the Terminal
Play local media, run video from a Linux text console, sort out HDMI sound and keep a jukebox running in tmux.
What is MPlayer?
MPlayer is an open-source media player for Unix-like systems. The project began in 2000 and grew from a Linux movie player into a portable tool that plays local audio and video, subtitle files, discs and compatible network streams. Its command-line interface starts playback with a filename, exposes the available audio and video drivers, and works well in scripts, over a text-only login for audio, or at a local console. A minimal interface keeps overhead low, though decoding a high-resolution video can still work the CPU hard.
How to read this guide. Package listings were checked on 26 November 2026. Core MPlayer options and keys were checked against the manual. Examples marked Platform-dependent need a particular driver, device, stream or build. Run mplayer -vo help and mplayer -ao help to see what your copy supports.
Install MPlayer
Use the package for your own system and release. Commands with sudo need administrator access. On Slackware and BSD, run installation commands in a root shell if you use su - instead. Return to your normal account before playing media.
Slackware Linux
Slackware 15.0 and Slackware64-current carry MPlayer in the xap series. A full install may already include it. Configure a mirror for your installed release in /etc/slackpkg/mirrors. The commands refresh package metadata and install the case-sensitive package name.
slackpkg update slackpkg install MPlayer
Package listings for Slackware64 15.0 and Slackware64-current.
Debian, Ubuntu and Kali Linux
Debian 13 stable, Ubuntu 24.04 and 26.04 LTS, and Kali rolling carry mplayer. The first line refreshes the package list and the second installs MPlayer. On Ubuntu, enable the official Universe component if it is missing, then repeat both commands. Use only your distribution’s repositories.
sudo apt update sudo apt install mplayer
sudo add-apt-repository universe
Package listings for Debian, Ubuntu and the Kali rolling amd64 package index.
Arch Linux
MPlayer is in the official Extra repository for x86-64. This command refreshes package lists, upgrades the system and installs MPlayer together to avoid a partial upgrade.
sudo pacman -Syu mplayer
FreeBSD and GhostBSD
FreeBSD Ports lists multimedia/mplayer. GhostBSD’s own stable amd64 catalogs for FreeBSD 15 and 14 also list mplayer. In a root shell run pkg update to refresh your configured catalog, pkg search -e mplayer to check it for an exact match, then install the package if it appears. Keep the GhostBSD repository on GhostBSD.
pkg update pkg search -e mplayer pkg install mplayer
FreeBSD Ports listing · GhostBSD repository documentation · GhostBSD amd64 stable repository.
NetBSD
NetBSD pkgsrc lists multimedia/mplayer and publishes binaries for supported release and architecture combinations. With pkgin already configured for your release and architecture, refresh its index and install as root. If the package is absent for your platform and you have a configured pkgsrc tree, use the source build route below. Adjust /usr/pkgsrc if your tree lives elsewhere.
pkgin update pkgin install mplayer
cd /usr/pkgsrc/multimedia/mplayer && make install clean
cd enters the package directory. && runs the build and install only if that succeeds. The clean target removes build work files. See the pkgsrc package and binary list.
Check the installation
command -v mplayer mplayer -vo help mplayer -ao help
The first command prints the executable’s location. The other two list the compiled video and audio output drivers. If the shell cannot find MPlayer, check your installation and PATH. On NetBSD, the usual package executable directory is /usr/pkg/bin.
A real playback run
This excerpt is from MPlayer 1.5 on Debian 13 playing a synthetic local video. The test used null outputs, which decode the media without sending it to a screen or speakers. The output shows the audio and video formats, playback position and saved frame.
Playing video.mp4. Opening video filter: [screenshot] AO: [null] 44100Hz 1ch floatle (4 bytes per sample) VO: [null] 640x360 => 640x360 Planar YV12 ANS_TIME_POSITION=0.9 *** screenshot 'shot0001.png' *** Exiting... (Quit)
Play files from the shell
Open a terminal in the directory containing your media. Replace the sample filenames with your files. Quote paths containing spaces, such as "My Holiday.mp4". In a graphical session MPlayer can open a video window while the command and playback status stay in the terminal. For a Linux text console, see the next section on video output.
| Command | What it does |
|---|---|
mplayer video.mp4 | Plays a video using the default audio and video drivers. |
mplayer music.mp3 | Plays an MP3 in the terminal. |
mplayer -fs video.mp4 | Starts fullscreen when the video driver supports it. |
mplayer -novideo video.mp4 | Disables video decoding and plays the audio track. |
mplayer -loop 0 video.mp4 | Repeats indefinitely. Press q to stop. |
mplayer -shuffle -playlist playlist.m3u | Reads a trusted M3U playlist and plays the entries in random order. |
mplayer -speed 1.5 video.mp4 | Plays at one and a half times normal speed. |
Keyboard controls
Give the player terminal or video window keyboard focus. These are the defaults. Some output drivers or local input.conf bindings change which keys work.
| Action | Keys |
|---|---|
| Pause or resume | Space or p |
| Seek back or forward 10 seconds | ← / → |
| Seek back or forward 1 minute | ↓ / ↑ |
| Lower or raise volume | 9 / 0 |
| Toggle fullscreen or mute | f for fullscreen, m for mute |
| Show or hide subtitles | v |
| Cycle subtitles | j / Shift+J (lowercase / uppercase J) |
| Adjust subtitle delay (0.1 second steps) | x adds delay, z removes delay |
| Previous or next playlist entry | < / > |
| Stop and exit | q or Esc |
Video without a graphical desktop
Platform-dependent. On Linux, try a local virtual console such as Ctrl+Alt+F3; the exact console and shortcut back to your desktop vary. Log in as your regular user. tty prints the terminal device. A local virtual console typically shows /dev/tty3 or similar. An SSH or desktop terminal usually shows /dev/pts/…. Framebuffer output draws on the computer’s physical display, including when launched remotely.
tty ls -l /dev/fb0 mplayer -vo help
ls -l shows whether Linux exposes the framebuffer device and who can access it. Try each driver separately if listed. fbdev and fbdev2 use the kernel’s framebuffer interface. Start with a small clip.
mplayer -vo fbdev video.mp4
mplayer -vo fbdev2 video.mp4
Modern DRM/KMS GPU drivers may provide a compatibility framebuffer, may expose only DRM devices, or may leave a display under another session’s control. A listed MPlayer driver and a present /dev/fb0 are only prerequisites. If access is denied, use the permissions or logged-in seat policies provided by your distribution. Avoid running the player as root or making the device world-writable. FreeBSD, GhostBSD and NetBSD use different console interfaces, so use a supported text output driver there.
ASCII video
When compiled in, aa uses AAlib for monochrome ASCII art and caca uses libcaca for coloured text art. They approximate the picture with characters. CACA_DRIVER=ncurses asks libcaca for a terminal display if that backend is installed. With aa from a real text console, keep the terminal focused.
mplayer -vo aa video.mp4
mplayer -vo caca video.mp4
CACA_DRIVER=ncurses mplayer -vo caca video.mp4
Audio drivers, HDMI and missing sound
Platform-dependent. Start with a known-good local MP3. -ao selects an audio driver. Use the default first, then test the driver your system provides.
mplayer -ao help mplayer -ao alsa music.mp3 mplayer -ao pulse music.mp3 mplayer -ao oss music.mp3
- ALSA is the usual Linux audio interface.
aplay -llists hardware playback devices andaplay -Llists named ALSA outputs. Replace the sample card and device numbers from your own output. MPlayer’s ALSA device syntax uses a dot in place of the ALSA comma. - PulseAudio routes individual playback streams to selected outputs. It also works with PipeWire’s PulseAudio compatibility server.
pactl list short sinkslists sink names. ReplaceYOUR_SINKbelow to direct this playback to one sink. The empty field before the second colon uses the default PulseAudio server. - OSS is commonly used for MPlayer on FreeBSD and GhostBSD. On NetBSD, try the default output first, then inspect the backend list and the native
/dev/audiodevice.
aplay -l aplay -L pactl list short sinks
mplayer -ao alsa:device=plughw=0.3 music.mp3
mplayer -ao pulse::YOUR_SINK music.mp3
When you get silence
- Check the player and system volume, mute state, cable and TV input. Press m if MPlayer is muted. With HDMI, wake the display before starting playback.
- On Slackware, try the desktop’s HDMI audio output or inspect it with
pactl list short sinksas your normal desktop user. From a text console with ALSA, openalsamixer, press F6 to choose a card and use m to toggle mute on a selected channel. Some HDMI devices have no mixer controls. Checkaplay -lagain after plugging the display in. If an ALSA hardware device reports “Device or resource busy”, try routing through the desktop audio server. - On FreeBSD and GhostBSD,
cat /dev/sndstatlists sound devices andsysctl hw.snd.default_unitshows the default PCM unit. If the HDMI output ispcm2and/dev/dsp2is available to your user, try the OSS device explicitly. On NetBSD,audioctl -alists audio device properties. Select an available MPlayer backend and check permissions and output routing. - If MPlayer reports a missing shared library on Slackware, check for a partial installation or packages from the wrong Slackware release. On BSD, reinstall using your system’s configured package repository and check
mplayer -ao helpagain.
mplayer -ao oss:/dev/dsp2 music.mp3
Internet radio and direct streams
Stream-dependent. Use a station’s published direct stream URL. This example uses SomaFM’s public 128 kbps MP3 Groove Salad feed. -novideo selects audio-only playback. Press q to stop. If the URL changes, get the current one from the station’s site.
mplayer -novideo 'https://ice5.somafm.com/groovesalad-128-mp3'
A compatible direct media URL can go in place of a filename in mplayer "URL". A radio station’s homepage normally serves HTML. If it publishes an M3U instead, use the station’s own playlist with -playlist. HTTPS, redirects and adaptive HLS/DASH streams depend on the build and format. Try MPV if an older MPlayer build cannot open a current feed. Netflix and other DRM-protected services require a supported browser or official app.
YouTube with yt-dlp and MPV
Stream-dependent. Use a current yt-dlp with your own uploads or material whose playback this way is authorised by the rights holder and service. Current YouTube extraction can require an external JavaScript runtime supported by yt-dlp. Start by listing formats for one video. Replace the sample watch URL with the authorised video’s real URL.
video_url='https://www.youtube.com/watch?v=VIDEO_ID' yt-dlp --no-playlist -F -- "$video_url"
-F lists available formats. The next example asks for one HTTPS MP4 stream with H.264 video and AAC audio. -g prints a temporary direct URL. The if starts MPlayer only if yt-dlp succeeds and returns a non-empty URL. -- ends option parsing before the watch URL.
if media_url=$(yt-dlp --no-playlist -f 'b[protocol=https][ext=mp4][vcodec^=avc1][acodec^=mp4a]' -g -- "$video_url") && [ -n "$media_url" ]; then mplayer "$media_url" else printf '%s\n' 'No compatible combined stream found. Try MPV.' >&2 fi
Direct URLs can expire or require request headers that MPlayer does not supply. Higher-quality video often has separate audio and video tracks. With MPV and yt-dlp installed, let MPV resolve the watch URL and handle separate tracks:
mpv -- "$video_url"
Build a terminal jukebox
Make an M3U playlist
An M3U is a text file with one media path per line. This example uses absolute paths based on your home directory. Replace the example filenames with two real tracks. The first line in the file identifies an extended M3U playlist. printf writes each argument on its own line, and > creates or replaces playlist.m3u in your current directory.
printf '%s\n' '#EXTM3U' "$HOME/Music/Track One.mp3" "$HOME/Music/Track Two.flac" > playlist.m3u mplayer -novideo -shuffle -playlist playlist.m3u
-novideo keeps playback audio-only, and -shuffle randomises the entries. Use playlists you created yourself or obtained from a trusted source.
Shuffle your music collection
Save this script as jukebox.sh. It requires Bash and a find with -print0, available on the Linux and BSD systems in this guide. The script takes a folder argument or uses ~/Music. It makes the folder path absolute so it can search paths that contain spaces.
#!/usr/bin/env bash
set -e
music_dir=${1:-"$HOME/Music"}
cd -- "$music_dir"
music_dir=$(pwd -P)
playlist=$(mktemp "${TMPDIR:-/tmp}/darkpc-mplayer.XXXXXXXX")
trap 'rm -f -- "$playlist"' EXIT
find "$music_dir" -type f \( -iname '*.mp3' -o -iname '*.flac' -o -iname '*.ogg' -o -iname '*.wav' -o -iname '*.m4a' \) -print0 > "$playlist"
# M3U uses one filename per line, so skip filenames containing a newline.
tracks=()
while IFS= read -r -d '' track; do
[[ "$track" == *$'\n'* || "$track" == *$'\r'* ]] && continue
tracks+=("$track")
done < "$playlist"
if (( ${#tracks[@]} == 0 )); then
printf '%s\n' 'No supported audio files found.' >&2
exit 1
fi
printf '%s\n' '#EXTM3U' "${tracks[@]}" > "$playlist"
mplayer -novideo -shuffle -playlist "$playlist"
set -e stops the script if a required step such as opening the folder or running find fails. mktemp creates a private temporary file and trap removes it when the script exits. find searches subdirectories and prints matching filenames with a zero-byte separator. Bash’s read loop keeps spaces and backslashes intact as it reads those names into an array. The script skips names that would split an M3U entry across lines, checks that it has tracks, then writes the playlist and starts MPlayer.
bash jukebox.sh "$HOME/Music"
bash runs the script directly. Pass another quoted folder to shuffle a different collection.
Keep music playing in tmux
Install tmux through your package manager if needed. From a regular shell, new-session -s opens a session named jukebox. Run your playlist or script inside it. If you’re already inside tmux, run the player in a new tmux window or pane.
tmux new-session -s jukebox
mplayer -novideo -shuffle -playlist playlist.m3u
Press the default prefix Ctrl+b, release it, then press d to detach. Music continues while the host and audio session remain active. Open another terminal and run tmux attach with the same name to return to the player. Press q inside the player when you are finished.
tmux attach -t jukebox
Advanced playback
Subtitles and speed
-sub loads the named external SRT file. -speed 0.75 plays at 75% speed. When available, -af scaletempo changes tempo while preserving pitch. Use [, ] and Backspace during playback to slow down, speed up and reset.
mplayer -sub "video.en.srt" video.mp4 mplayer -speed 0.75 -af scaletempo video.mp4
Filters, aspect ratio and screenshots
Platform-dependent. -vf help lists compiled video filters. -vf scale=640:-2 scales the video to 640 pixels wide and computes the height from the video’s display aspect. Use -aspect 16:9 only to correct an incorrectly displayed aspect ratio. For screenshots, enable the screenshot filter and press lowercase s while the video is running. MPlayer writes PNG frames, usually named shot0001.png and so on, in the current directory. Use a writable directory. The capture is a video frame and can differ from the picture on the monitor.
mplayer -vf help mplayer -vf scale=640:-2 video.mp4 mplayer -aspect 16:9 video.mp4 mplayer -vf screenshot video.mp4
DVD playback
Platform-dependent. For a readable DVD your build supports, dvd://1 opens title 1. Add -dvd-device to select the drive if the default is wrong. Replace /dev/sr0 with your actual Linux device. On FreeBSD an optical drive may appear as /dev/cd0. Your user needs read access and the player needs DVD support compiled in. Some discs have region or content protection that prevents playback with this setup.
mplayer dvd://1 mplayer -dvd-device /dev/sr0 dvd://1
Configuration files and aliases
Edit ~/.mplayer/config with your usual text editor, creating the ~/.mplayer directory first if needed. Put one option=value per line and leave off the command-line dash. This example enables software volume and starts at 50%. System-wide settings may be in /etc/mplayer/mplayer.conf or another package-specific directory. Per-user key bindings go in ~/.mplayer/input.conf. For a troubleshooting run, -noconfig all ignores MPlayer configuration files.
mkdir -p "$HOME/.mplayer" nano "$HOME/.mplayer/config"
softvol=yes volume=50
mplayer -noconfig all music.mp3
Enter these aliases in an interactive Bash shell to test them, then put them in ~/.bashrc if you want them in future interactive Bash sessions. mplay takes a filename or URL and plays its audio. mradio opens the example station.
alias mplay='mplayer -novideo' alias mradio='mplayer -novideo https://ice5.somafm.com/groovesalad-128-mp3'
Slave mode for basic automation
-slave reads newline-separated commands from standard input. -input cmdlist lists the commands your build understands. The example starts a local MP3, waits two seconds, asks for the playback position, then sends quit. Use a file longer than four seconds and increase the first wait on slow hardware. In a longer script, read the ANS_TIME_POSITION response from standard output. -quiet cuts down on status noise.
mplayer -input cmdlist
{
sleep 2
printf '%s\n' get_time_pos
sleep 2
printf '%s\n' quit
} | mplayer -slave -quiet -novideo music.mp3
DarkPC terminal multimedia challenge
Set up playback using only shell commands and terminal controls. Start with media you own or are authorised to use. If your system has no accessible framebuffer, try text-art video. If your build has neither text output, complete the audio and subtitle-command steps and record which driver is missing.
Printable command reference
Your browser’s print command also prints this reference.
- Play video or music
mplayer video.mp4·mplayer music.mp3- Fullscreen, audio-only, repeat
mplayer -fs video.mp4·mplayer -novideo video.mp4·mplayer -loop 0 video.mp4- Drivers available in your build
mplayer -vo help·mplayer -ao help- Linux console and text output, where supported
mplayer -vo fbdev2 video.mp4·mplayer -vo caca video.mp4- Audio driver examples
mplayer -ao alsa music.mp3·mplayer -ao pulse music.mp3·mplayer -ao oss music.mp3- Shuffle a playlist
mplayer -novideo -shuffle -playlist playlist.m3u- tmux session
tmux new-session -s jukebox· Ctrl+b, then d ·tmux attach -t jukebox- Speed and external subtitles
mplayer -speed 1.5 video.mp4·mplayer -sub video.en.srt video.mp4- In-player keys
- Space pause/resume · ←/→ seek · 9/0 volume · f fullscreen · m mute · v subtitles · q exit