Skip to main content

Building a playlist from the command line

Passing multiple files to mpv creates an internal playlist and plays each entry in order:
Files are played sequentially. All command-line options apply to every file unless you scope them with --{ / --} markers (see per-file options).

Loading a playlist file

Use --playlist=<file> to load a playlist file. Supported formats include M3U, PLS, and plain text files with one path or URL per line. XML playlist formats are not supported.
Only use --playlist with files you trust. Playlist files can reference arbitrary protocols, including unsafe ones. If you need to load an untrusted playlist, review its contents first. Unsafe entries require --load-unsafe-playlists to open.
You can also open many playlist files directly (without --playlist) and mpv will detect the format automatically. The --playlist option forces the playlist demuxer.

Playlist navigation

Keyboard controls

Mouse controls

Interactive selection

Press g-p to open a searchable playlist picker in the console. Navigate with arrow keys or type to filter entries.

Playlist options

Starting position

The default value of auto defers to the playback resume mechanism — if a watch-later resume file exists for an entry in the list, playback begins there automatically.

Shuffle

Play entries in random order:

Looping

--loop (alias for --loop-file) counts the number of additional seeks to the beginning. --loop=1 plays the file twice. In contrast, --loop-playlist counts full playthroughs, so --loop-playlist=2 plays the whole playlist twice.
--loop-playlist=force is like inf but does not skip entries that fail to play, which can be useful for internet radio streams under poor network conditions.

A-B loop

Set loop points within a single file to repeat a segment:
During playback, press l to set or clear loop points interactively. Each press of l toggles through: set point A → set point B → clear both.

Ordered chapters (linked MKV)

Matroska files can contain ordered chapters that reference segments in other files. mpv supports this by default, automatically loading referenced files from the same directory:
If the referenced files are in a different location, provide an explicit playlist of segment files:

Clipboard and runtime loading

Press Ctrl+v during playback to append the file path or URL in the clipboard to the current playlist. If nothing is playing, the file starts immediately. You can also reload the current file (clearing the network cache) with Ctrl+r.

Scripting: playlist properties and commands

When writing Lua or JavaScript scripts, the following properties expose the current playlist state:

loadfile command

Load a file or URL into the playlist at runtime. The flags argument controls the behavior:

loadlist command

Load an entire playlist file into the internal playlist:

Accessing playlist entries in Lua