How to Auto Close mpv After Playlist Finishes?
This article provides a quick solution for users looking to automatically exit the mpv media player once a playlist or file finishes playing. By utilizing a specific command-line option or adding a line to your configuration file, you can ensure the application closes itself without manual intervention. Below, you will find the exact command option, examples of how to use it in the terminal, and how to make the setting permanent.
The command option to close mpv automatically is:
--keep-open=no
By default, mpv may stop on the last frame of the video or the end of
the playlist depending on your configuration. Setting
--keep-open=no explicitly tells the player to terminate the
process as soon as the playback of the current playlist concludes.
How to Use It in the Terminal
If you are launching mpv from the command line, you can append the option directly to your command:
mpv --keep-open=no video1.mp4 video2.mp4
You can also use the shorthand version, as no is often
the default behavior unless overridden in your global settings:
mpv --no-keep-open video1.mp4 video2.mp4
Making the Behavior Permanent
If you want mpv to always close after a playlist finishes without
having to type the option every time, you can add it to your
configuration file (mpv.conf).
- Locate or create your
mpv.conffile (usually found in~/.config/mpv/on Linux/macOS or%APPDATA%/mpv/on Windows). - Add the following line to the file:
keep-open=no
Once saved, mpv will automatically exit after every playlist finishes by default.