Skip to content

Instantly share code, notes, and snippets.

@HariSekhon
Last active February 3, 2026 04:09
Show Gist options
  • Select an option

  • Save HariSekhon/e88f566a822a043d02d5f8768167dbcd to your computer and use it in GitHub Desktop.

Select an option

Save HariSekhon/e88f566a822a043d02d5f8768167dbcd to your computer and use it in GitHub Desktop.
mpv.md from HariSekhon/Knowledge-Base repo: https://github.com/HariSekhon/Knowledge-Base

MPV

https://mpv.io/

:octocat: mpv-player/mpv

Summary

Excellent open source video player with Lua scripting capabilities to customize its behaviours.

Based on MPlayer but more features like being able to skip to a specific time in the video by clicking the time tracker bar at the bottom.

Install

On macOS use Homebrew:

brew install mpv

Basic Usage

Just give a file argument to the mpv command:

mpv "$file"

Keyboard Shortcuts

Key Description
] Increase Speed
[ Decrease Speed
Backspace Reset Speed to 1
Space Pause / Unpause
s Take a screenshot
Option-s Rapid continual screenshots

Config

You can find my MPV config here - it is symlinked along with my other configs by make link in that project:

:octocat: HariSekhon/DevOps-Bash-tools - configs/.config/mpv/mpv.conf

Scripts

You can find my MPV scripts here:

:octocat: HariSekhon/DevOps-Bash-tools - configs/.config/mpv/scripts/

Start Video At Double Speed

This is much better than using a hotkey to speed up QuickTime to play a video because MPV keeps the same playback speed so when you pause and unpause (even if you set the speed with a hotkey), whereas QuickTime unpauses back to slow 1x speed.

Yes I really watch most videos at double speed because most humans are simply far too slow.

mpv --speed=2 "$file"

Resuming Playback At Last Position

You can either append the --save-position-on-quit command line switch:

mpv --save-position-on-quit "$file"

or for more permanence, put it in the MPV config file as shown above.

:octocat: HariSekhon/DevOps-Bash-tools - configs/.config/mpv/mpv.conf

For more advanced conditional resume, I now instead use this Lua code so I only resume for videos of a certain length and only if I am a certain amount of time into them:

:octocat: HariSekhon/DevOps-Bash-tools - configs/.config/mpv/scripts/resume-conditions.lua

Auto-Delete Video File After Played to Completion

I use the following code to auto-delete a video if it is played to completion for videos I only ever intend to watch once:

:octocat: HariSekhon/DevOps-Bash-tools - configs/.config/mpv/scripts/resume-conditions.lua

It is only activated if you set the environment variable:

MPV_DELETE_ON_EOF=1 mpv "$file"

In DevOps-Bash-tools .bash.d/ I set the alias mpvd alias to make this shorter:

alias mpvd='MPV_DELETE_ON_EOF=1 mpv --speed 2

Screenshot Video

In mpv hitting the s key takes a screenshot.

But if you type Option-s on macOS then it takes continual screenshots until you stop it.

Warning: this can run up GB of space in thousands of screenshots quite quickly though

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment