60 3
Contact Author Sign in to rate

Watch Foreign Language Movies with Anki

0.22MB. Updated 2020-10-14.
The author has shared 33 other item(s).

Description

This add-on is a very rough and basic adaptation of movies2anki with some new options and experimental shortcuts and something may not work as expected. It was inspired by subs2srs. It's been tested on Windows and Ubuntu. It should work on macOS too after installing mpv and FFmpeg via brew, but maybe there're some issues that I'm not aware of. SUBS2SRS - 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 WHAT'S NEW 2020-06-04 - 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, please 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/ HOW TO INSTALL 1. Install the add-on. 2. 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". 3. 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. 4. 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 5. Restart Anki. Another possible and maybe more simple method to install mpv and FFmpeg on Windows without manually updating the PATH environment variable is to use https://chocolatey.org HOW TO USE 1. Tools - Generate Video Cards... (Ctrl+M) 2. Select Video and Subs 1. 3. Change some options. 4. Click on Preview to see how many cards will be created. 5. Select Deck and Model. 6. Click Go! HOW TO REVIEW ON MOBILE 1. Tools - Generate Mobile Cards... 2. Export an apkg file or sync with AnkiWeb. YOUTUBE 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. DEMO DECK https://mega.nz/#F!31dGQCyL!IpdQ5u15S_kdsWR6mbti7w CONFIGURATION 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 In the "movies2anki (subs2srs - video)" card template there's no replay button for video. It can be replayed by clicking on any part of the screen. BATCH PROCESSING Replace some characters in the video and subtitles filename with * or ?. DEFAULT HOTKEYS R – replay Ctrl+R – replay video Shift+R - continuous (i.e. without end) video playback. [ - 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 Ctrl+Shift+, – set the start time to default Ctrl+Shift+. – set the end time to default ANKIMOBILE https://gist.githubusercontent.com/kelciour/d574a97f8727d207932452b13476396f/raw/4e881fbf707ba8ae118180818515c871a906b12d/movies2anki-ankimobile-question Update. Thanks to Mike, it looks like "movies2anki (subs2srs - video)" works fine on AnkiMobile and "movies2anki (add-on)" has an echo sound on the back side of the card. As a workaround, it can be fixed either by using <video ...></video> similar to "movies2anki (subs2srs - video)" instead of {{FrontSide}} or by removing [sound:{{Audio}}] from the back side of the card. For some reason, HTML5 Audio doesn't seem to work on AnkiMobile and can't be used as a possible alternative. CHANGELOG 2018-08-11 Initial release. 2018 – 2019 https://gist.github.com/kelciour/caa2e035565d2c8609af915fb07d1336 2020-01-13 Update for Anki 2.1.17+ 2020-02-22 Update for Anki 2.1.20+ 2020-03-25 Fix no video on Windows with mpv 0.32 2020-03-26 Skip incorrect notes on generate mobile cards 2020-04-01 Fix to fully show all subs2srs model names 2020-04-23 Fix no video on Windows with mpv 0.32 2020-04-26 Add basic support for WebVTT (.vtt) subtitles 2020-04-27 Support standalone mpv bulds on macOS 2020-04-27 Try to use vlc on macOS if mpv isn't found 2020-04-29 Fix to try to use mpv bundled with Anki on macOS 2020-05-04 Keep only one snapshot while joining two notes 2020-05-23 Fix for Anki 2.1.26 2020-05-24 Ignore some ASS tags 2020-05-29 Choose the audio track selected by mpv for mobile cards 2020-06-04 Add export condensed audio 2020-06-09 Fix playing the video instead of the audio 2020-06-17 Fix local variable referenced before assignment 2020-06-23 Detect subtitles encoding with chardet 2020-06-28 Update the Id field if the Audio field had been changed with "." or "," shortcuts 2020-06-29 Fix UnicodeEncodeError with condensed audio export 2020-07-07 Fix audio on click not working (MIA Japanese) 2020-07-20 Fix tracks count parsing while generating mobile cards 2020-07-22 Add "audio fade in/out" in the config file (0.25 seconds by default) 2020-08-06 Fix condensed audio file got cut (not fully exported) 2020-08-08 Remove fade in filter to fix no audio on Windows 2020-08-08 Sort filenames in batch mode 2020-10-08 Use pysubs2 for parsing subtitle files 2020-10-08 Support .ass subtitles 2020-10-14 Fix to ignore subtitles with tags only NOT YET IMPLEMENTED The add-on doesn't work in the Preview window. ADDITIONAL INFORMATION This is the second Anki add-on. The first one is mpv2anki – create subs2srs cards with video player. Nickolay <kelciour@gmail.com>

Download

As add-ons are programs downloaded from the internet, they are potentially malicious. You should only download add-ons you trust.

Supported Anki versions:

To download this add-on, please copy and paste the following code into Anki 2.1:

939347702

If you were linked to this page from the internet, please open Anki on your computer, go to the Tools menu and then Add-ons>Browse & Install to paste in the code.

This add-on previously supported Anki 2.0. You can download the last version supporting 2.0 here. As Anki 2.0 has been discontinued, no support is available for this version.

All Anki 2.1.x Add-Ons Contact Author

Reviews

on 1610306739
It doesn't work, but it worked before and I didn't update my version of Anki and I tried to reinstall the add-on.
Everything works except the mobile card generation which gives this error.


