Create subs2srs cards with mpv video player
0.05MB. Updated 2022-09-18.
The author has shared 38 other
item(s).
Description
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:
- 2.1.0-2.1.49+ (Updated 2022-09-18)
To download this add-on, please copy and paste the following code into Anki 2.1:
1213145732
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.
All Anki 2.1.x Add-Ons Contact Author
Reviews

THANK YOU!

I'm on a Mac and this is the only tool that worked for me. Before I had to record the audio of every sentence, copy and past the sentence from the subtitle manually. I can't use sub2srs because I'm on a Mac. I tried voracious and I'm having problems. I tried knowclip and I had problems. Movies2anki doesn't work either. This one works just by pressing "b", it's incredible! (I had to set m4a for the sound). Anyway I would like to know how to set up my card type. I saw there are several field types that we can choose, but when I go into the settings of the addon it lets me select only one for "front" (line in my case) and one for "back" (audio). I tried with cloze and basic card types. I would like to be able to insert also the screenshot. Should I create a new card with more fields by myself? After that more fields will show up in the settings and I can then match them with the content? Thank you in advance for your answer and I want to tell you that you made a great addon.

Amazing! If only I had discovered this add on earlier!!! The only issue I have is that videos take forever to buffer. Please add a feature to be able to create cards from other types of links such as streaming sites that use Kwikplayer.

great addons! It's a bit tricky to understand how to install all the other programs that you need to proprely use it (for example it took me ages to understand that I needed to do the thing about environmental variables also for youtube-dl, which I still don't understnad properly), and to find youtube series with the captions that are ok for the addon to work with (for me that I study Chinese, series usually have embedded subs, so I gave up). Anyway great addon! Thanks for sharing you work! Hope that if someone uses it, will share the flashcards tagging somehow this addon so that other users may use them (for any languages) (just an idea for the tag: "subs generated flashcards")

