Anki add-on: Watch Foreign Language Movies with Anki

The add-on can be used to convert videos (or audios) with subtitles to Anki. The video will be split into separate scenes/phrases. It was inspired by subs2srs. SUBS2SRS & RELATED TOOLS http://subs2srs.sourceforge.net/ — subs2srs allows you to create import files for Anki or other Spaced Repetition Systems (SRS) based on your favorite foreign language movies and TV shows to aid in the language learning process. http://www.randomhacks.net/substudy/ — substudy: A tool for learning languages using TV shows and subtitles. https://ankiweb.net/shared/info/1983257427 - Sub FFmpeg Cards Cutter - if you have the movie and subtitles downloaded on your PC, you can use this add-on, which cuts the movie according to the subtitles. https://github.com/Ajatt-Tools/mpvacious - Adds mpv keybindings to create Anki cards from movies and TV shows https://github.com/killergerbah/asbplayer - Browser-based media player and Chrome extension for subtitle sentence mining https://ripose-jp.github.io/Memento - a mpv-based video player that makes studying Japanese easier with a built in popup dictionary https://yallmp.com - Y'ALL Media Player lets you master vocabulary, listening comprehension and pronunciation by turning any media into an interactive study session with integrated dictionary lookups, subtitles editing, Anki flashcard creation and more! https://github.com/rampaa/JL - JL is a program for looking up Japanese words and expressions https://mortii.github.io/anki-morphs/ - AnkiMorphs (MorphMan) is an Anki add-on that can rearrange your cards based on how well you know the words on them and how important the words are to learn. https://ankiweb.net/shared/info/909420026 - FrequencyMan allows you to sort your new cards by word frequency, familiarity, and other useful factors. HOW TO INSTALL (ANKI 25.02) If you're on Windows or Linux, installing the add-on with the code should be enough to make it work, but it's recommended to additionally install ffmpeg. If you're on Mac, it's better to additionally install mpv and ffmpeg via brew and restart Anki. Otherwise, Tools > Generate Mobile Cards might fail to encode mp3 and mp4 and will only work with opus and webm, because the mpv version that is packaged with Anki might not have libmp3lame and libx264 encoders built-in. HOW TO INSTALL (ANKI 2.1.49) Install the add-on. Install FFmpeg from http://ffmpeg.org . On Windows it can be downloaded from https://www.gyan.dev/ffmpeg/builds/ On macOS it can be installed using brew - https://trac.ffmpeg.org/wiki/CompilationGuide/macOS#ffmpegthroughHomebrew , i.e. install "brew" and then run "brew install ffmpeg". Download mpv videoplayer from https://mpv.io For Windows, use https://sourceforge.net/projects/mpv-player-windows/files then click on "stable" or "64bit/32bit" subfolder and download mpv from there. For Linux, mpv might be already installed alongside with Anki sometime ago. For macOS, mpv can be installed via brew either by using "brew cask install mpv" to quickly install the latest binary version or "brew install mpv" to compile and install mpv from source. For Windows, update the PATH environment variable in the User or System variables by adding folders that contain mpv.exe and ffmpeg.exe. Here's a short guide how to update the PATH environment variable on Windows 10 - https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/ - or a quick screencast - https://streamable.com/2b1l6 Restart Anki. Another possible method to install mpv and FFmpeg on Windows without manually updating the PATH environment variable is to use scoop or https://chocolatey.org . HOW TO USE Tools - Generate Video Cards... (Ctrl+M). Select Video and Audio. Select Subs 1. Maybe change some other options. Select Deck and Model. Maybe click on Preview to see how many cards will be created. Click Go! In the Phrases mode, the add-on will only use the subtitles' timings to generate cards, i.e. everything that doesn't have subtitles will be ignored like the start of the video or scene changes where usually no one speaks and there are no subtitles. In the Movie mode, the add-on will change the subtitles' timings to make them continuous to be able to watch the video from start to finish without missing anything, i.e. the end time of each line in the subtitles will be changed to match the start time of the next line. HOW TO REVIEW ON MOBILE Tools - Generate Mobile Cards... from the main window or Edit > Generate Mobile Cards ... from the card browser window Export an apkg file or sync with AnkiWeb. For AnkiDroid 2.17, if you want video on cards, the "subs2srs (video)" note type is recommended as the "movies2anki" note type may not look good. A slightly updated version of the card template is available at https://ankiweb.net/shared/info/2061725225 ("Learn German A1: Nicos Weg"). YOUTUBE VIDEOS (OUTDATED) This is how it may look in action using movies2anki card template. This is how it may look in action using movies2anki (subs2srs - video) card template. ADD-ON CONFIGURATION It can be edited via Tools > Add-ons > ... > Config. The "preferred languages" can be set similarly to the mpv.conf file below. If it's not empty, it'll be used to select automatically audio and external subtitles if there's more than one (while making a new deck of cards). { "audio fade in/out": 0.1, "join lines with": "<br>", "join sentences with": "<br>", "preferred languages": "", "video encoding settings (webm)": "-c:v libvpx-vp9 -crf 30 -b:v 0 -c:a libopus -b:a 64k", "video extension": "mp4", "video height": 320, "video width": -2 } MPV CONFIGURATION The add-on now remembers the selected audio stream (that was used to make a new deck of cards) and adding 'alang=eng' or 'aid=1' to mpv.conf is no longer needed. --- If the video file contains multiple audio streams, it might be useful to create mpv.conf with alang=eng to select the English audio track by default. For example, mpv.conf can look like this: sub-visibility=no sub-auto=fuzzy slang=eng alang=eng audio-file-auto=fuzzy save-position-on-quit=yes autofit-larger=100%x100% geometry=50%:50% It can be downloaded from this link - https://gist.github.com/kelciour/dbb573812e9a45eaa7d5b123f1ccf822 For Windows, mpv.conf can be added to the same folder as mpv.exe or %APPDATA%/mpv/mpv.conf, i.e. C:\Users\USERNAME\AppData\Roaming\mpv\mpv.conf For macOS & Linux, it'd be ~/.config/mpv/mpv.conf All the options can be found in the mpv manual - https://mpv.io/manual/master/#configuration-files | https://mpv.io/manual/master/#options ADDITIONAL INFORMATION The add-on doesn't generate any audio/video files by default. Instead it can play a part of the original video/audio file with mpv video player using --start and --end options. If the original video/audio file has been deleted or moved to a different folder, the add-on will try to find and play video/audio from the collection.media folder that were generated using Tools - Generate Mobile Cards option. By default, new cards will be added to the deck with the name of the video file. It can be changed by selecting a deck from the list of existing decks or by typing a different name for the deck. Set "Gap between Phrases" option to 0.0 to split subtitles by sentences or disable it to prevent joining subtitles into sentences. The add-on contains 4 default note types: • movies2anki (add-on) – Video + Audio • movies2anki (subs2srs) – Picture + Audio • movies2anki (subs2srs - video) – Video + Audio (desktop) / HTML5 Video + Audio (mobile) • movies2anki (subs2srs - audio) – Audio DEFAULT HOTKEYS R – replay Ctrl+R – replay video [ - replay the previous card and the current card. ] - replay the current card and the next card. Shift+[ - join the current card with the previous card (and remove the previous card). Shift+] - join the current card with the next card (and remove the next card). , – subtract 0.25 ms. from the start time . – add 0.25 ms. to the start time < (Shift+,) – subtract 0.25 ms. from the end time > (Shift+.) – add 0.25 ms. to the end time EXPORT CONDENSED AUDIO Open the card browser, select a few cards that were generated by the add-on and click Edit - Export Condensed Audio. The cards with the same Path field will be joined into a single audio file. The "Store temporary audio files in the collection.media folder" option makes sense to check if you intend to later use, or maybe already used, Tools - Generate Mobile Cards to review cards on mobile. With the full movies or series, maybe try it in a new Anki profile (File - Switch Profile) by generating a new deck of cards with "Gap between Phrases" set to 1.25 or 1.75 and "Pad Timings" set to 750ms or something similar. For more information, see "Optimizing Passive Immersion: Condensed Audio" by Matt vs. Japan - https://youtu.be/QOLTeO-uCYU - and also "Online Directory Of Condensed Shows for Passive Listening" by No_Swing_6301 - https://www.reddit.com/r/MassImmersionApproach/comments/k2yflx/online_directory_of_condensed_shows_for_passive/ Known Alternatives: https://github.com/dxing97/subs2cia — subs2cia: extract subtitled dialogue from audiovisual media for use in language acquisition KNOWN ISSUES & BUG TRACKER https://github.com/kelciour/movies2anki/issues SUPPORT ME ON LAVA.TOP If you like my work or have found it useful, consider supporting me with a cup of coffee at https://app.lava.top/2342402818?tabId=donate It will help a bit with my current financial situation and will be very much appreciated. Thank you. -- N. <kelciour@gmail.com>

GitHub repository: ajatt-tools/mpvacious
Repository description: 🍜 Adds mpv keybindings to create Anki cards from movies and TV shows.
Languages: Lua, Shell, PowerShell, Makefile
Topics: ajatt, anki, anki-cards, flashcards, goldendict, language-learning, lua, mpv, mpv-script, rikaitan, spaced-repetition, subs2srs, subtitles