Anki 2.1.33 (3f403040) Python 3.8.0 Qt 5.14.1 PyQt 5.14.1
Platform: Windows 10
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2021-01-10 18:41:33

Caught exception:
Traceback (most recent call last):
File "C:\Users\???????\AppData\Roaming\Anki2\addons21\939347702\player.py", line 519, in run
time_start, time_end = re.match(r"^.*?_(\d+\.\d\d\.\d\d\.\d+)-(\d+\.\d\d\.\d\d\.\d+).*$", fld).groups()
AttributeError: 'NoneType' object has no attribute 'groups'
Comment from author
The "Audio" field is either empty or contains some extra characters and the add-on can't extract the start time and the end time from this field using the pattern matching.

If making a new deck of cards is not an option, maybe open the card browser and search for

"Path:_*" -"Audio:re:^.*?_(\d+\.\d\d\.\d\d\.\d+)-(\d+\.\d\d\.\d\d\.\d+).*$"

It should find cards that don't match the regular expressons pattern.

If it's just a few cards, maybe try to replace the "Audio" field by copying the "Id" field and adding ".mp3"

Otherwise, maybe click on the "Audio" field, press Ctrl+Shift+X to open HTML Editor and let me know what it contains so I could apply a fix and update the addon.
on 1610086904
This is what I've been through.

Anki 2.1.33 (3f403040) Python 3.8.0 Qt 5.14.1 PyQt 5.14.1
Platform: Windows 10
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2021-01-07 17:01:21

Caught exception:
Traceback (most recent call last):
File "C:\Users\hyuni\AppData\Roaming\Anki2\addons21\939347702\movies2anki.py", line 1158, in run
call(cmd)
File "anki\utils.py", line 301, in call
File "subprocess.py", line 854, in __init__
File "subprocess.py", line 1247, in _execute_child
File "subprocess.py", line 549, in list2cmdline
File "os.py", line 816, in fsdecode
TypeError: expected str, bytes or os.PathLike object, not NoneType

-----------------------
How could I fix it? please let me know
---------------------
One more thing, Could you add "smi" into subtitle format please?

I can't wait : )
Comment from author
It looks like the add-on can't locate ffmpeg.exe. If you press Win, type "cmd" to open the Windows Command Prompt, and type "ffmpeg", the output will be something like: 'ffmpeg' is not recognized as an internal or external command.

Download FFmpeg from https://www.gyan.dev/ffmpeg/builds/ if you didn't do it already, unpack it somewhere and update the PATH environment variable by adding the folder that contains ffmpeg.exe and ffprobe.exe, e.g. C:\Programs\ffmpeg\bin, and restart Anki.

How to update the PATH environment variable - https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/

If it's just a few .smi subtitles, it should be possible, I guess, to convert them to .srt with Subtitle Edit.
on 1608721504
Hello Nickolai,

Thank you for all your fantastic app, you might open a Patreon soon maybe ?

All the best,

Marc
on 1608193318
Great plugin!
on 1603185586
Hi great add-on! Running macOS Catalina 10.15.6 but receiving this error when trying to movies2anki-subs2srs-video. Please advise.

Anki 2.1.35 (84dcaa86) Python 3.8.0 Qt 5.14.2 PyQt 5.14.2
Platform: Mac 10.15.6
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2020-10-19 14:07:57
Add-ons possibly involved: ⁨Watch Foreign Language Movies with Anki⁩

Caught exception:
Traceback (most recent call last):
File "/Users/iraklirekhviashvili/Library/Application Support/Anki2/addons21/939347702/movies2anki.py", line 1158, in run
call(cmd)
File "anki/utils.py", line 301, in call
File "subprocess.py", line 854, in __init__
File "subprocess.py", line 1583, in _execute_child
File "posixpath.py", line 152, in dirname
TypeError: expected str, bytes or os.PathLike object, not NoneType

I've tried reinstalling Homebrew on the latest version, restarting the computer and Anki. I noticed this issue was raised by a Windows user to change the PATH variable but not sure how to do this on Mac if applicable.
Comment from author
The add-on can't seem to find ffmpeg to generate screenshots. FFmpeg can be installed with brew and I'm not sure what went wrong.

https://trac.ffmpeg.org/wiki/CompilationGuide/macOS#ffmpegthroughHomebrew

Maybe open the Terminal app, copy-paste the following line and press Return.

which ffmpeg

The output should be something like


User-MacBook-Pro:~ user$ which ffmpeg
/usr/local/bin/ffmpeg

Maybe try to reinstall ffmpeg via brew, i.e.

brew reinstall ffmpeg
on 1600798687
Good job
جزاگم الله الاسلام
on 1599427996
#Edit: thanks!

Debug info:
Anki 2.1.22 (0ecc189a) Python 3.8.0 Qt 5.14.1 PyQt 5.14.1
Platform: Windows 10
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2020-09-05 20:24:37

Caught exception:
Traceback (most recent call last):
File "C:\Users\Aleni\AppData\Roaming\Anki2\addons21\939347702\player.py", line 519, in run
time_start, time_end = re.match(r"^.*?_(\d+\.\d\d\.\d\d\.\d+)-(\d+\.\d\d\.\d\d\.\d+).*$", fld).groups()
AttributeError: 'NoneType' object has no attribute 'groups'
Comment from author before post was edited
Once it happens, open the edit window and take a look at the Audio field. The add-on is looking for something like 00.26.43.226-00.26.47.019 but can't find it and shows this error. This is something I'd like to improve or maybe do differently, but at the moment the Audio field should be left intact.