This is, so far at least, the best way I've found to make flashcards from videos. I'd recommend trying a flashcard like this:
Use the mpv2anki-substudy-context flashcard type and map everything to the suggested defaults
1. Sound = Audio
2. Time = Time
3. Source = Source
4. Image = Image
5. Target Line = Line (this is language you're trying to learn)
6. Base Line = Meaning: Line (this is any language you already know and have subtitles for)
7. Target Line: Before = Line:Before
8. Base Line:Before = Meaning:Line before
9. Target Line: After = Line: After
10. Base Line: After = Meaning:Line after
11. Hint = Line (This goes to the front end of the card. You can then turn your flashcard into a cloze test if you later go and edit out one word from your target line)
When you're watching your show hit the "w" key and after 3 lines of subtitles are spoken you can hit the "e" key. Then just hit "b" and you'll have your flashcard. Videos are also an option (in place of audio), but that takes up more space. Just depends how many you want to make. With this method you can set up an anki deck that's just as enjoyable as watching the show. The repetition of audio is absolutely critical for foreign languages. Absolutely love how easy this makes it to make such complex flashcards that are so easily customized.
Use the mpv2anki-substudy-context flashcard type and map everything to the suggested defaults
1. Sound = Audio
2. Time = Time
3. Source = Source
4. Image = Image
5. Target Line = Line (this is language you're trying to learn)
6. Base Line = Meaning: Line (this is any language you already know and have subtitles for)
7. Target Line: Before = Line:Before
8. Base Line:Before = Meaning:Line before
9. Target Line: After = Line: After
10. Base Line: After = Meaning:Line after
11. Hint = Line (This goes to the front end of the card. You can then turn your flashcard into a cloze test if you later go and edit out one word from your target line)
When you're watching your show hit the "w" key and after 3 lines of subtitles are spoken you can hit the "e" key. Then just hit "b" and you'll have your flashcard. Videos are also an option (in place of audio), but that takes up more space. Just depends how many you want to make. With this method you can set up an anki deck that's just as enjoyable as watching the show. The repetition of audio is absolutely critical for foreign languages. Absolutely love how easy this makes it to make such complex flashcards that are so easily customized.

Thank you so much. Such a great add-on.
If you are on a Mac don't forget to replace mp3 with m4a in "File ext:" and the audio will work!
If you are on a Mac don't forget to replace mp3 with m4a in "File ext:" and the audio will work!

THIS IS AMAZING
easy to set up, easy to understand, easy to use, very productive
easy to set up, easy to understand, easy to use, very productive

awesome!

Debug info:
Anki 2.1.35 (84dcaa86) Python 3.8.1 Qt 5.12.6 PyQt 5.12.3
Platform: Windows 10
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2021-07-13 13:15:18
Caught exception:
Traceback (most recent call last):
File "C:\Users\Mohammad\AppData\Roaming\Anki2\addons21\1213145732\mpv2anki.py", line 1235, in openVideoWithMPV
fileUrls = getVideoFile()
File "C:\Users\Mohammad\AppData\Roaming\Anki2\addons21\1213145732\mpv2anki.py", line 96, in getVideoFile
urls = QFileDialog.getOpenFileUrls(None, _("Open Video File or URL"), directory=QUrl.fromLocalFile(dirname), filter=key)[0]
TypeError: getOpenFileUrls(parent: QWidget = None, caption: str = '', directory: str = '', filter: str = '', initialFilter: str = '', options: Union[QFileDialog.Options, QFileDialog.Option] = 0, supportedSchemes: Iterable[str] = []): argument 'directory' has unexpected type 'QUrl'
Anki 2.1.35 (84dcaa86) Python 3.8.1 Qt 5.12.6 PyQt 5.12.3
Platform: Windows 10
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2021-07-13 13:15:18
Caught exception:
Traceback (most recent call last):
File "C:\Users\Mohammad\AppData\Roaming\Anki2\addons21\1213145732\mpv2anki.py", line 1235, in openVideoWithMPV
fileUrls = getVideoFile()
File "C:\Users\Mohammad\AppData\Roaming\Anki2\addons21\1213145732\mpv2anki.py", line 96, in getVideoFile
urls = QFileDialog.getOpenFileUrls(None, _("Open Video File or URL"), directory=QUrl.fromLocalFile(dirname), filter=key)[0]
TypeError: getOpenFileUrls(parent: QWidget = None, caption: str = '', directory: str = '', filter: str = '', initialFilter: str = '', options: Union[QFileDialog.Options, QFileDialog.Option] = 0, supportedSchemes: Iterable[str] = []): argument 'directory' has unexpected type 'QUrl'

Can the image quality be adjusted? The video card I added is blurry on macOS.
Comment from author before post was edited
Try updating Anki to 2.1.35 or 2.1.44 to fix the error: no module named 'typing'

Thanks!!! 🙂
This add-on is very useful for languages one knows quite well and needs to learn new words and expressions only once in a while during watching the episode or movie. For languages which one doesn’t know as well, mass import of automatically generated subtitles→SRS is a better approach, IMHO.
BTW, I opened two issues, requesting new features: https://github.com/kelciour/create-subs2srs-cards-with-mpv-video-player/issues?q=is%3Aissue+author%3Arwmpelstilzchen+
This add-on is very useful for languages one knows quite well and needs to learn new words and expressions only once in a while during watching the episode or movie. For languages which one doesn’t know as well, mass import of automatically generated subtitles→SRS is a better approach, IMHO.
BTW, I opened two issues, requesting new features: https://github.com/kelciour/create-subs2srs-cards-with-mpv-video-player/issues?q=is%3Aissue+author%3Arwmpelstilzchen+

Why is it taking an entire paragraph per subtitle? Any way to just get a single sentence instead? Or could it be a problem with the subtitles

Great add on, helps me only add cards to parts of videos I want to save.
edit: The add-on works seamlessly with local files in almost every occasion ... just sometimes I don't know if its parsing the audio/video with the target language subtitle file or the native language subtitle file ... I hope it is target language ... other than this, the add-on is amazing.
I encountered a small problem when accessing online videos ... the card is generated immediately, but some audio/video files are not generated for some reason ... the card is there ... but the audio or the video file is not added to ANKI's media folder.
edit: thank you very much for the quick and informative reply. As for the first part: I was watching a German series with subtitles in German and choosing my target language as German and my native as English. In some scenes [happened once or twice per episode] it would over flow [generate a video that is a minute and a half instead of just 5 seconds] or cramp together 10 German lines in the "Line" field and one line in the "Line:Meaning" field. I tired to use the "w" and "e" in this case [wasn't able to generate cards using start and end [maybe I don't know the shortcuts by heart yet]] and tried reversing the target and native languages ... but I wasn't able to get it exactly ... at the end I thought to myself it wasn't so much occurring that I ignored it
as for the second part, I guess it might be heck up in the to-do list as well ... as some card generated half the sentence in audio and video [cuts all of a sudden in the middle] and some cards have only audio, and some cards don't have at all ... if it helps [I reviewed the cards by the order I added them, it was going ok with generated audio and sound files and at some point the new cards [from a later point from the video] didn't have audio and video files anymore] ... I checked, the card have successfully generated lines for the audio and video ... but the ANKI media file doesn't have the files themselves ... they are not generated ...
** I hope you find the time to take a look at this online part of the add-on soon ... it is a super wonderful add-on ... and I am so looking forward to having it work seamlessly with online videos, same as local files ... IT IS AWESOME ... I really can't thank you enough for the great work ... KEEP IT UP
edit: The add-on works seamlessly with local files in almost every occasion ... just sometimes I don't know if its parsing the audio/video with the target language subtitle file or the native language subtitle file ... I hope it is target language ... other than this, the add-on is amazing.
I encountered a small problem when accessing online videos ... the card is generated immediately, but some audio/video files are not generated for some reason ... the card is there ... but the audio or the video file is not added to ANKI's media folder.
edit: thank you very much for the quick and informative reply. As for the first part: I was watching a German series with subtitles in German and choosing my target language as German and my native as English. In some scenes [happened once or twice per episode] it would over flow [generate a video that is a minute and a half instead of just 5 seconds] or cramp together 10 German lines in the "Line" field and one line in the "Line:Meaning" field. I tired to use the "w" and "e" in this case [wasn't able to generate cards using start and end [maybe I don't know the shortcuts by heart yet]] and tried reversing the target and native languages ... but I wasn't able to get it exactly ... at the end I thought to myself it wasn't so much occurring that I ignored it
as for the second part, I guess it might be heck up in the to-do list as well ... as some card generated half the sentence in audio and video [cuts all of a sudden in the middle] and some cards have only audio, and some cards don't have at all ... if it helps [I reviewed the cards by the order I added them, it was going ok with generated audio and sound files and at some point the new cards [from a later point from the video] didn't have audio and video files anymore] ... I checked, the card have successfully generated lines for the audio and video ... but the ANKI media file doesn't have the files themselves ... they are not generated ...
** I hope you find the time to take a look at this online part of the add-on soon ... it is a super wonderful add-on ... and I am so looking forward to having it work seamlessly with online videos, same as local files ... IT IS AWESOME ... I really can't thank you enough for the great work ... KEEP IT UP
Comment from author before post was edited
Thank you very much for the feedback!
About the native language subtitle file, I'd need a little bit more info what happens.
About audio/video files, they're generated in the background and might take a few seconds, especially for online videos, but nothing was done to check for errors. It's on to-do list. Maybe, at first, edit a card to see if the field contains [sound:...] or not.
If the field is empty, it should be fixed now as the add-on was updated a few days ago to make sure it won't happen again, but maybe there's another bug somewhere.
If the field is not empty but no audio/video file could be found in the collection.media folder (Tools > Check Media reports it as missing), something might have happened during encoding and at the moment I don't have any ideas why it would work one time but won't work another time.
For now, it'd be probably better to use youtube-dl to download it locally and use the add-on with local videos. I'll try to add some kind of check for encoding errors, but I'm not sure when I'll have time for it, maybe over the weekend, but not 100% sure.
About the native language subtitle file, I'd need a little bit more info what happens.
About audio/video files, they're generated in the background and might take a few seconds, especially for online videos, but nothing was done to check for errors. It's on to-do list. Maybe, at first, edit a card to see if the field contains [sound:...] or not.
If the field is empty, it should be fixed now as the add-on was updated a few days ago to make sure it won't happen again, but maybe there's another bug somewhere.
If the field is not empty but no audio/video file could be found in the collection.media folder (Tools > Check Media reports it as missing), something might have happened during encoding and at the moment I don't have any ideas why it would work one time but won't work another time.
For now, it'd be probably better to use youtube-dl to download it locally and use the add-on with local videos. I'll try to add some kind of check for encoding errors, but I'm not sure when I'll have time for it, maybe over the weekend, but not 100% sure.

