How to Load Multiple Files into an mpv Playlist?
This article provides the exact command-line syntax and methods
required to load multiple media files or entire directories into an
mpv media player playlist directly from your terminal. You
will learn how to append files sequentially, pass multiple arguments,
use wildcards for specific file types, and leverage playlists or
directories to streamline your playback experience.
Loading Multiple Specific Files
To open multiple specific files at once in mpv, you
simply list them as separate arguments after the command. The player
will automatically queue them in the order they are listed.
mpv video1.mp4 video2.mkv audio1.mp3Loading Multiple Files with Wildcards
If you want to load all files of a specific format or all files
within a current directory, you can use the shell’s wildcard
(*) expansion.
- Load everything in the current folder:
mpv *- Load all files of a specific format (e.g., MP4s):
mpv *.mp4Loading an Entire Directory
Instead of listing individual files, you can pass the path to a
directory. mpv will scan the folder and play all compatible
media files found inside.
mpv /path/to/your/media_folder/Appending Files to a Running mpv Instance
If you already have an mpv session open and want to add
files to the current playlist from another terminal window without
restarting the player, you can use the --input-ipc-server
option.
- Start mpv with a socket:
mpv --input-ipc-server=/tmp/mpvsocket video1.mp4- Append a new file from another terminal:
echo '{ "command": ["loadfile", "video2.mkv", "append"] }' | socat - /tmp/mpvsocketUseful Playlist Navigation Shortcuts
Once your files are loaded into the terminal playlist, you can control playback using your keyboard:
ENTERor>: Skip to the next file in the playlist.BS(Backspace) or<: Go back to the previous file in the playlist.