The easy way to fix it would be to remove the deck and make a new one. As an alternative, if that's okay, I'll update the add-on and use the Id field as a fallback.
on 1599249782
problem solved. thank you
Comment from author
That's great you solved it on your own and I'm sorry for not replying sooner. For the time being, I'm no longer checking AnkiWeb every day for any new comments and only do it once a week or maybe a bit more frequently.sometimes. And if something is urgent it might be better to contact me directly by email kelciour@gmail.com
on 1598717835
Thanks for this lovely addon. It was working good. but after updating anki, I am getting the following error . please fix it.



Debug info:
Anki 2.1.32 (dee7d45d) Python 3.8.0 Qt 5.14.1 PyQt 5.14.1
Platform: Windows 7
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2020-08-29 19:04:12

Caught exception:
Traceback (most recent call last):
File "aqt\webview.py", line 37, in cmd
File "aqt\webview.py", line 123, in _onCmd
File "aqt\webview.py", line 547, in _onBridgeCmd
File "<C:\Program Files\Anki\decorator.pyc:decorator-gen-52>", line 2, in review_link_handler_wrapper
File "anki\hooks.py", line 638, in decorator_wrapper
File "anki\hooks.py", line 635, in repl
File "C:\Users\Mamun7\AppData\Roaming\Anki2\addons21\939347702\player.py", line 751, in myLinkHandler
return _old(reviewer, url)
File "C:\Users\Mamun7\AppData\Roaming\Anki2\addons21\498789867\__init__.py", line 103, in review_link_handler_wrapper
original_review_link_handler(reviewer, url)
File "<C:\Program Files\Anki\decorator.pyc:decorator-gen-40>", line 2, in linkHandler_wrap
File "anki\hooks.py", line 638, in decorator_wrapper
File "anki\hooks.py", line 635, in repl
File "C:\Users\Mamun7\AppData\Roaming\Anki2\addons21\385888438\reviewer.py", line 193, in myLinkHandler
saveThenRefreshFld(reviewer, note, fld, new_val)
File "C:\Users\Mamun7\AppData\Roaming\Anki2\addons21\385888438\reviewer.py", line 153, in saveThenRefreshFld
saveField(note, fld, new_val)
File "C:\Users\Mamun7\AppData\Roaming\Anki2\addons21\385888438\reviewer.py", line 135, in saveField
txt = Editor.mungeHTML(None, txt)
File "aqt\editor.py", line 421, in mungeHTML
File "aqt\gui_hooks.py", line 1606, in __call__
File "aqt\editor.py", line 1219, in reverse_url_quoting
AttributeError: 'NoneType' object has no attribute 'mw'
Comment from author
Thank you for the feedback!

It looks like it's been originated from Edit Field During Review (Cloze) and was reported on https://github.com/BlueGreenMagick/Edit-Field-During-Review-Cloze/issues/34
on 1597418925
Not examined yet, but great idea and work
on 1597196081
Hey, great when I did it on windows laptop. The tag type I chose is movies2anki (subs2srs - video), why doesn't it work with video and audio on Phone
Edit: Woah, fantastic. Can I use it to learn for any language, including Korean?
Thanks a lot of creating it
Comment from author
Yes, definitely. I haven't tested it and if there're any problem, just let me know.
on 1597017742
Works well so far. Good to see an active developer that delivers updates constantly :)
Comment from author before post was edited
This is strange. If I understand it correctly, it looks like mpv plays it fine during review but for some reason ffmpeg cuts it a bit differently with Generate Mobile Cards.

Since it doesn't work on AnkiDroid, I guess, you should be able to reproduce the issue by playing it on desktop from the collection.media folder with your favourite media player or mpv (after using Generate Mobile Cards).

https://docs.ankiweb.net/#/files?id=file-locations

Maybe the add-on still has a bug with converting milliseconds to seconds and vice versa. I believe it's been already fixed a while back but maybe I missed something. If it's true, in the worst case for some cards the audio might start 1 second too early or too late.

Maybe try with this video - https://ted2srt.org/talks/danielle_feinberg_the_magic_ingredient_that_brings_pixar_movies_to_life
For this video Generate Mobile Cards should work without any problem.

Since you're on Windows, maybe try to convert it with subs2srs - http://subs2srs.sourceforge.net
It works a bit differently, but since it uses FFmpeg too, I guess, the result will be the same and the audio will still be out of sync.

Maybe, if you could upload your video/audio file with subtitles somewhere, maybe https://wetransfer.com or https://send.firefox.com or something else, put a link in a reply or send it to me by email <kelciour@gmail.com>.
on 1597013551
Great app! This is kind of subs2srs Ultimate evolution. It would be great, if it had an option to change path by clicking, you know when one moves a file. You can do it with search and replace, of course. Just a suggestion. Keep up the great work
on 1596965016
Hello, thank you for creating this addon. I find it amazing when my friends use it. But I can't use it, can you tell me the tutorial video for Windows, I have installed Friends 1x01 tag (subs2srs) with the link https://mega.nz/folder/31dGQCyL#IpdQ5u15S_kdsWR6mbti7w .This set of cards works, I love it. But when I installed, I did not choose movies2anki - subs2srs.
It happened like this, I hope anyone can give me the tutorial video, it took me 3 days to do but the result is sad

Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools> Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.29 (bbff62bf) Python 3.8.0 Qt 5.14.1 PyQt 5.14.1
Platform: Windows 10
Flags: frz = True ao = True sv = 1
Add-ons, last update check: 2020-08-09 09:34:05