Best and simple sentence mining extension !

I'm on a Mac and the cards can be added without problems but the audio file does not appear in the media folder. Is there a way to diagnose it? I installed mpv and ffmpeg through brew.
----------
Thank you very much for the reply. It's now working well if I change the extension to m4a or untick "use MPV".
I also managed to grab the command that's been sent to mpv and I can reproduce the issue without Anki.
When outputting mp3, mpv puts this line in the log: "[cplayer] Disabling audio (not supported by target format).". But if it's m4a, it works well.
----------
Thank you very much for the reply. It's now working well if I change the extension to m4a or untick "use MPV".
I also managed to grab the command that's been sent to mpv and I can reproduce the issue without Anki.
When outputting mp3, mpv puts this line in the log: "[cplayer] Disabling audio (not supported by target format).". But if it's m4a, it works well.
Comment from author before post was edited
Changing "File ext:" in the add-on settings from "mp3" to "m4a" should help.
Alternatively, unchecking "Use MPV?" in the add-on settings (to use ffmpeg for encoding) should help too (for local video files).
Otherwise, something like this could be done to try to reproduce the issue without Anki, but it probably won't be enough and I don't know what else could be done or maybe it's not something that can be easily fixed.
https://gist.github.com/kelciour/44c441949eecaabd13b59adf31c3a847
Alternatively, unchecking "Use MPV?" in the add-on settings (to use ffmpeg for encoding) should help too (for local video files).
Otherwise, something like this could be done to try to reproduce the issue without Anki, but it probably won't be enough and I don't know what else could be done or maybe it's not something that can be easily fixed.
https://gist.github.com/kelciour/44c441949eecaabd13b59adf31c3a847

