{"id":15017227,"url":"https://github.com/ajatt-tools/mpvacious","last_synced_at":"2026-02-12T06:16:38.830Z","repository":{"id":37076623,"uuid":"284816063","full_name":"Ajatt-Tools/mpvacious","owner":"Ajatt-Tools","description":"🍜 Adds mpv keybindings to create Anki cards from movies and TV shows.","archived":false,"fork":false,"pushed_at":"2025-04-29T00:52:31.000Z","size":573,"stargazers_count":694,"open_issues_count":11,"forks_count":58,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-15T05:07:42.594Z","etag":null,"topics":["ajatt","anki","anki-cards","flashcards","language-learning","lua","mpv","mpv-script","spaced-repetition","subs2srs","subtitles","yomichan"],"latest_commit_sha":null,"homepage":"https://tatsumoto-ren.github.io/blog/mining-from-movies-and-tv-shows.html","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ajatt-Tools.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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,"zenodo":null},"funding":{"custom":"https://tatsumoto.neocities.org/blog/donating-to-tatsumoto.html"}},"created_at":"2020-08-03T22:01:08.000Z","updated_at":"2025-05-13T19:28:23.000Z","dependencies_parsed_at":"2023-02-16T00:46:04.474Z","dependency_job_id":"417b28c4-19f2-4b6c-93ea-ce54a4c6d6a5","html_url":"https://github.com/Ajatt-Tools/mpvacious","commit_stats":{"total_commits":638,"total_committers":29,"mean_commits":22.0,"dds":"0.11285266457680254","last_synced_commit":"aa86597d5e65c9c40b12841a945be7a3cd0fb7b3"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ajatt-Tools%2Fmpvacious","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ajatt-Tools%2Fmpvacious/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ajatt-Tools%2Fmpvacious/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ajatt-Tools%2Fmpvacious/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ajatt-Tools","download_url":"https://codeload.github.com/Ajatt-Tools/mpvacious/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254276447,"owners_count":22043867,"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":["ajatt","anki","anki-cards","flashcards","language-learning","lua","mpv","mpv-script","spaced-repetition","subs2srs","subtitles","yomichan"],"created_at":"2024-09-24T19:50:04.736Z","updated_at":"2026-02-12T06:16:38.824Z","avatar_url":"https://github.com/Ajatt-Tools.png","language":"Lua","readme":"[![AUR](https://img.shields.io/badge/AUR-install-blue?style=for-the-badge\u0026logo=ArchLinux)](https://aur.archlinux.org/packages/mpv-mpvacious/)\n[![Chat](https://img.shields.io/badge/chat-join-green?style=for-the-badge\u0026logo=Telegram\u0026logoColor=green)](https://ajatt.top/blog/join-our-community.html)\n[![Support](https://img.shields.io/badge/support-developer-orange?style=for-the-badge\u0026logo=Patreon\u0026logoColor=orange)](https://ajatt.top/blog/donating-to-tatsumoto.html)\n\nhttps://github.com/user-attachments/assets/466d1aa7-c7d1-4ea2-a296-0835d3700962\n\n# mpvacious\n\nMpvacious is a user script for [mpv](https://wiki.archlinux.org/title/Mpv)\nthat offers utilities for creating and modifying Anki flashcards from movies and TV shows.\nIt allows you to select subtitle lines, create audio clips and images, and send them to Anki.\nThe script supports secondary subtitles, configurable media formats, and customizable keyboard bindings.\nMpvacious works best with [Goldendict-ng](https://xiaoyifang.github.io/goldendict-ng/) or [Rikaitan](https://rikaitan.ajatt.top/).\nWatch a [📽️ video demonstration](https://ajatt.top/blog/vid/sentence_mining_with_mpvacious.mp4).\n\n✨ Ajatt-Tools is looking for **[new contributors](#contributing)**!\n\n## Requirements\n\nYou need to install some third-party programs before you install mpvacious.\n\n\u003ctable\u003e\n\u003ctr\u003e\n    \u003cth\u003e\u003ca href=\"https://www.gnu.org/gnu/about-gnu.html\"\u003eGNU/Linux\u003c/a\u003e\u003c/th\u003e\n    \u003cth\u003e\u003ca href=\"https://www.gnu.org/proprietary/malware-microsoft.en.html\"\u003eWindows 10+\u003c/a\u003e\u003c/th\u003e\n    \u003cth\u003e\u003ca href=\"https://www.gnu.org/proprietary/malware-apple.en.html\"\u003emacOS\u003c/a\u003e\u003c/th\u003e\n    \u003cth\u003eComments\u003c/th\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n    \u003ctd\u003e\u003ca href=\"https://wiki.archlinux.org/index.php/Mpv\"\u003empv\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003ca href=\"https://sourceforge.net/projects/mpv-player-windows/files\"\u003empv\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003ca href=\"https://mpv.io/installation/\"\u003empv\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003empvacious is a user-script for mpv. Get mpv v0.41.0 or newer.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n    \u003ctd\u003e\u003ca href=\"https://wiki.archlinux.org/index.php/Anki\"\u003eAnki\u003c/a\u003e\u003c/td\u003e\n    \u003ctd colspan=\"2\" align=\"center\"\u003e\u003ca href=\"https://apps.ankiweb.net/\"\u003eAnki\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n    \u003ctd colspan=\"3\" align=\"center\"\u003e\u003ca href=\"https://ankiweb.net/shared/info/2055492159\"\u003eAnkiConnect\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003eInstall from AnkiWeb.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n    \u003ctd\u003e\u003ca href=\"https://www.archlinux.org/packages/core/x86_64/curl/\"\u003ecurl\u003c/a\u003e\u003c/td\u003e\n    \u003ctd colspan=\"2\" align=\"center\"\u003e\u003ca href=\"https://curl.haxx.se/\"\u003ecurl\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003eInstalled by default on all platforms except Windows 7.\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n    \u003ctd\u003e\u003ca href=\"https://www.archlinux.org/packages/extra/x86_64/xclip/\"\u003exclip\u003c/a\u003e or \u003ca href=\"https://archlinux.org/packages/extra/x86_64/wl-clipboard\"\u003ewl-copy\u003c/a\u003e\u003c/td\u003e\n    \u003ctd\u003e\u003c/td\u003e\n    \u003ctd\u003epbcopy\u003c/td\u003e\n    \u003ctd\u003eTo copy subtitle text to clipboard.\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\nInstall all dependencies at once (on [Arch-based](https://www.parabola.nu/)\n[distros](https://www.gnu.org/distros/free-distros.en.html)):\n\n```\nsudo pacman -Syu mpv curl xclip --needed\ntrizen -S anki\n```\n\n## Prerequisites\n\n* A guide on how to set up Anki can be found [on our site](https://tatsumoto.neocities.org/blog/setting-up-anki.html).\n* If you're on a [Windows](https://www.fsf.org/windows) or a [Windows-like](https://reactos.org/) machine,\n  a mpv build by `shinchiro` is recommended.\n* **macOS** users are advised to use [homebrew](https://brew.sh/) or manually add `mpv` to `PATH`.\n* Note that it is not recommended to use FlatPak or similar containers.\n  If you still want to, [read this](howto/flatpak.md).\n* Make sure that your build of mpv supports encoding of audio and images.\n  This shell command can be used to test it.\n\n  ```\n  $ mpv 'test_video.mkv' --loop-file=no --frames=1 -o='test_image.jpg'\n  ```\n\n  If the command fails, find a compatible build on the [mpv website](https://mpv.io/installation/)\n  or instead install FFmpeg and [enable FFmpeg support](#configuration) in `mpvacious`'s config file.\n* Most problems with adding audio or images to Anki cards can be fixed\n  by installing FFmpeg and enabling it settings.\n\n## Installation\n\nThere are multiple ways you can install `mpvacious`.\n\nWe recommend using GNU/Linux.\nWindows is not recommended,\nbut we acknowledge that some people haven't switched to GNU/Linux yet.\n\n### From the AUR\n\n`mpvacious` can be installed with the [mpv-mpvacious](https://aur.archlinux.org/packages/mpv-mpvacious/) package.\nThis method will install mpvacious to `/etc/mpv`.\n\n### Using Bash on GNU/Linux and macOS\n\n*Requires `curl` and `unzip`.*\n\nRun [install.sh](scripts/install.sh) with this command:\n\n```sh\n/bin/bash -c \"$(curl -fsSL https://raw.githubusercontent.com/Ajatt-Tools/mpvacious/HEAD/scripts/install.sh)\"\n```\n\nOn GNU/Linux, we try to detect what package manager variant of the config location you're using, with precedent being:\n\n```\n~/.var/app/io.mpv.Mpv     (flatpak)\n~/snap/mpv\n~/snap/mpv-wayland\n~/.config/mpv\n```\n\nTo install into any of these locations, make sure the ones above it don't exist.\n\n### Using Powershell on Windows\n\nOpen [Powershell](https://learn.microsoft.com/en-us/powershell/).\n\n*Optional, needed to run a remote script the first time if not enabled already:*\n\n```powershell\nSet-ExecutionPolicy RemoteSigned -Scope CurrentUser\n```\n\nRun [install.ps1](scripts/install.ps1) with this command:\n\n```powershell\nirm https://raw.githubusercontent.com/Ajatt-Tools/mpvacious/HEAD/scripts/install.ps1 | iex\n```\n\n**NOTE**: If this command is run in an mpv installation directory with `portable_config`,\nit'll install there instead of `AppData`.\n\n### Development mode - Using git\n\nInstalling Mpvacious in development mode allows contributors to easily test their changes.\nWith this setup, any changes made to the *.lua files will be applied immediately after restarting mpv.\n\n#### First approach\n\nClone the repository, then create a symlink from the `mpvacious` directory to the mpv config directory.\n\nCommands for GNU/Linux:\n\n```bash\ngit clone 'https://github.com/Ajatt-Tools/mpvacious.git'\nmkdir -p ~/.config/mpv/scripts/\ncd mpvacious\nbash scripts/symlink.sh\n```\n\nTo update an existing installation, use `git` in the project folder.\n\n```bash\ngit pull\n```\n\n#### Second approach\n\nClone the repo directly into the `mpv/scripts` directory.\n\nCommands for GNU/Linux:\n\n```bash\nmkdir -p ~/.config/mpv/scripts/\ngit clone 'https://github.com/Ajatt-Tools/mpvacious.git' ~/.config/mpv/scripts/mpvacious\n```\n\nTo update an existing installation, use `git`.\n\n```\ncd ~/.config/mpv/scripts/mpvacious \u0026\u0026 git pull\n```\n\n### Manually\n\nThis way is not recommended because it's easy to make a mistake during the process\nand end up with a broken installation.\n\n`mpvacious` is a user-script for mpv,\nso it has to be installed in the directory `mpv` reads its user-scripts from.\n\n| OS                 | Location                                         |\n|--------------------|--------------------------------------------------|\n| GNU/Linux or macos | `~/.config/mpv/scripts/`                         |\n| Windows            | `C:/Users/Username/AppData/Roaming/mpv/scripts/` |\n\nDownload\n[the latest release](https://github.com/Ajatt-Tools/mpvacious/releases)\nor [the master branch](https://github.com/Ajatt-Tools/mpvacious/archive/refs/heads/master.zip)\nfor a development version, and extract the \"mpvacious\" folder\nto your [mpv scripts](https://github.com/mpv-player/mpv/wiki/User-Scripts) directory.\n\n\u003cdetails\u003e\n\n\u003csummary\u003eExpected directory tree\u003c/summary\u003e\n\n```\n~/.config/mpv/scripts\n|-- other script 1\n|-- other script 2\n|-- mpvacious\n|   |-- main.lua\n|   |-- helpers.lua\n|   `-- other files\n`-- other script 3\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eA note for mpv v0.32 and older\u003c/summary\u003e\n\nOlder versions of `mpv` don't know how to handle user-scripts in subdirectories.\nYou need to tell mpv where to look for `mpvacious`.\n\nOpen or create  `~/.config/mpv/scripts/modules.lua` and add these lines:\n```\nlocal mpv_scripts_dir_path = os.getenv(\"HOME\") ..  \"/.config/mpv/scripts/\"\npackage.path = package.path .. ';' .. os.getenv(\"HOME\") .. '/.config/mpv/scripts/mpvacious/?.lua'\nfunction load(relative_path) dofile(mpv_scripts_dir_path .. relative_path) end\nload(\"mpvacious/main.lua\")\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\n\u003csummary\u003eA note for Celluloid\u003c/summary\u003e\n\nIn [Celluloid](https://www.archlinux.org/packages/community/x86_64/celluloid/)\nuser scripts are installed in `/.config/celluloid/scripts/`.\nWhen following the instructions above, replace `.config/mpv` with `.config/celluloid`\nand optionally `mpvacious` with the name of the folder mpvacious is cloned into.\n\n\u003c/details\u003e\n\n## Configuration\n\nThe config file should be created by the user, if needed.\n\n| OS                 | Config location                                                   |\n|--------------------|-------------------------------------------------------------------|\n| GNU/Linux          | `~/.config/mpv/script-opts/subs2srs.conf`                         |\n| Windows            | `C:/Users/Username/AppData/Roaming/mpv/script-opts/subs2srs.conf` |\n| Windows (portable) | `mpv.exe folder/portable_config/script-opts/subs2srs.conf`        |\n\nIf a parameter is not specified\nin the config file, the default value will be used.\nmpv doesn't tolerate spaces before and after `=`.\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"mpvacious/config/default_config.conf\"\u003eExample configuration file\u003c/a\u003e\n\u003c/p\u003e\n\nIf the first field is empty, it will be set contain the string `[empty]`.\nOtherwise, Anki won't allow mpvacious to add new notes.\nThis won't happen if the sentence field is first in the note type settings.\n\n**Tip**: Try [our official note type](https://ankiweb.net/shared/info/1557722832)\nif you don't want to configure note fields yourself.\nAlternatively, we have a collection of user-created note types, which you can browse\n[here](https://github.com/Ajatt-Tools/AnkiNoteTypes).\n\nIf you are having problems playing media files on older mobile devices,\nset `audio_format` to `mp3` and/or `snapshot_format` to `jpg`.\nOtherwise, I recommend sticking with `opus` for audio,\nand `avif` or `webp` for images,\nas they greatly reduce the size of the generated files.\n\nIf you still use AnkiMobile (the [proprietary](https://www.gnu.org/proprietary/) Anki app),\nset `opus_container` to `m4a` or `webm`. I'll allow iOS to play Opus files, while still maintaining\ncompatibility with non-Apple devices. For ancient iOS devices, set `opus_container` to\n[`caf`](https://en.wikipedia.org/wiki/Core_Audio_Format). CAF plays only on Anki Desktop,\nAnkiWeb in Safari and AnkiMobile, and is really not recommended. (Please note that\n[Lockdown Mode](https://support.apple.com/en-us/105120) completely disables Opus and AVIF support,\nthough you may try to add an exception for AnkiMobile.)\n\nIf no matter what mpvacious fails to create audio clips and/or snapshots,\nchange `use_ffmpeg` to `yes`.\nBy using ffmpeg instead of the encoder built in mpv you can work around most encoder issues.\nYou need to have `ffmpeg` installed for this to work.\n\n### Key bindings\n\nThe user may change some global key bindings, though this step is not necessary.\nSee [Usage](#usage) for the explanation of what they do.\n\n| OS        | Config location                                    |\n|-----------|----------------------------------------------------|\n| GNU/Linux | `~/.config/mpv/input.conf`                         |\n| Windows   | `C:/Users/Username/AppData/Roaming/mpv/input.conf` |\n\nDefault bindings:\n\n```\na            script-binding mpvacious-menu-open\n\nCtrl+g       script-binding mpvacious-animated-snapshot-toggle\n\nCtrl+n       script-binding mpvacious-export-note\n\nCtrl+b       script-binding mpvacious-update-selected-note\nCtrl+B       script-binding mpvacious-overwrite-selected-note\n\nCtrl+m       script-binding mpvacious-update-last-note\nCtrl+M       script-binding mpvacious-overwrite-last-note\n\ng            script-binding mpvacious-quick-card-menu-open\nAlt+g        script-binding mpvacious-quick-card-sel-menu-open\n\nCtrl+c       script-binding mpvacious-copy-primary-sub-to-clipboard\nCtrl+C       script-binding mpvacious-copy-secondary-sub-to-clipboard\nCtrl+t       script-binding mpvacious-autocopy-toggle\n\nH            script-binding mpvacious-sub-seek-back\nL            script-binding mpvacious-sub-seek-forward\n\nAlt+h        script-binding mpvacious-sub-seek-back-pause\nAlt+l        script-binding mpvacious-sub-seek-forward-pause\n\nCtrl+h       script-binding mpvacious-sub-rewind\nCtrl+H       script-binding mpvacious-sub-replay\nCtrl+L       script-binding mpvacious-sub-play-up-to-next\n\nCtrl+v       script-binding mpvacious-secondary-sid-toggle\nCtrl+k       script-binding mpvacious-secondary-sid-prev\nCtrl+j       script-binding mpvacious-secondary-sid-next\n```\n\n**Note:** A capital letter means that you need to press Shift in order to activate the corresponding binding.\nFor example, \u003ckbd\u003eCtrl+M\u003c/kbd\u003e actually means \u003ckbd\u003eCtrl+Shift+m\u003c/kbd\u003e.\n`mpv` accepts both variants in `input.conf`.\n\n## Usage\n\n* [Create a card](howto/create_card.md)\n* [Quick card creation](howto/create_quick_card.md)\n* [Updating selected cards](howto/update_selected_card.md)\n* [Open the \"Add\" dialog](howto/add_dialog.md)\n* [Usage with Rikaitan](howto/yomichan.md)\n* [Usage with GoldenDict](howto/goldendict.md)\n\n### Global bindings\n\n**Menu:**\n\n* \u003ckbd\u003ea\u003c/kbd\u003e - Open `advanced menu`.\n\n**Enable\\Disable animation:**\n\n* \u003ckbd\u003eCtrl+g\u003c/kbd\u003e - If animation is enabled, animated snapshots will be generated instead of static images.\n  Animated snapshot are like GIFs (just in a different format)\n  and will capture the video from the start to the end times selected.\n\n**Make a card:**\n\n* \u003ckbd\u003eCtrl+n\u003c/kbd\u003e - Export a card with the currently visible subtitle line on the front.\nUse this when your subs are well-timed,\nand the target sentence doesn't span multiple subs.\n\n**Quick card creation:**\n\n* \u003ckbd\u003eg\u003c/kbd\u003e - Quick card creation menu.\n* \u003ckbd\u003eAlt+g\u003c/kbd\u003e - Quick card creation, card selection menu.\n\n**Update the selected cards:**\n\n* \u003ckbd\u003eCtrl+b\u003c/kbd\u003e - Append to the media fields of the selected Anki cards.\n* \u003ckbd\u003eCtrl+Shift+b\u003c/kbd\u003e - Overwrite media fields of the selected Anki cards.\n\n**Update the last card:**\n\n* \u003ckbd\u003eCtrl+m\u003c/kbd\u003e - Append to the media fields of the newly added Anki card.\n* \u003ckbd\u003eCtrl+Shift+m\u003c/kbd\u003e - Overwrite media fields of the newly added Anki card.\n\n**Clipboard:**\n\n* \u003ckbd\u003eCtrl+c\u003c/kbd\u003e - Copy current subtitle string to the system clipboard.\n* \u003ckbd\u003eCtrl+t\u003c/kbd\u003e - Toggle automatic copying of subtitles to the clipboard.\n\n**Seeking:**\n\n* \u003ckbd\u003eShift+h\u003c/kbd\u003e and \u003ckbd\u003eShift+l\u003c/kbd\u003e - Seek to the previous or the next subtitle.\n* \u003ckbd\u003eAlt+h\u003c/kbd\u003e and \u003ckbd\u003eAlt+l\u003c/kbd\u003e - Seek to the previous, or the next subtitle, and pause.\n* \u003ckbd\u003eCtrl+h\u003c/kbd\u003e - Seek to the start of the currently visible subtitle. Use it if you missed something.\n* \u003ckbd\u003eCtrl+Shift+h\u003c/kbd\u003e - Replay current subtitle line, and pause.\n* \u003ckbd\u003eCtrl+Shift+l\u003c/kbd\u003e - Play until the end of the next subtitle, and pause. Useful for beginners who need\n  to look up words in each and every dialogue line.\n\n**Secondary subtitles:**\n\n* \u003ckbd\u003eCtrl+v\u003c/kbd\u003e - Toggle visibility.\n* \u003ckbd\u003eCtrl+k\u003c/kbd\u003e - Switch to the previous subtitle if it's not already selected.\n* \u003ckbd\u003eCtrl+j\u003c/kbd\u003e - Switch to the next subtitle if it's not already selected.\n\n### Menu options\n\nAdvanced menu has the following options:\n\n* \u003ckbd\u003ei\u003c/kbd\u003e - Cycle between display modes.\n* \u003ckbd\u003ev\u003c/kbd\u003e - Open subtitle selection menu. Upon exit, this menu exports selected subtitles into Advanced menu.\n\n* \u003ckbd\u003ef\u003c/kbd\u003e - Increment number of cards to update.\n  Only affects note updating, including quick card creation.\n  The number of cards to update is reset to 1 upon updating a note.\n* \u003ckbd\u003eshift+f\u003c/kbd\u003e - Decrement number of cards to update.\n\n* \u003ckbd\u003ec\u003c/kbd\u003e - Interactive subtitle selection.\n  The range of the currently displayed subtitle line is selected. The selection then grows both ways based on the following displayed lines.\n  It does nothing if there are no subs on screen.\n\n* \u003ckbd\u003eshift+s\u003c/kbd\u003e - Set the start time to the current sub.\n  The selection then grows forward based on the following displayed lines.\n  The default selection spans across the range of the currently displayed subtitle line.\n* \u003ckbd\u003eshift+e\u003c/kbd\u003e - Set the end time to the current sub.\n  The selection then grows backward based on the following displayed lines.\n  The default selection spans across the range of the currently displayed subtitle line.\n\nThen seek with \u003ckbd\u003eShift+h\u003c/kbd\u003e and \u003ckbd\u003eShift+l\u003c/kbd\u003e to the previous/next line that you want to add.\nPress \u003ckbd\u003en\u003c/kbd\u003e to make the card.\n\n* \u003ckbd\u003er\u003c/kbd\u003e - Forget all previously saved timings and associated dialogs.\n\n* \u003ckbd\u003ez\u003c/kbd\u003e and \u003ckbd\u003eShift+z\u003c/kbd\u003e - Adjust subtitle delay.\n\nIf above fails, you have to manually set timings.\n\n* \u003ckbd\u003es\u003c/kbd\u003e - Set the start time.\n  The selection then grows forward based on the following displayed lines.\n  The default selection spans across the selected start point and the end of the subtitle line.\n* \u003ckbd\u003ee\u003c/kbd\u003e - Set the end time.\n  The selection then grows backward based on the following displayed lines.\n  The default selection spans across the selected end point and the start of the subtitle line.\n\nThen, as earlier, press \u003ckbd\u003en\u003c/kbd\u003e to make the card.\n\nAlternatively:\n\n* \u003ckbd\u003em\u003c/kbd\u003e to update the last card(s). (\u003ckbd\u003eShift+m\u003c/kbd\u003e to overwrite)\n* \u003ckbd\u003eb\u003c/kbd\u003e to update the selected card(s). (\u003ckbd\u003eShift+b\u003c/kbd\u003e to overwrite)\n\n**Tip**: change playback speed by pressing \u003ckbd\u003e[\u003c/kbd\u003e and \u003ckbd\u003e]\u003c/kbd\u003e\nto precisely mark start and end of the phrase.\n\n### New Note Timer\n\nThe **new note timer** feature allows mpvacious to automatically detect and update new Anki notes\nwithout manual intervention. When enabled, mpvacious will periodically check for new notes\nand automatically add media (audio and images) to them if they match your configured note type.\n\nTo enable this feature, set `enable_new_note_timer=yes` in your [config file](mpvacious/config/default_config.conf).\nYou can adjust how often mpvacious checks for new notes with the `new_note_timer_interval_seconds` setting.\n\nWhen this feature is enabled, you no longer need to manually press \"m\" to update notes\nthat were created externally (e.g., with GoldenDict or Rikaitan). The process happens automatically\nin the background.\n\n### My subtitles are not in sync\n\nIf subs are badly timed, first, you can shift timings\nusing key bindings provided by mpv (usually \u003ckbd\u003ez\u003c/kbd\u003e and \u003ckbd\u003eShift+z\u003c/kbd\u003e).\n\nAlternatively, try to re-time subtitles.\nRead [Retiming subtitles](https://tatsumoto.neocities.org/blog/retiming-subtitles) for details.\n\n### Example sentence card\n\nWith mpvacious you can make cards like this in just a few seconds.\n\n![card-example](https://user-images.githubusercontent.com/69171671/92900057-e102d480-f40e-11ea-8cfc-b00848ca66ff.png)\n\n### Audio cards\n\nIt is possible to make a card with just audio, and a picture\nwhen subtitles for the show you are watching aren't available, for example.\nmpv by default allows you to do a `1` second exact seek by pressing \u003ckbd\u003eShift+LEFT\u003c/kbd\u003e and \u003ckbd\u003eShift+RIGHT\u003c/kbd\u003e.\nOpen the mpvacious menu by pressing \u003ckbd\u003ea\u003c/kbd\u003e, seek to the position you need, and set the timings.\nThen press \u003ckbd\u003eg\u003c/kbd\u003e to invoke the `Add Cards` dialog.\nHere's a [video demonstration](https://redirect.invidious.io/watch?v=BXhyckdHPGE).\n\nIf the show is hard-subbed, you can use\n[transformers-ocr](https://tatsumoto.neocities.org/blog/mining-from-manga.html)\nto recognize and add text to the card.\n\n### Secondary subtitles\n\nIf you want to add a translation to your cards, and you have the subtitles in that language,\nyou can add them as secondary subtitles if you run `mpv` with `--secondary-sid=\u003csid\u003e` parameter,\n`sid` being the track identifier for the subtitle.\n\nYou also need to specify `secondary_field` in the [config file](#Configuration)\nif it is different from the default.\n\nIf you want to load secondary subtitles **automatically**, don't modify the run parameters\nand instead set the desired languages in the config file (`secondary_sub_lang` option).\n\nSecondary subtitles will be visible when hovering over the top part of the `mpv` window.\n\nhttps://user-images.githubusercontent.com/69171671/188492261-909ba3e8-b82c-493f-88cf-0ec953dfcfe1.mp4\n\nBy pressing \u003ckbd\u003eCtrl\u003c/kbd\u003e+\u003ckbd\u003ev\u003c/kbd\u003e you can control secondary sid visibility without using the mouse.\n\n### Other tools\n\nIf you don't like the default *Rikaitan Search* tool, try:\n\n* [GoldenDict](howto/goldendict.md)\n* Clipboard Inserter browser add-on\n([chrome](https://chrome.google.com/webstore/detail/clipboard-inserter/deahejllghicakhplliloeheabddjajm))\n([firefox](https://addons.mozilla.org/ja/firefox/addon/clipboard-inserter/))\n* An HTML page ([1](https://pastebin.com/zDY6s3NK)) ([2](https://pastebin.com/hZ4sawL4))\nto paste the contents of your clipboard to\n\nYou can use any HTML page as long as it has \\\u003cbody\\\u003e\\\u003c/body\\\u003e in it.\n\n### Additional mpv key bindings\n\nI recommend adding these lines to your [input.conf](#key-bindings) for smoother experience.\n\n```\n# vim-like seeking\nl seek 5\nh seek -5\nj seek -60\nk seek 60\n\n# Cycle between subtitle files\nK cycle sub\nJ cycle sub down\n\n# Add/subtract 50 ms delay from subs\nZ add sub-delay +0.05\nz add sub-delay -0.05\n\n# Adjust timing to previous/next subtitle\nX sub-step 1\nx sub-step -1\n```\n\nFor example, check out [my input.conf file](https://github.com/tatsumoto-ren/dotfiles/blob/main/.config/mpv/input.conf).\n\n## Profiles\n\nMpvacious supports config profiles.\nTo make use of them, create a new config file called `subs2srs_profiles.conf`\nin the same folder as your [subs2srs.conf](#Configuration).\nInside the file, define available profile names (without `.conf`) and the name of the active profile:\n\n```\nprofiles=subs2srs,english,german\nactive=subs2srs\n```\n\nIn the example above, I have three profiles.\nThe first one is the default,\nthe second one is for learning English,\nthe third one is for learning German.\n\nThen in the same folder create config files for each of the defined profiles.\nFor example, below is the contents of my `english.conf` file:\n\n```\ndeck_name=English sentence mining\nmodel_name=General\nsentence_field=Question\naudio_field=Audio\nimage_field=Extra\n```\n\nYou don't have to redefine all settings in the new profile.\nSpecify only the ones you want to be different from the default.\n\nTo cycle profiles, open the advanced menu by pressing \u003ckbd\u003ea\u003c/kbd\u003e and then press \u003ckbd\u003ep\u003c/kbd\u003e.\nAt any time you can see what profile is active in the menu's status bar.\n\n## Contributing\n\nSince Ajatt-Tools is a distributed effort, we **highly welcome new contributors**!\n\nInstall the project in development mode to easily test and commit your changes.\n\nTry these libre code editors with [lua](https://wiki.archlinux.org/title/Lua) support:\n\n- [pycharm-community-edition](https://archlinux.org/packages/?name=pycharm-community-edition) with [emmylua](https://emmylua.github.io/installation.html)\n- [vscodium](https://aur.archlinux.org/packages/vscodium) with [sumneko.lua](https://open-vsx.org/extension/sumneko/lua)\n\nMake sure to use an automatic code formatter.\nAlso see: [Running tests](#running-tests).\n\n## Running tests\n\n```bash\nMPVACIOUS_TEST=TRUE mpv 'path/to/some/file.mkv'\n```\n\nThe results will be printed to the console.\n\n## Custom Subtitle Filtering\n\nWhile the default subtitle processing in `mpvacious` is sufficient for most users, you can define custom logic to handle specific needs, such as filtering bilingual subtitles.\n\n### Setup\n\nTo use this feature, create the following directory and an **empty `main.lua**` file (required to prevent `mpv` from reporting a plugin error):\n\n| OS                 | Plugin Location                                                           |\n| ------------------ | ------------------------------------------------------------------------- |\n| GNU/Linux          | `~/.config/mpv/scripts/subs2srs_subtitle_filter/`                         |\n| Windows            | `C:/Users/Username/AppData/Roaming/mpv/scripts/subs2srs_subtitle_filter/` |\n| Windows (portable) | `mpv.exe folder/portable_config/scripts/subs2srs_subtitle_filter/`        |\n\n**Structure:**\n\n```text\nsubs2srs_subtitle_filter/\n├── main.lua                     # Empty file to satisfy mpv\n└── subs2srs_subtitle_filter.lua # Your custom logic\n```\n\n### How it Works\n\n`mpvacious` will automatically load `subs2srs_subtitle_filter.lua` and look for these exported functions:\n\n* **`preprocess(text)`**: The primary function for filtering or reformatting raw subtitles.\n* **`trim(text)`**: Overrides the internal trimmer. Note that internal trimming must be enabled via `clipboard_trim_enabled=yes` in `subs2srs.conf`.\n* **`init(config)`**: Called on load to setup keybindings or initialize custom logic. It receives a **configuration table** containing:\n  * **`get_mode`**: A **getter function** that returns the current `custom_subtitle_filter_mode`, ensuring your script stay in sync with profile switches.\n\n### Configuration\n\nYou can control the filter's behavior via `subs2srs.conf` and its profiles:\n\n* **`custom_subtitle_filter_mode`**: A string accessible via `config.get_mode()` in `init`. Use this to dynamically toggle or change filtering logic when switching profiles—for example, set it to `japanese` in your JP profile and `none` in others.\n\n### Using the Example Script\n\nAn example script is available within the repository at:\n`scripts/subs2srs/.github/RELEASE/custom_subtitle_filter_example.lua`\n\nThis script is designed to extract Japanese lines from bilingual subtitles. While originally tailored for **Japanese/Chinese** pairs, it works for any language combined with Japanese because it identifies lines based on the presence of **Kana**.\n\nTo use it, copy the example's logic into your `subs2srs_subtitle_filter.lua` and modify it to suit your workflow.\n\n## Hacking\n\nIf you want to modify this script\nor make an entirely new one from scratch,\nthese links may help.\n\n* https://mpv.io/manual/master/#lua-scripting\n* https://github.com/mpv-player/mpv/blob/master/player/lua/defaults.lua\n* https://github.com/erjiang/subs2srs\n","funding_links":["https://tatsumoto.neocities.org/blog/donating-to-tatsumoto.html"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajatt-tools%2Fmpvacious","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fajatt-tools%2Fmpvacious","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fajatt-tools%2Fmpvacious/lists"}