Caught exception:
Traceback (most interesting call last):
File "C: \ Users \ hp 9470m \ AppData \ Roaming \ Anki2 \ addons21 \ 939347702 \ movies2anki.py", line 1119, in run
call (cmd)
File "lib \ site-packages \ anki \ utils.py", line 301, in call
File "subprocess.py", line 854, in __init__
File "subprocess.py", line 1247, in _execute_child
File "subprocess.py", line 549, in list2cmdline
File "os.py", line 816, in fsdecode
TypeError: expected str, bytes or os.PathLike object, not NoneType
Comment from author
Hi, thank you, it's always great to know it's been used by someone.

Try to download FFmpeg from https://ffmpeg.zeranoe.com/builds/ if you didn't do it already, unpack it somewhere and update the PATH environment variable either in the User or System variables by adding the folder that contains ffmpeg.exe and ffprobe.exe, e.g. C:\Programs\ffmpeg\bin, and restart Anki.

How to update the PATH environment variable:
- https://www.architectryan.com/2018/03/17/add-to-the-path-on-windows-10/
on 1595477650
Excellent addon, really helps learning a foreign language.
on 1595426304
Its a very nice add-on thought I have a few problem with it which is the fading(both in condensed audio and in movie2anki mode, I want it turned off). I already looked into the add-on folder and found the lines with "fade" in the .py files but I have no idea how to tinker around it.
Comment from author
Please update the add-on (Tools - Add-ons - Check for Updates), restart Anki, open Tools - Add-ons - ... - Config and set the "audio fade in/out" option to 0.

In case of the condensed audio, if it's a new deck, it might be better, or maybe not, to temporarily create a new deck of cards in a new Anki profile with the "Gap between Phrases" option set to 0.75 or 1.25 to reduce number of gaps.
on 1595174613
Thank you so much! Works very well and it is really, really useful.
on 1594023992
Thanks for this.
Comment from author before post was edited
Try to download FFmpeg from https://ffmpeg.zeranoe.com/builds/ if you didn't do it already, unpack it somewhere and update the PATH environment variable either in the User or System variables by adding the folder that contains ffmpeg.exe and ffprobe.exe - https://streamable.com/2b1l6 - and restart Anki.
on 1593850723
well done !!
on 1593482232
This is such a great feature, hope to see any update, keep it up pal!
on 1593399531
Absolutely incredible, I can't believe the quality of these tools which are very underground and unknown but are of unparalleled value to the language learner. I cringe at myself remembering how I started with Duolingo a long time ago, and now looking at the tools I am using, this being the epitome. Thank you so much for your time you invested working on this tool.

Small issue: extending or cutting the audio/video does not seem to affect the note. It replays the extended/cut audio but it doesn't change the timestamps on the note. %% Edit: Thank you for fixing this so quick!

@ Japanese learners: to generate furigana on your kanji you must use MIA Japanese addon instead of Japanese Support. The latter requires changing the note type to contain 'japanese', which bugs this addon.
Comment from author before post was edited
Thank you for the feedback!

About the issue, if it's about ",", "." and "<", ">" shortcuts, at the moment only the Audio/Video fields will be updated. The Id field is left unchanged to be able to restore the initial timestamps.

I've updated the add-on and now, once the card had been reviewed, the Id field will be updated if it's different from the Audio field. It requires Anki 2.1.22+.
on 1592871093
When I try creating new video cards I get this error:
Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.22 (0ecc189a) Python 3.8.1 Qt 5.14.1 PyQt 5.14.1
Platform: Linux
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2020-06-22 14:55:28
Add-ons possibly involved: ⁨Watch Foreign Language Movies with Anki⁩

Caught exception:
Traceback (most recent call last):
File "/home/diego/.local/share/Anki2/addons21/939347702/movies2anki.py", line 1497, in start
self.startSingleMode()
File "/home/diego/.local/share/Anki2/addons21/939347702/movies2anki.py", line 1610, in startSingleMode
self.model.create_subtitles()
File "/home/diego/.local/share/Anki2/addons21/939347702/movies2anki.py", line 887, in create_subtitles
en_subs = self.load_subtitle(self.en_srt, self.is_ignore_sdh_subtitle, self.join_lines_separator, self.join_sentences_separator, self.is_gap_phrases)
File "/home/diego/.local/share/Anki2/addons21/939347702/movies2anki.py", line 683, in load_subtitle
return read_subtitles(file_content, is_ignore_SDH, join_lines_separator, join_sentences_separator, is_gap_phrases)
File "/home/diego/.local/share/Anki2/addons21/939347702/movies2anki.py", line 184, in read_subtitles
sub_timecode = sub_chunks[1].split(' --> ')
IndexError: list index out of range

I'm using Linux Mint 19.3 specifically, not Ubuntu, although it was working perfectly before.
Comment from author
Thank you. It looks like the add-on can't read the subtitles file. Maybe the subtitles file is in UTF-16 encoding instead of UTF-8.