Thanks

Great Add on! Can I change the create card hotkey from "b" to mouse middle button?

Thank you for the great add-on! Everything works like a charm, but unfortunately I keep having trouble with the audio clips.
I'm a Mac user, have the latest Anki (2.1.35), latest add-on version and latest MPV (downloaded with brew). I've also downloaded the sample deck. When I try to add a card the "Audio" field has an entry but no new clip shows up in the collection.media folder so no sound comes out of the card. I was having the same problem with Mpvacious. Please let me know if there's a way I can fix this. Thank you for all your work!!
---
EDIT
Thank you to the author for swiftly troubleshooting this, and just sharing this here for anyone who might be having the same problem: simply change "File ext:" in the add-on settings from "mp3" to "m4a".
I'm a Mac user, have the latest Anki (2.1.35), latest add-on version and latest MPV (downloaded with brew). I've also downloaded the sample deck. When I try to add a card the "Audio" field has an entry but no new clip shows up in the collection.media folder so no sound comes out of the card. I was having the same problem with Mpvacious. Please let me know if there's a way I can fix this. Thank you for all your work!!
---
EDIT
Thank you to the author for swiftly troubleshooting this, and just sharing this here for anyone who might be having the same problem: simply change "File ext:" in the add-on settings from "mp3" to "m4a".

5 Dec 2020: I appreciate your response. But, unfortunately, ONLY HALF PART HAS BEEN FIXED. Here is the screenshot: https://tinyurl.com/y2uqmefb .On the right side, you are seeing the mpv player. On the left side, the Subs2srs Card is being shown. As you can see, the subtitle IMPOSED on the image ["Image (with subtitles)" field] is NOT MATCHING with the mpv's subtitle shown on the right side. While the subtitle text ["Line" field] is CORRECTLY MATCHING. I can live with the fixed part. So THANKS and THUMBS UP in the end.
----
The 10 Nov release says "apply sub delay". But still, it does not work.
Edit: Thank you for great add-on. Unfortunately, it DOES NOT HONOUR SUBTITLE DELAY i.e. it still saves original subtitles instead of shifted subtitles.
Thanks again. THE ERROR HAS BEEN FIXED.
EDIT: recently found another problem IN LINUX: IT DOES NOT LOAD THE FILE ~/.config/mpv/input.conf. When I play videos directly from the MPV (without Anki), the file is loaded. Now I cannot use my own shortcuts.
EDIT: THE ADD ON IS WORKING FINE ON LINUX AS WELL. The author was super-responsive. (S)He updated the add-on the very next day. Thanks Again.
First of all, I want to give THUMBS UP for Windows-Version. This add-on just automated most of my work.
THUMBS DOWN is only to get your attention for LINUX. I updated my mpv player. But It is NOT SHOWING SUBTITLES ON IMAGES DESPITE CHOSING the"Image (with subtitles)" option. The SCREENSHOT RESOLUTION IS ALSO NOT WORKING. It has not any effect on the screenshot resolution.
Thanks again for your kind and great work and please improve this for linux.
----
The 10 Nov release says "apply sub delay". But still, it does not work.
Edit: Thank you for great add-on. Unfortunately, it DOES NOT HONOUR SUBTITLE DELAY i.e. it still saves original subtitles instead of shifted subtitles.
Thanks again. THE ERROR HAS BEEN FIXED.
EDIT: recently found another problem IN LINUX: IT DOES NOT LOAD THE FILE ~/.config/mpv/input.conf. When I play videos directly from the MPV (without Anki), the file is loaded. Now I cannot use my own shortcuts.
EDIT: THE ADD ON IS WORKING FINE ON LINUX AS WELL. The author was super-responsive. (S)He updated the add-on the very next day. Thanks Again.
First of all, I want to give THUMBS UP for Windows-Version. This add-on just automated most of my work.
THUMBS DOWN is only to get your attention for LINUX. I updated my mpv player. But It is NOT SHOWING SUBTITLES ON IMAGES DESPITE CHOSING the"Image (with subtitles)" option. The SCREENSHOT RESOLUTION IS ALSO NOT WORKING. It has not any effect on the screenshot resolution.
Thanks again for your kind and great work and please improve this for linux.
Comment from author
Update 2020-12-05. Thank you. It's been fixed.
-------
Update 2020-12-04. The sub delay should be fixed now.
-------
I'm not sure, but it's working fine for me. I used Aegisub to add -5 seconds to external srt subtitles to make them out of sync, then open the video file with the add-on and used z, Z or x keys to add 5 seconds delay and sync subtitles with the video file, and pressed b to create a new card.
Ah, I think, I get it. Yes, saving subtitles using "Video Subtitles" will not work. I forgot about it. I'll try to fix it in a few days.
-------
Update 2020-12-04. The sub delay should be fixed now.
-------
I'm not sure, but it's working fine for me. I used Aegisub to add -5 seconds to external srt subtitles to make them out of sync, then open the video file with the add-on and used z, Z or x keys to add 5 seconds delay and sync subtitles with the video file, and pressed b to create a new card.
Ah, I think, I get it. Yes, saving subtitles using "Video Subtitles" will not work. I forgot about it. I'll try to fix it in a few days.

