{"id":21616030,"url":"https://github.com/9beach/mpv-config","last_synced_at":"2025-04-11T07:30:22.747Z","repository":{"id":135434636,"uuid":"608708047","full_name":"9beach/mpv-config","owner":"9beach","description":"Lua scripts and settings for mpv","archived":false,"fork":false,"pushed_at":"2024-06-16T08:37:10.000Z","size":2496,"stargazers_count":15,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-25T05:03:38.533Z","etag":null,"topics":["copy","lua","modernx","mpv","osc","paste","playlist","restore","save","volume","youtube-download"],"latest_commit_sha":null,"homepage":"","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/9beach.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-02T15:19:49.000Z","updated_at":"2025-02-14T08:01:27.000Z","dependencies_parsed_at":"2024-01-27T07:31:07.268Z","dependency_job_id":"58520f65-6664-424c-8aff-d131fdd1bf90","html_url":"https://github.com/9beach/mpv-config","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9beach%2Fmpv-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9beach%2Fmpv-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9beach%2Fmpv-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/9beach%2Fmpv-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/9beach","download_url":"https://codeload.github.com/9beach/mpv-config/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248358821,"owners_count":21090440,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["copy","lua","modernx","mpv","osc","paste","playlist","restore","save","volume","youtube-download"],"created_at":"2024-11-24T22:13:24.666Z","updated_at":"2025-04-11T07:30:22.692Z","avatar_url":"https://github.com/9beach.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# My Lua scripts and settings for **MPV**\n\nThis repository contains several [Lua](http://lua.org) scripts and settings\nI wrote for open-source media player [mpv](https://mpv.io). Many parts in my\ncode are from internet obviously.\n\n## Installation\n\nYou can install each Lua script below individually by just copying it. Please\nnotice that the installation script is probably just for me, and also that\nsubtitle settings of `mpv.conf` and `script-opts/on-file-loaded.conf` are for\nKoreans. Anyhow it installs all the scripts and settings of this repository.\n\nFirst [install mpv](https://mpv.io/installation/) and then download\n[`9beach/mpv-config`](https://github.com/9beach/mpv-config/archive/refs/heads/main.zip).\nBefore install it, please notice that:\n\n1. To play and download media from URLs with **mpv**, you need to install\n   [yt-dlp](https://github.com/yt-dlp/yt-dlp/releases). For\n   _Microsoft Windows_ users, download\n   [yt-dlp.exe](https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.exe)\n   and copy it to `C:\\Windows`.\n2. To download the highest resolution media, and preserve chapter markers,\n   you need to install [ffmpeg](https://ffmpeg.org).\n\nIn Mac or Linux, run the following from the terminal. Then it installs\n`9beach/mpv-config` to your **mpv** configuration directory. Your original\n**mpv** settings are copied to `~/Downloads` directory if it exists.\n\n```console\ncd mpv-config-main\n./install.sh\n```\n\nIf your machine has NVIDIA GPU installed, run `./install.sh nvidia`.\n\nIf you prefer `portable_config`, run the following.\n\n```\nMPV_CONF_PATH=\"path-to-my-mpv/portable_config\" ./install.sh\n```\n\nIn _Microsoft Windows_, run the following from the `Command Prompt`, or\ndouble-click `install.bat` in file explorer.\n\n```console\nC:\\path-to\\mpv-config-main\u003e install.bat\n```\n\nIf your machine has NVIDIA GPU installed, run `install.bat nvidia`.\n\nIf you prefer `portable_config`, run the following.\n\n```\nC:\\path-to\\mpv-config-main\u003e SET MPV_CONF_PATH=C:\\path-to-my-mpv\\portable_config\nC:\\path-to\\mpv-config-main\u003e install.bat\n```\n\nNotice that there are no quotation marks in `MPV_CONF_PATH` definition.\n\n## Lua scripts\n\nYou can copy and install each script below to your **mpv** scripts directory,\nwhich is usually `~/.config/mpv/scripts/` or `%APPDATA%/mpv/scripts/`. Please\nsee [https://mpv.io/manual/master/#files](https://mpv.io/manual/master/#files)\nand [https://mpv.io/manual/master/#script-location](https://mpv.io/manual/master/#script-location)\nfor more information.\n\n### [copy-and-paste.lua](https://github.com/9beach/mpv-config/blob/main/scripts/copy-and-paste.lua)\n\nThis script gives **mpv** the capability to copy and paste file paths and URLs.\nYou can paste and play multiple lines of media file paths, media URLs, and\nHTML page URLs including YouTube, Twitter, Twitch.tv, Naver, Kakao...\n\nYou can edit key bindings below in `script-opts/copy-and-paste.conf`:\n\n- Pastes file paths or URLs in clipboard to playlist. (`Alt+V, Ctrl+V, Meta+V`)\n- Appends file paths or URLs in clipboard to playlist. (`Alt+b, Ctrl+b, Meta+b`)\n- Appends file paths or URLs in clipboard to current track.\n  (`Alt+v, Ctrl+v, Meta+v`)\n- Copies file path or URL of current track. (`Alt+c, Ctrl+c, Meta+c`)\n\nPlease notice that:\n\n1. To play and download media from URLs with **mpv**, you need to install\n   [yt-dlp](https://github.com/yt-dlp/yt-dlp/releases). For\n   _Microsoft Windows_ users, download\n   [yt-dlp.exe](https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.exe)\n   and copy it to `C:\\Windows`.\n2. For _OSX_ users, when option key pressed, the context menu of a file\n   reveals `Copy as pathname` menu item (or just press `⌘⌥C`). You\n   can paste the pull paths of local media to **mpv** with this.\n\n### [web-download.lua](https://github.com/9beach/mpv-config/blob/main/scripts/web-download.lua)\n\nYou can download media URLs of **mpv** playlist from web sites including\nYouTube, Twitter, Twitch.tv, Naver, Kakao, ... with this script:\n\n- Downloads currently playing media. (`Ctrl+d, Alt+d, Meta+d`)\n- Downloads all media of **mpv** playlist. (`Ctrl+D, Alt+D, Meta+D`)\n- Downloads currently playing media as a audio file. (`Ctrl+e, Alt+e, Meta+e`)\n- Downloads all media of **mpv** playlist as audio files.\n  (`Ctrl+E, Alt+E, Meta+E`)\n- Downloads currently playing media with alternative option.\n  (`Ctrl+y, Alt+y, Meta+y`)\n- Downloads all media of **mpv** playlist with alternative option.\n  (`Ctrl+Y, Alt+Y, Meta+Y`)\n\nYou can edit key bindings above in `script-opts/web-download.conf`. Please\nnotice that:\n\n1. To play and download media from URLs with **mpv**, you need to install\n   [yt-dlp](https://github.com/yt-dlp/yt-dlp/releases). For _Microsoft\n   Windows_ users, download\n   [yt-dlp.exe](https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp.exe)\n   and copy it to `C:\\Windows`.\n2. To download the highest resolution media, and preserve chapter markers,\n   you need to install [ffmpeg](https://ffmpeg.org).\n\n### [simple-playlist.lua](https://github.com/9beach/mpv-config/blob/main/scripts/simple-playlist.lua)\n\nThis script provides the script messages below:\n\n- script-message simple-playlist sort name-asc (`Alt+n, Ctrl+n, Meta+n`)\n- script-message simple-playlist sort name-asc startover\n- script-message simple-playlist sort date-desc (`Alt+t, Ctrl+t, Meta+t`)\n- script-message simple-playlist sort date-desc startover\n\n`simple-playlist sort` also support `size-asc`, `size-desc`, `date-asc`,\n`name-desc` with or without `startover`. It's quite fast. Of course,\nthe time complexity of my sorting algorithm is **O(nlog n)** for **Lua** data,\nbut for the **mpv** system call, i.e., `mp.commandv('playlist-move', i, j)`,\nthe time complexity is **O(n)**.\n\n- script-message simple-playlist shuffle\n- script-message simple-playlist shuffle startover (`Alt+s, Ctrl+s, Meta+s`)\n- script-message simple-playlist reverse (`Alt+R, Ctrl+R, Meta+R`)\n- script-message simple-playlist playfirst (`Alt+a, Ctrl+a, Meta+a`)\n- script-message simple-playlist playlast (`Alt+z, Ctrl+z, Meta+z`)\n- script-message simple-playlist show-text 5 (`Alt+p, Ctrl+p, Meta+p`)\n- script-message simple-playlist show-osc 5 (`Alt+l, Ctrl+l, Meta+l`)\n- script-message simple-playlist hide (`Alt+k, Ctrl+k, Meta+k`)\n- script-message simple-playlist save (`Alt+P, Ctrl+P, Meta+P`)\n\n`5` in `show-text` and `show-osc` is the duration in seconds. To keep the code\nsimple, the playlist is not refreshed automatically, so another `show-text` or\n`show-osc` is needed to refresh the playlist.\n\nYou can edit key bindings in `input.conf`.\n\n```\nMETA+t script-message simple-playlist sort date-desc\nMETA+n script-message simple-playlist sort name-asc\nMETA+s script-message simple-playlist shuffle startover\n...\n```\n\nMany parts in my code are from \u003chttps://github.com/jonniek/mpv-playlistmanager\u003e.\n\n### [on-file-loaded.lua](https://github.com/9beach/mpv-config/blob/main/scripts/on-file-loaded.lua)\n\nThis script provides the functions below:\n\n- Always starts from the begining when `do_not_resume` is set even if mpv option\n  `save-position-on-quit` is set. (`Ctrl+*`)\n- Shows OSC always when an audio file (that is of known audio extensions or\n  has no video) is loaded.\n- Plays even in paused state when a new file is loaded.\n- Does not show subtitle if lower-case path matches given patterns.\n- Does not show subtitle if audio language matches given values.\n- Resets **mpv** geometry when an non-audio file (that is not of known audio\n  extensions and has video) is loaded. When you turn on this feature, **mpv**\n  can escape from small rectangle when a `webm` media has video even if\n  `mpv.conf` has settings below.\n\n  ```\n  [extension.webm]\n  geometry=800x800+100%+100%\n  ```\n\n`watch_later` setting for each file overrides subtitle visibilities above.\nSo if you change the visibility of subtitle in a file, **mpv** remembers it\njust for that file if you resume to play it.\n\nYou can edit the settings in `script-opts/on-file-loaded.conf`.\n\n### [finder-integration.lua](https://github.com/9beach/mpv-config/blob/main/scripts/finder-integration.lua)\n\nThis script provides the script messages below:\n\n- `reveal-in-finder` runs `explorer.exe`/`Finder.app`/`Nautilus` with\n  currently playing file selected. (`Ctrl+f, Alt+f, Meta+f`)\n- `touch-file` updates the modification time of currently playing file. If you\n  want to mark it to delete later or do something else with, it will help you.\n  (`Ctrl+x, Alt+x, Meta+x`)\n\nYou can edit the settings in `script-opts/finder-integration.conf`.\n\n### [autoload-ex.lua](https://github.com/9beach/mpv-config/blob/main/scripts/autoload-ex.lua)\n\nThis script provides the functions below:\n\n- Like well-known `autoload`, automatically loads playlist entries by scanning\n  the directory a file is located in when starting playback.\n- Provides many sorting methods and shuffling when scanning the directory.\n- Provides keybinds for the functions of scannig the directory, sorting and\n  shuffling the files.\n- Remembers the sorting and shuffling states of the directory. So when you\n  open a file in the directory next time, `autoload-ex` restores previous\n  sorting states of the directory.\n- Even though you set `disabled=yes` in `script-opts/autoload-ex.conf` and\n  call `autoload-ex` manually by keybinds, `autoload-ex` scans entries of the\n  directory automatically next time.\n- If you set `disabled=no` and call `autoload-ex remove-others` manually by \n  keybinds, `autoload-ex` does not scan entries of the directory next time.\n\nNotice that when manually called, `autoload-ex` does reload and sort not\nthe current playlist entries, but the files in the directory of the current \ntrack. It means that `autoload-ex` remembers the state of a directory, not \nthat of a playlist.\n\nThis script provides the script messages below:\n\n- script-message autoload-ex shuffle\n- script-message autoload-ex shuffle startover (`Alt+S, Ctrl+S, Meta+S`)\n- script-message autoload-ex sort name-asc (`Alt+N, Ctrl+N, Meta+N`)\n- script-message autoload-ex sort name-desc\n- script-message autoload-ex sort name-asc startover\n- script-message autoload-ex sort name-desc startover\n- script-message autoload-ex sort date-asc\n- script-message autoload-ex sort date-desc (`Alt+T, Ctrl+T, Meta+T`)\n- script-message autoload-ex sort date-asc startover\n- script-message autoload-ex sort date-desc startover\n- script-message autoload-ex sort size-asc\n- script-message autoload-ex sort size-desc\n- script-message autoload-ex sort size-asc startover\n- script-message autoload-ex sort size-desc startover\n- script-message autoload-ex remove-others (`Alt+R, Ctrl+R, META+R`)\n\nYou can edit key bindings in `input.conf`.\n\n```\nMETA+SHIFT+n script-message autoload-ex sort name-asc\nMETA+SHIFT+t script-message autoload-ex sort date-desc\nMETA+SHIFT+s script-message autoload-ex shuffle startover\nMETA+SHIFT+r script-message autoload-ex remove-others\n...\n```\n\nMany parts in my code are from\n\u003chttps://github.com/mpv-player/mpv/blob/master/TOOLS/lua/autoload.lua\u003e,\n\u003chttp://lua-users.org/wiki/SecureHashAlgorithm\u003e, and\n\u003chttps://www.snpedia.com/extensions/Scribunto/engines/LuaCommon/lualib/bit32.lua\u003e.\n\n### [on-startup-shutdown.lua](https://github.com/9beach/mpv-config/blob/master/scripts/on-startup-shutdown.lua)\n\nThis script provides the functions below:\n\n- Saves and restores sound volume level automatically.\n\n`watch_later` setting for each file overrides sound volume level above.\nSo if you change the sound volume level of a file, **mpv** remembers it just\nfor that file if you resume to play it.\n\nYou can edit the settings in `script-opts/on-startup-shutdown.conf`.\n\n### [modernx-and-quotes.lua](https://github.com/9beach/mpv-config/blob/main/scripts/modernx-and-quotes.lua)\n\nThe original code is from [ModernX](https://github.com/cyl0/ModernX).\n\n\u003e An MPV OSC script based on\n\u003e [mpv-osc-modern](https://github.com/maoiscat/mpv-osc-modern/) that aims to\n\u003e mirror the functionality of MPV's stock OSC while with a more modern-looking\n\u003e interface.\n\n![img](modernx.png)\n\nI added a simple feature. In idle state, it shows a quote about writing and art.\nYou can copy the text with `script-message copy-quote`, and also add your\nfavorite quotes to `script-opts/modernx-and-quotes.txt` file.\n\n![img](modernx-and-quotes.png)\n\nTo install **modernx-and-quotes**, please copy `scripts/modernx-and-quotes.lua`,\n`script-opts/osc.conf`, and `script-opts/modernx-and-quotes.txt` to your system.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F9beach%2Fmpv-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F9beach%2Fmpv-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F9beach%2Fmpv-config/lists"}