I've updated the add-on and added a possible fix to support UTF-16 encoding, please use Tools - Add-ons - Check for Updates and restart Anki.
on 1592342093
This is really a fantastic resource - an unbelievable job to have put this together. Can see that this would really be useful - although my issue is that most Chinese subtitles are ”hardcoded" into the video, rather than an accompanying SRS file. There are a few options around this but it does limit the choice a bit.
One problem I'm having is that the audio isn't quite lined up to the "back card" note. Usually the audio just plays the last few words of that subtitled phrase, even though the initial video played the full phrases. Seems weird- and when padding, it just adds length to the initial video (which was fine!). Any thoughts?
Comment from author
Hmm, the video and audio should be in sync, i.e. if the video plays the full subtitled phrase, the audio should play the same full subtitled phrase too. The only difference is that when the audio is playing with mpv, the video window won't be shown.

Something similar to the issue might happen if the Audio and Video fields are different since the add-on will use the Audio field, when playing the audio, and the Video field, when playing the video, but I'm not sure how it could have happened. They should be in sync too.

Maybe, if you could upload your video/audio file with subtitles somewhere, maybe https://wetransfer.com or https://send.firefox.com or something else, put a link in a reply or send it to me by email <kelciour@gmail.com>, and I could reproduce it myself, it would help to shed some light on the issue.
on 1592279930
Is it possible to autocreate cards only with difficult words like here?

-- https://ankiweb.net/shared/info/1152823001

Also does it work only for english?
Comment from author
It's language agnostic and the main options should work just fine for every language as long as subtitles in UTF-8.

For English, and maybe other languages too, the add-on can join a few short subtitles into one long subtitle if it's just one long sentence. The implementation is very naive, it might work for other languages or maybe it's something that can be improved.

About the option to autocreate cards only with difficult words, it won't be a problem to make a separate add-on to do something similar using data from wordfreq - https://github.com/LuminosoInsight/wordfreq - and maybe some other data, since it might be useful on its own, and movies2anki could rely on it to skip making some cards, but it'd be low priority and not something that I can do this or next month before I could clear up my backlog a bit and make a few new add-ons.