Hello. Thank you all the time.
I recently tried to create a card with a new example video.
The video is good
The audio doesn't seem to be extracted normally.
Please check.
* about audio problem mpvplayer addons doesn't work either
I recently tried to create a card with a new example video.
The video is good
The audio doesn't seem to be extracted normally.
Please check.
* about audio problem mpvplayer addons doesn't work either
Comment from author
If there's no sound, you're on Windows and only installed the add-on, try to download mpv, add it to the PATH environment variable and restart Anki. Apparenly, the add-on doesn't work with mpv 0.27 that is packaged with Anki. I'll try to update the add-on this week to fix it.
If it's something else, could you elaborate a little bit or maybe upload your video file, e.g. at https://gofile.io or https://send.vis.ee/, and send me a link either here or by email kelciour@gmail and I'll try to reproduce the issue.
If it's something else, could you elaborate a little bit or maybe upload your video file, e.g. at https://gofile.io or https://send.vis.ee/, and send me a link either here or by email kelciour@gmail and I'll try to reproduce the issue.

Still figuring this all out but is it true if I say that you HAVE to manually set a start and end time for your clip? It doesn't copy the start and end of the specific subtitle at that moment?
Comment from author
If the video file contains external or embedded subtitles (with mpv 0.30+), the add-on will be able to automatically get the start and end of the current subtitle, i.e. usually pressing the 'b' key should be enough to create a card with the current subtitle.

