Skip to content

mpvacious

mpvacious is a user script made for of mpv, a cross platform media player. mpv itself can be used on pretty much anything, including streamed videos. However, mpvacious was designed for downloaded videos, and almost certainly does not work on streamed videos.

If you are looking to create cards using streamed videos, I recommend asbplayer.


Installation

Installation steps for mpvacious can be found here.

You must install this under your mpv scripts folder. This scripts folder does not exist by default; it must be created manually.

Expected file structure (click here)
C:/Users/USERNAME/AppData/Roaming
└─ mpv
    └─ scripts
        └─ mpvacious
            ├─ ankiconnect.lua
            ├─ main.lua
            ├─ subs2srs.lua
            └─ ...
~/.config
└─ mpv
    └─ scripts
        └─ mpvacious
            ├─ ankiconnect.lua
            ├─ main.lua
            ├─ subs2srs.lua
            └─ ...

Configuration

You will have to change mpvacious's configuration in order for mpvacious to work with JPMN.

Note

In case nothing works, always make sure to check the official documentation, as it is guaranteed to have the latest instructions if they ever change.

  1. Navigate to %APPDATA%\Roaming You can access this by opening the file manager, and typing %APPDATA%\Roaming in the location field.
  2. Create the mpv folder if it doesn't exist, and open the folder.
  3. Create the script-opts folder if it doesn't exist, and open the folder. By now, you should be under:
    %APPDATA%\Roaming\mpv\script-opts
    
  4. Create a text file with your favorite text editor. If you do not have any custom text editor downloaded, notepad should work. TODO exact steps on creating the text file
  5. Copy/paste the following, and save as subs2srs.conf:

    Example config file (click here)
    # A full example config file can always be found in the mpvacious repository:
    # - https://github.com/Ajatt-Tools/mpvacious#configuration
    # - https://github.com/Ajatt-Tools/mpvacious/blob/master/.github/RELEASE/subs2srs.conf
    
    # ================= #
    # REQUIRED SETTINGS #
    # ================= #
    # These settings are required in order to be usable by JPMN.
    
    # Model names are listed in `Tools -> Manage note types` menu in Anki.
    model_name=JP Mining Note
    
    # Field names as they appear in the selected note type.
    # If you set `audio_field` or `image_field` empty,
    # the corresponding media file will not be created.
    sentence_field=Sentence
    #secondary_field=SentEng  # Not used by the note. This is ignored entirely.
    audio_field=SentenceAudio
    image_field=Picture
    
    
    # ========================= #
    # COMMONLY CHANGED SETTINGS #
    # ========================= #
    
    # Uncomment to disable native language subs entirely.
    #secondary_sub_visibility=auto
    
    # If you do not want the Anki browser to appear every time you add a card,
    # uncomment the following:
    #disable_gui_browse=yes
    
    
    
    # ====================== #
    # MEDIA QUALITY SETTINGS #
    # ====================== #
    # The following settings provide saner defaults to audio and image quality,
    # when using opus and webp. Feel free to play around with these as you see fit.
    
    # Sane values are 16k-32k for opus, 64k-128k for mp3.
    audio_bitrate=32k
    
    # Quality of produced image files. 0 = lowest, 100=highest.
    #snapshot_quality=15
    snapshot_quality=50
    
    # Image dimensions
    # If either (but not both) of the width or height parameters is -2,
    # the value will be calculated preserving the aspect-ratio.
    #snapshot_width=-2
    #snapshot_height=200
    snapshot_width=800
    snapshot_height=-2
    

    Ensure that your file is indeed a .conf file when saved. If your file browser says that it is a text file, then the file was likely incorrectly saved as subs2srs.conf.txt. TODO exact instructions on renaming

Expected file structure (click here)
C:/Users/Username/AppData/Roaming
└─ mpv
    └─ script-opts
        └─ subs2srs.conf

The following installs the correct configuration, along with all the recommended settings stated below.

mkdir -p ~/.config/mpv/script-opts
# TODO change this to the master branch eventually
curl https://raw.githubusercontent.com/arbyste/jp-mining-note/dev/docs/docs/assets/setupmpvacious/subs2srs.conf > ~/.config/mpv/script-opts/subs2srs.conf

Be sure to restart mpv after changing the config to make sure your configuration is applied.

The example configuration includes plenty of commonly changed settings by default. In general, I recommend looking through the example configuration to see if there are other options that you may want to change.


Card Creation

To create JPMN cards with mpvacious:

  • Create a card from Yomitan. The text is usually gotten via a texthooker.
  • Within mpv, navigate to the desired subtitle, and then press Ctrl+M.
    • If you instead want to add audio from multiple subtitles at a time:
      • Navigate to the beginning subtitle.
      • Press A+C
      • Navigate to the ending subtitle.
      • Press M.
  • Much more can be found under mpvacious's usage section.

Other

  • A common issue with mpvacious is that the SentenceReading field may differ from the Sentence field, say, if you export multiple subtitles into one card. See the FAQ on how to fix it.

  • You have to export the audio as mp3 if you plan on using AnkiMobile (iOS), or AnkiWeb.


Last update: May 15, 2024