- Create subs2srs cards with LDOCE and mpv video player - https://ankiweb.net/shared/info/1937423705
- Import from LDOCE English Dictionary - https://ankiweb.net/shared/info/534294513
- Batch Create Sentence Cards from Books - https://ankiweb.net/shared/info/1200382751
- Convert AudioBooks to Anki - https://ankiweb.net/shared/info/1885548963
on 1591800878
Great!!
I like to use it with the movie2anki software on GitHub (https://github.com/kelciour/movies2anki) for different purposes. One save space on my Anki collection, the second gives audios and videos (if necessary) I want.
on 1591622816
I use this add on to not only learn new languages but to also help remember videos that I find interesting (could be movies, youtube videos or even some lecture videos).

Has changed my life, this add-on.
on 1591348229
I can't recommend this enough; and I can't thank the creator of this add-on enough. For countless reasons, this is one of the most amazing things I have seen done to utilize modern tech to help people learn.
on 1590648308
I think this is one of the most interesting addons for ANKI. I have been using this addon daily for the past month or so, and I can't recommend it enough. It is a wonderful way to learn and enjoy new languages.
on 1590496064
Great Addon.
on 1590428903
Generate Video Cards works fine.

Generate Mobile Cards worked for two days, now an error


Anki 2.1.26 (70784154) Python 3.8.0 Qt 5.13.1 PyQt 5.14.1
Platform: Mac 10.15.4
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2020-05-25 18:14:50
Причиной могли послужить: ⁨Watch Foreign Language Movies with Anki⁩

Caught exception:
Traceback (most recent call last):
File "/Users/vladikov/Library/Application Support/Anki2/addons21/939347702/player.py", line 525, in run
output = check_output([ffprobe_executable, "-v", "quiet", "-print_format", "json", "-show_format", "-show_streams", "-select_streams", "a", note["Path"]], startupinfo=si, encoding='utf-8')
File "subprocess.py", line 411, in check_output
File "subprocess.py", line 512, in run
subprocess.CalledProcessError: Command '['/usr/local/bin/ffprobe', '-v', 'quiet', '-print_format', 'json', '-show_format', '-show_streams', '-select_streams', 'a', '']' returned non-zero exit status 1.
Comment from author
If "Generate Mobile Cards" works in a new profile (File - Switch Profile), maybe the original video file has been renamed, moved to a different folder or deleted.

Otherwise, I'd check that ffprobe can be found and works fine, i.e. open the Terminal app, copy-paste the following line and press Return.
/usr/local/bin/ffprobe -version

If there's any error, I'd suggest to try to reinstall ffmpeg via brew, i.e.
brew reinstall ffmpeg

Maybe something wrong with brew. Maybe try to run:
brew doctor
on 1590324807
Great work!
Absolutely Love it.

I can see how much efforts you put into this, really appreciate it.
on 1589787227
Works Great! Thank you very much! I can't imagine how much effort has been put into this add-on!
on 1589585720
Debug info:
Anki 2.1.15 (442df9d6) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3
Platform: Windows 10
Flags: frz=True ao=True sv=1

Caught exception:
File "C:\Users\Ian\AppData\Roaming\Anki2\addons21\939347702\player.py", line 525, in run
output = check_output([ffprobe_executable, "-v", "quiet", "-print_format", "json", "-show_format", "-show_streams", "-select_streams", "a", note["Path"]], startupinfo=si, encoding='utf-8')
File "subprocess.py", line 336, in check_output
File "subprocess.py", line 403, in run
File "subprocess.py", line 709, in __init__
File "subprocess.py", line 997, in _execute_child
<class 'FileNotFoundError'>: [WinError 2] The specified file could not be found



Any ideas on how to solve it? Cannot generate mobile cards.
Comment from author
Please download FFmpeg from https://ffmpeg.zeranoe.com/builds/ if you didn't do it already, unpack it somewhere and update the PATH environment variable (either in the User or System variables) by adding the path to the folder that contains ffmpeg.exe and ffprobe.exe - https://streamable.com/2b1l6 - and restart Anki.
on 1589357781
Thanks a lot for your amazing addon. This was really easy to use and helpful.

I was wondering if it is possible to disable auto-play of the audio for just the back of the card?
Comment from author
Yes, it's possible to disable auto-play of the audio for just the back of the card, but at the moment it might be a bit complicated or quite easy.

1. If you already have the same audio on the front side, you can disable it on the back side by using {{FrontSide}} instead of {{Field}}. You should be able to still play the audio on the back side manually.

> FrontSide will not automatically play any audio that was on the front side of the card. If you wish to have the same audio play automatically on both the front and back of the card, you’ll need to manually include the audio fields on the back as well.

https://docs.ankiweb.net/#/templates/fields?id=special-fields

2. If it's about this add-on and you're on Anki 2.1.22+, i.e. it probably won't work with Anki 2.1.15, you can use HTML5 Audio tag (<audio>) in the card template with the {{Audio}} field, i.e. something like <audio controls src="{{Audio}}">, but to make it work you'd need to also use Tools - Generate Mobile Cards. i.e.

2.1. Edit the card template and replace the following line in the Back Template
[sound:{{Audio}}]
with
<audio controls src="{{Audio}}" />
2.2. Use Tools - Generate Mobile Cards

HTML5 Audio isn't officially supported by Anki at the moment and seeking controls won't work, it probably only works on AnkiDroid at the moment, but the audio can be played manually.

If there're any problem, please let me know.
on 1589343939
I love it, very useful
on 1588642090
Solve this writing problem

Еде ФнБ Эн ЗбЮбИ
Comment from author
If I remember correctly, the error very likely was caused by subtitles in cp1251 encoding and saving them in utf-8 would most certainly fix it. The latest version of the add-on should be able to import subtitles in cp1251 encoding, but it might be removed or improved in a new version of the add-on.
-------------------------------
If there's some problem with the add-on, I'll try to help, but if I can't reproduce it or I don't understand why it's happening, it might be difficult for me to fix it.
-------------------------------
I'm not sure why it's happening and how to reproduce it. Maybe your .srt subtitles aren't valid or the add-on has a bug.
- Try to resave your .srt file with Aegisub, i.e. open your .srt file with Aegisub and use File - Export Subtitles to save it with .srt extension. Or maybe with Subtitle Edit.
- Try to open your .srt file in any text editor and remove some extra lines from the start of the file until the first number with the timestamp.
on 1588364117
I just love this.
on 1588090092
Don't work.
Comment from author
It's been a few months and I don't know if you receive the updated message or not, but maybe give it another try and if something doesn't work or maybe not clear, just let me know.
-----------------------------------------
I'd try to be a bit more specific.

- What OS are you on? It's Windows, Linux or Mac?
- What's your Anki version (Help - About)?
- What doesn't work?

As long as you have ffmpeg and mpv installed, the add-on should work. If there's any error, please let me know.
on 1587844183
really cool add-on. I was looking this something like this a long time.
on 1587684090
This add on is genius and such a great tool for language learning.

Btw it was working perfectly for me before, however for some reason now the video doesn't come up and only the audio is playing. Can't figure out what the issue could be.

Edit: It's been fixed with the new update. Thanks for responding so quickly.
Comment from author before post was edited
Thank you. Please try the latest version (Tools - Add-ons - Check for Updates).
on 1587660795
Thank you for your helpful supports.
on 1587648163
Wonderful!
on 1587642826
Really Fabulous.
He's so passionate. If you ask him for help, he will revise it and release the updated version.
I just want to thank him for his hard work.
Comment from author
Thank you very much for your kind words. I really appreciate it.
on 1585199562
Please help me. There still are some problems when I want to generate mobile cards. Thanks!
Anki 2.1.15 (442df9d6) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3
Platform: Mac 10.15.3
Flags: frz=True ao=True sv=2
相关扩展:Watch Foreign Language Movies with Anki

Caught exception:
File "/Users/samanthanlee/Library/Application Support/Anki2/addons21/939347702/player.py", line 488, in run
time_start, time_end = re.match(r"^.*?_(\d+\.\d\d\.\d\d\.\d+)-(\d+\.\d\d\.\d\d\.\d+).*$", fld).groups()
<class 'AttributeError'>: 'NoneType' object has no attribute 'groups'
Comment from author
Please use Tools - Add-ons - Check for Updates to update the add-on and restart Anki. It won't fix it, but at least it will give a bit more information about the error and other notes will still be processed.

The add-on depends on the Audio field, e.g. Tangled_(2010)_00.26.43.226-00.26.47.019.mp3, it populates automatically, and usually shouldn't be edited. Maybe this field was accidentally edited since the add-on isn't smart enough to prevent it from happening.
on 1584317598
Your addon is superb!
May I have a question?
The audios aren't mp3 or any other kind of audio files, they are appointments of where the audios begin and finish.
My question is: Are there any way to convert these appointments in mp3 files?
I know that the program subs2srs do that but this program doesn't allows me to edit the files as your addon allows.
Comment from author
Yes, to generate mp3 files just use Tools - Generate Mobile Cards.
on 1582443273
Thank you for the great work! And I'm having some problems.

1. The video only plays when I press Ctrl+R (DEFAULT HOTKEY). When I press the replay button, I thought it would play the video but actually it only plays the audio. Is this because I did something wrong? (Platform is Windows 10.)
2. Also, I'm not sure what the "Pad timing" is for. Should I just keep it both default as 250 ms?

Your help would be much appreciated.

I just found it works perfectly on Ankidroid after I generate mobile cards and stuff- video play by itself. This is even better than on Windows 10 laptop.

update:
Yes, it worked perfectly with both Ctrl+R and replay button this morning. Now, however, when I try Ctrl+R, weirdly there's an error (the video still can play with replay button). Could you please help me check where it went wrong.


Debug info:
Anki 2.1.20 (47a1bf8b) Python 3.8.0 Qt 5.14.1 PyQt 5.14.1
Platform: Windows 10
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2020-02-22 12:49:03

Caught exception:
Traceback (most recent call last):
File "C:\Users\AppData\Roaming\Anki2\addons21\939347702\player.py", line 354, in replayVideo
from aqt.qt import debug; debug()
File "aqt\qt.py", line 35, in debug
File "bdb.py", line 92, in trace_dispatch
File "bdb.py", line 151, in dispatch_return
File "pdb.py", line 292, in user_return
File "pdb.py", line 355, in interaction
File "pdb.py", line 320, in _cmdloop
File "cmd.py", line 126, in cmdloop
RuntimeError: input(): lost sys.stdin


Also, when generating cards, I wonder what is the difference between movie and phrase.
------------------------------
Yes, it works perfectly! Thank you so much for your effort and patience!
Comment from author before post was edited
Thank you. Please update the add-on. I forgot about "from aqt.qt import debug; debug()" and didn't remove it. It's fixed now and Ctrl+R should work the same way as before.
-------------------------------
For phrases, the add-on will only use timings from the subtitles 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.
For movie, 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.
-------------------------------
No, nothing wrong. I'm sorry, it's just that I thought the add-on would work just fine with Anki 2.1.20, but it didn't. I've updated the add-on. Could you please use Tools - Add-ons - Check for Updates to update the add-on and let me know if it works or not?

About the padding, if it's set to 250 ms it means that the audio will start 250 ms earlier or end 250 ms later. With correct timings in the subtitles, there's no need to change this option very much, I think. With Gap between Phrases set to 1.25 seconds, I used 750 ms padding.
on 1581106374
Works fine with very well-timed subtitles. Extra padding is necessary with less good ones, but then I need to add context manually.
on 1580949983
This is an excellent addon but I'm having some issues since the beggining of the week
That's the error message when I try to generate the cards:

Anki 2.1.15 (442df9d6) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3
Platform: Windows 10
Flags: frz=True ao=True sv=1

Caught exception:
File "C:\Users\renat\AppData\Roaming\Anki2\addons21\939347702\movies2anki.py", line 1483, in start
self.startSingleMode()
File "C:\Users\renat\AppData\Roaming\Anki2\addons21\939347702\movies2anki.py", line 1596, in startSingleMode
self.model.create_subtitles()
File "C:\Users\renat\AppData\Roaming\Anki2\addons21\939347702\movies2anki.py", line 905, in create_subtitles
add_pad_timings_between_phrases(self.en_subs_phrases, self.shift_start, self.shift_end)
File "C:\Users\renat\AppData\Roaming\Anki2\addons21\939347702\movies2anki.py", line 430, in add_pad_timings_between_phrases
(start_time, end_time, subtitle) = subs[0]
<class 'IndexError'>: list index out of range

Could you help me please?
Comment from author
It seems like the subtitles file is empty.

If it's not empty, could you open it in Aegisub and then use File - Export Subtitles to save it with UTF-8 encoding using the filename that ends with .srt, or just edit one subtitle line by adding a space to the end of the line or something similar to make Aegisub think that file has changed (there're will be an asterisk in the window title, i.e. "* Balto (1995).srt" instead of "Balto (1995).srt") and then press Ctrl+S, the file will be saved with UTF-8 encoding.
on 1579467975
I've been waiting this for so many years.