Doesn't work after last update...
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=2
Add-ons, last update check: 2020-10-22 13:32:27
アドオンが関連している可能性があります:Create subs2srs cards with mpv video player
Caught exception:
Traceback (most recent call last):
File "/home/user/.local/share/Anki2/addons21/1213145732/mpv2anki.py", line 1307, in openVideoWithMPV
AnkiHelper(executable, popenEnv, fileUrls, configManager)
File "/home/user/.local/share/Anki2/addons21/1213145732/mpv2anki.py", line 579, in __init__
self.mpvManager = MPVMonitor(executable, popenEnv, fileUrls, self.mpvConf, self.msgHandler, self.subsManager)
File "/home/user/.local/share/Anki2/addons21/1213145732/mpv2anki.py", line 510, in __init__
assert m, self.version
AssertionError: mpv git-2020-04-17-a09c769
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=2
Add-ons, last update check: 2020-10-22 13:32:27
アドオンが関連している可能性があります:Create subs2srs cards with mpv video player
Caught exception:
Traceback (most recent call last):
File "/home/user/.local/share/Anki2/addons21/1213145732/mpv2anki.py", line 1307, in openVideoWithMPV
AnkiHelper(executable, popenEnv, fileUrls, configManager)
File "/home/user/.local/share/Anki2/addons21/1213145732/mpv2anki.py", line 579, in __init__
self.mpvManager = MPVMonitor(executable, popenEnv, fileUrls, self.mpvConf, self.msgHandler, self.subsManager)
File "/home/user/.local/share/Anki2/addons21/1213145732/mpv2anki.py", line 510, in __init__
assert m, self.version
AssertionError: mpv git-2020-04-17-a09c769
Comment from author
Thank you for the upvote and notifying me about the issue. Please update the add-on. It should be fixed now.

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.26 (70784154) 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-10-20 22:31:50
Caught exception:
Traceback (most recent call last):
File "C:\Users\MatthewBui\AppData\Roaming\Anki2\addons21\1213145732\mpv2anki.py", line 1272, in openVideoWithMPV
AnkiHelper(executable, popenEnv, filePath, is_local_file, configManager, subsManager)
File "C:\Users\MatthewBui\AppData\Roaming\Anki2\addons21\1213145732\mpv2anki.py", line 567, in __init__
self.mpvManager = MPVMonitor(executable, popenEnv, filePath, self.mpvConf, self.msgHandler, self.subsManager)
File "C:\Users\MatthewBui\AppData\Roaming\Anki2\addons21\1213145732\mpv2anki.py", line 502, in __init__
super().__init__(window_id=None, debug=False)
File "C:\Users\MatthewBui\AppData\Roaming\Anki2\addons21\1213145732\vendor\mpv.py", line 444, in __init__
self._register_callbacks()
File "C:\Users\MatthewBui\AppData\Roaming\Anki2\addons21\1213145732\vendor\mpv.py", line 477, in _register_callbacks
self._handle_event(message)
File "C:\Users\MatthewBui\AppData\Roaming\Anki2\addons21\1213145732\vendor\mpv.py", line 521, in _handle_event
callback(message["data"])
File "C:\Users\MatthewBui\AppData\Roaming\Anki2\addons21\1213145732\mpv2anki.py", line 548, in on_property_idle_active
if value and self.can_be_closed:
AttributeError: 'MPVMonitor' object has no attribute 'can_be_closed'
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.26 (70784154) 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-10-20 22:31:50
Caught exception:
Traceback (most recent call last):
File "C:\Users\MatthewBui\AppData\Roaming\Anki2\addons21\1213145732\mpv2anki.py", line 1272, in openVideoWithMPV
AnkiHelper(executable, popenEnv, filePath, is_local_file, configManager, subsManager)
File "C:\Users\MatthewBui\AppData\Roaming\Anki2\addons21\1213145732\mpv2anki.py", line 567, in __init__
self.mpvManager = MPVMonitor(executable, popenEnv, filePath, self.mpvConf, self.msgHandler, self.subsManager)
File "C:\Users\MatthewBui\AppData\Roaming\Anki2\addons21\1213145732\mpv2anki.py", line 502, in __init__
super().__init__(window_id=None, debug=False)
File "C:\Users\MatthewBui\AppData\Roaming\Anki2\addons21\1213145732\vendor\mpv.py", line 444, in __init__
self._register_callbacks()
File "C:\Users\MatthewBui\AppData\Roaming\Anki2\addons21\1213145732\vendor\mpv.py", line 477, in _register_callbacks
self._handle_event(message)
File "C:\Users\MatthewBui\AppData\Roaming\Anki2\addons21\1213145732\vendor\mpv.py", line 521, in _handle_event
callback(message["data"])
File "C:\Users\MatthewBui\AppData\Roaming\Anki2\addons21\1213145732\mpv2anki.py", line 548, in on_property_idle_active
if value and self.can_be_closed:
AttributeError: 'MPVMonitor' object has no attribute 'can_be_closed'
Comment from author
Try the updated version. Use Tools - Add-ons - Check for Updates and restart Anki.

It is a excellent addon.
Thanks for this but I get this error:
Anki 2.1.33 (3f403040) Python 3.8.0 Qt 5.14.2 PyQt 5.14.2
Platform: Mac 10.14.6
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2020-10-13 19:24:34
可能涉及的附加元件:Watch Foreign Language Movies with Anki
Caught exception:
Traceback (most recent call last):
File "/Users/yvonya/Library/Application Support/Anki2/addons21/939347702/movies2anki.py", line 1524, in preview
self.model.create_subtitles()
File "/Users/yvonya/Library/Application Support/Anki2/addons21/939347702/movies2anki.py", line 946, in create_subtitles
self.en_subs_sentences = convert_into_sentences(en_subs, self.phrases_duration_limit, self.join_lines_that_end_with, self.join_questions_with_answers, self.join_sentences_separator, self.join_lines_separator, self.is_gap_phrases)
File "/Users/yvonya/Library/Application Support/Anki2/addons21/939347702/movies2anki.py", line 327, in convert_into_sentences
if (sub_content[0].isalpha() and sub_content[0].islower()) or re.search(regex + r"$", prev_sub_content):
IndexError: string index out of range
Thanks for this but I get this error:
Anki 2.1.33 (3f403040) Python 3.8.0 Qt 5.14.2 PyQt 5.14.2
Platform: Mac 10.14.6
Flags: frz=True ao=True sv=1
Add-ons, last update check: 2020-10-13 19:24:34
可能涉及的附加元件:Watch Foreign Language Movies with Anki
Caught exception:
Traceback (most recent call last):
File "/Users/yvonya/Library/Application Support/Anki2/addons21/939347702/movies2anki.py", line 1524, in preview
self.model.create_subtitles()
File "/Users/yvonya/Library/Application Support/Anki2/addons21/939347702/movies2anki.py", line 946, in create_subtitles
self.en_subs_sentences = convert_into_sentences(en_subs, self.phrases_duration_limit, self.join_lines_that_end_with, self.join_questions_with_answers, self.join_sentences_separator, self.join_lines_separator, self.is_gap_phrases)
File "/Users/yvonya/Library/Application Support/Anki2/addons21/939347702/movies2anki.py", line 327, in convert_into_sentences
if (sub_content[0].isalpha() and sub_content[0].islower()) or re.search(regex + r"$", prev_sub_content):
IndexError: string index out of range
Comment from author
Thank you for the feedback. I updated movies2anki and the error should be fixed now.

Is there any way to open a network stream link?
Comment from author
Thank you for the question and the upvote.
It should be possible now. It requires youtube-dl to be installed the same way as mpv or ffmpeg. Instead of opening a video file, just copy-paste the url.
There's no error handling at the moment and if nothing happens in 3-5 seconds it likely means that mpv can't play it. Running mpv <url> in the terminal should give the error message.
It should be possible now. It requires youtube-dl to be installed the same way as mpv or ffmpeg. Instead of opening a video file, just copy-paste the url.
There's no error handling at the moment and if nothing happens in 3-5 seconds it likely means that mpv can't play it. Running mpv <url> in the terminal should give the error message.

Good, add-on but for some reason audio and video don't work even after having installed ffmpeg and putting the directory in the Environment Variables.
If this add-on worked it would save me so much time so I really appreciate it.
If this add-on worked it would save me so much time so I really appreciate it.
Comment from author
I guess, the fields were mapped, i.e. after opening the add-on's window you clicked on the gear icon and selected audio or video, e.g. Front - Image and Back - Video.
FFmpeg installation can be checked with the Debug Console - https://docs.ankiweb.net/#/misc?id=debug-console
from distutils.spawn import find_executable
print(find_executable("ffmpeg"))
The output should be something like C:\Programs\ffmpeg\bin\ffmpeg.exe, but not None.
The add-on should work fine without FFmpeg and I suggest to try without it by temporarily renaming "ffmpeg" folder, e.g. "_ffmpeg". The add-on will use mpv for video and audio encoding. Some recent mpv versions had some issues with encoding, but the latest mpv version seems to work fine.
Maybe temporarily rename "mpv" folder, e.g. "_mpv", and just install the latest Anki version (2.1.35). It can be installed in a different folder. This version ships with mpv and the add-on should work fine out-of-the-box.
If it won't work, I'll think up of something.
FFmpeg installation can be checked with the Debug Console - https://docs.ankiweb.net/#/misc?id=debug-console
from distutils.spawn import find_executable
print(find_executable("ffmpeg"))
The output should be something like C:\Programs\ffmpeg\bin\ffmpeg.exe, but not None.
The add-on should work fine without FFmpeg and I suggest to try without it by temporarily renaming "ffmpeg" folder, e.g. "_ffmpeg". The add-on will use mpv for video and audio encoding. Some recent mpv versions had some issues with encoding, but the latest mpv version seems to work fine.
Maybe temporarily rename "mpv" folder, e.g. "_mpv", and just install the latest Anki version (2.1.35). It can be installed in a different folder. This version ships with mpv and the add-on should work fine out-of-the-box.
If it won't work, I'll think up of something.

perfect, but is there any way for the window not to always be on top? (shift+t fixes it i think but it would be nice if --ontop wasnt true by default)
Comment from author
It's set by Anki. To change it, Tools - Add-ons - Create subs2srs ... - View Files - open mpv.conf in the text editor and add a new line with "ontop=no". There's no need to restart Anki.
I'll include it by default in the next update, maybe next month.
I'll include it by default in the next update, maybe next month.

hola que tal pude hacer el proceso pero npo entendi como hago que se haga mpv o como se le agrega a sub2rs es al momento de importar o al momento de que estoy en sub2srs por favor ayuda no se que hacer

The add-on is working fine, but I have troubles with audio. When making a card, I can see the name of the audio file imported, but there there is no sound. I found the audio files in the anki media folder but all of them appear to be corrupted. Latest mpv version installed, srt files are properly renamed and placed in the same folder as the video. Hope it can be fixed! Thanks for a great add-on anyway!
Comment from author
Please install FFmpeg the same way as mpv, restart Anki and give it a try. If it won't work, please try with a different video file or maybe upload it somewhere and send me a link by email.
If you on Mac and didn't install mpv via brew, try to do it first. Maybe it'll make a difference.
- On Windows it can be downloaded from https://ffmpeg.zeranoe.com/builds/ and the Path environment variable is needed to be updated with the path to the folder that contains ffmpeg.exe, i.e. C:\...\ffmpeg\bin
- 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".
If you on Mac and didn't install mpv via brew, try to do it first. Maybe it'll make a difference.
- On Windows it can be downloaded from https://ffmpeg.zeranoe.com/builds/ and the Path environment variable is needed to be updated with the path to the folder that contains ffmpeg.exe, i.e. C:\...\ffmpeg\bin
- 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".