Thank you for the great work!
on 1578925658
Amazing, thanks!
on 1578063588
Great
on 1577854543
Amazing !
But it took me a while to figure out how to install all the above-mentioned software. ( I am a newbie to tech stuffs )
I am wondering can it and does it co-work with others add-on that support PinYin, pop-up dictionary...?
And i got this problems : " Invalid HTML on card: TypeError: Cannot read property 'getAttribute' of null "
in which the Chinese text couldn't be loaded on the expression field. (card types for movies2anki- sub2srs -video)
_ Subtitle file type : srt
_ I installed both MPV and VLC on my desktop . -> The app automatically using VLC for this add-on. ( don't know why ), But it's okay.

PROBLEM SOLVED !!! ( i chose to change the given attacked link that provide new front/back template code.)
I use Lingoes as the earlier-mentioned pop-up dictionary. Exactly as you said, It works like a charm. ( On desktop, as well as the ThinkPad laptop - win7 64 bit )
Thank you so much for thorough guidance and explanation.
Comment from author
Thanks for the update!
---
I think, there shouldn't be any problem with using any other add-on as long as the name of the note type stays the same, i.e. movies2anki (...). The only exception is "movies2anki (subs2srs - video)" note type. The card template contains JavaScript code to trigger video replay by clicking on any part of the card and it may cause some problems. I've updated the add-on and added the additional check in this card template to prevent replaying video on text selection, but maybe there's something else that needs to be fixed or maybe use another JavaScript code to disable it on desktop and only enable it on AnkiDroid.

About "Invalid HTML on card", thank you, it's been fixed. I used it to prevent playing audio at the same time as video by using a non-existing audio file that was later replaced with the correct audio filename to make audio button work on the back side of the card if it's been clicked.

Please go to Tools - Add-ons - Check for Updates to update the add-on and then use one of the following options to fix "Invalid HTML on card":
1. Install the "Replay buttons on cards" add-on - https://ankiweb.net/shared/info/498789867
2. Open Tools - Manage Note Types - "movies2anki - subs2srs (video)" and either delete it with all the cards, if it's okay, the add-on will create a new one with the updated card template on the next run, or click on Cards... and replace Front and Back Template with this code - https://gist.github.com/kelciour/c347951c74ab712c659a41e3e5edc422

It's possible to use VLC on Windows but it's been left as it is for legacy reasons and it's not something that I can support. There's no much difference with audio, but VLC doesn't play video as well as mpv, at least on my quite old laptop and PC.

The add-on only tried to play video using VLC if it couldn't find mpv executable in the PATH environment variable. It can be checked by pressing Win+R, type "cmd" (without double quotes) to open Command Prompt, then type "mpv" (without double quotes) and press Enter. The output should be something like
> mpv 0.30.0-195-gb31f2f6cb9 Copyright © 2000-2019 mpv/MPlayer/mplayer2 projects
but I guess the output will be something like
> "mpv" is not recognized as an internal or external command...
In this case, just add the path to the folder that contains mpv.exe to the PATH environment variable and restart Anki.
- https://streamable.com/2b1l6
- https://helpdeskgeek.com/windows-10/add-windows-path-environment-variable/
on 1576418283
Works very well, saves a lot of time
on 1576405678
This is the best addon for Anki!!! Thank you so much!!!
I noticed some interesting things
1.On my PC with windows 10 video plays not by mpv player, but by VLC. And VLC works perfectly. Maybe this addon uses VLC, because I installed mpv player incorrect.
2.On my laptop with WIndows 7 video played by mpv player, but video freezed all the time - it was impossible to watch. I tried to remove mpv player, and video opened by VLC. But it opened in minimazed window, and I had to maximaze it. The next day I installed videodrivers on my laptop and mpv player started to work without freezing and lags.
Comment from author
Thank you for the feedback!

That's great to know that VLC works perfectly! I thought about removing it after updating the add-on to Anki 2.1 because on my laptop and PC it didn't work as well as mpv.

Yes, the add-on only tries to play video using VLC if it couldn't find mpv executable in the PATH environment variable. It can be checked by pressing Win+R, type "cmd" (without double quotes) to open Command Prompt, then type "mpv" (without double quotes) and press Enter. The output should be something like
> mpv 0.30.0-195-gb31f2f6cb9 Copyright © 2000-2019 mpv/MPlayer/mplayer2 projects
but I guess the output will be something like
> "mpv" is not recognized as an internal or external command...
In this case, just update the PATH environment variable to make sure that it contains the path to the folder with mpv.exe and restart Anki.
- https://streamable.com/2b1l6
- https://helpdeskgeek.com/windows-10/add-windows-path-environment-variable/
on 1575806373
Great Work! Thank you.

I have a problem that when I use the option "movie2anki - subs2srs" , and there is no snapshots .

My OS is Win10.
Comment from author
It looks like the add-on couldn't find FFmpeg. If you press Win+R, type cmd, press Enter, type ffmpeg and press Enter, there should be an error message: 'ffmpeg' is not recognized as an internal or external command...

In this case, if you have FFmpeg already downloaded from https://ffmpeg.zeranoe.com/builds/, please check the PATH environment variable, it should contain the full path to the folder with ffmpeg.exe, e.g. C:\Programs\ffmpeg\bin

Or maybe install FFmpeg with https://chocolatey.org/ i.e. right-click the Start button, Windows PowerShell (Admin), "Do you want to allow this app to make changes to your device?" - Yes, copy "Now run the following command:" from https://chocolatey.org/install page, right-click in the Windows PowerShell window to paste the copied text, press Enter, wait a couple of seconds, then type "choco install ffmpeg" without double quotes to download FFmpeg, wait a couple of seconds for a confirmation message, "Do you want to run the script?" - type Y and press Enter, that's it, there's no need to update the PATH environment variable, just restart Anki.
on 1575058311
thanks for update!
on 1574537899
I just don't know how I can express my appreciation.
on 1571547226
Hello, please update for support Anki 2.1 last version. Please~~~
Comment from author
Hi! It's been updated to Anki 2.1. Please let me know if there're any problems.
on 1554110137
Hi, Please update add-in, for support Anki last version.
Comment from author
Hi, I've updated the add-on to Anki 2.1! Please let me know if there're any problems.
on 1550175971
Thank you so much for this add-on. It is such a life saver !!!
I have always wanted to learn languages with movies because they have all the good stories and contexts
but its a waste of time to watch a whole thing over and over again.
on 1545962513
So inovative!
on 1539858425
That's amazing
on 1538093143
For those of you guys using subs2srs, give this add-on a solid look. It's much better if you ask me.