Fantastic! I use a Mac (installed mpv player via the Brew instructions) and it works great. Just make sure:
1. Your video file and subtitle file are named exactly the same, and are in the same folder.
2. Your subtitles are .srt (you can convert them if you're not). If you use .ass, the add-on will grab the image and subtitle text but won't grab the sound.
The normal subs2srs program doesn't work on a Mac even with Wine, and the videos I watch aren't on Youtube so I don't use Youtube Subs2srs. This addon is a lifesaver!
1. Your video file and subtitle file are named exactly the same, and are in the same folder.
2. Your subtitles are .srt (you can convert them if you're not). If you use .ass, the add-on will grab the image and subtitle text but won't grab the sound.
The normal subs2srs program doesn't work on a Mac even with Wine, and the videos I watch aren't on Youtube so I don't use Youtube Subs2srs. This addon is a lifesaver!

Really great add-on, help me a lot, but how can i play playlist or multiple videos with this?
Comment from author
Thank you for the suggestion. I finally got around to add it and now it should be possible to select a few video files in the open file dialog.

For some reason there is no audio or video in the cards (I tried both), but the snapshots and lines work fine, so thank you!
Comment from author
It looks like you're using embedded subtitles (maybe in mkv) and the add-on can only extract text or snapshot but no audio or video.
If you have external .srt subtitles with the same filename lying around in the same folder, it should be possible to extract audio or video too.
I'll try to double check it maybe over the weekend and probably update the add-on to make it possible to extract audio or video using timestamps from the embedded subtitles.
If you have external .srt subtitles with the same filename lying around in the same folder, it should be possible to extract audio or video too.
I'll try to double check it maybe over the weekend and probably update the add-on to make it possible to extract audio or video using timestamps from the embedded subtitles.

Great add-on! the only thing that doesn't quite work is the image thumbnail,
it seems that no matter what value I enter it sends the full screen 1080p image
to the image field.
I like that this supports linux as well!
it seems that no matter what value I enter it sends the full screen 1080p image
to the image field.
I like that this supports linux as well!

Really cool add-on. I was looking this something like this a long time.

Fantastic add-on, once set up it's really smooth to use

Видео создается без звука, как решить проблему? Спасибо отличная идея, очень давно искал подобное)

Thank you so much.This is one of the best Anki add-on I've ever used.Keep up your good work.

Great addon, especially convenient for other forms of video like math lectures.
However, is it possible to port this to Anki 2.1 before the whole thing is sunsetted in January?
However, is it possible to port this to Anki 2.1 before the whole thing is sunsetted in January?
Comment from author
I've updated the add-on to Anki 2.1. Please let me know if there're any problems. Thank you!
---
Thank you. That's really nice to know.
Maybe. It's at the top of my to-do list, but I don't know. I'm too busy this week and I'm not sure about next week either. It shouldn't take much time, maybe a couple of hours or a bit more or less, but as for now I don't know when I'll be interested and have enough time to do it. But it'll definitely happen sooner than later.
---
Thank you. That's really nice to know.
Maybe. It's at the top of my to-do list, but I don't know. I'm too busy this week and I'm not sure about next week either. It shouldn't take much time, maybe a couple of hours or a bit more or less, but as for now I don't know when I'll be interested and have enough time to do it. But it'll definitely happen sooner than later.

Does it differ from subs2srs, aside from being an internal add-on?
Comment from author
The add-on doesn't automatically create all cards in a batch like subs2srs. The add-on can only be used to create one card at a time. The add-on can be used without subtitles by manually specifying the start and end timings.
There's another add-on for Anki 2.0 that can create all cards in a batch like subs2srs - https://ankiweb.net/shared/info/939347702
There's another add-on for Anki 2.0 that can create all cards in a batch like subs2srs - https://ankiweb.net/shared/info/939347702

Thank you so much man, this is super useful!

Hi, Please update add-in, for support Anki last version.
Comment from author
Thank you for the upvote! It's been finally updated to Anki 2.1. Please let me know if there're any problems.

Grat addon!

Спасибо большое )
буду сравнивать с subs2srs для ПК и решать что буду использовать, огромное спасибо !!!!
буду сравнивать с subs2srs для ПК и решать что буду использовать, огромное спасибо !!!!

How to add PATH environment variable on windows ?
Comment from author
Please, see this video - https://streamable.com/2b1l6

I'm having issues getting the audio to extract but this is fantastic aside from that.