Create subs2srs cards with mpv video player

0.02MB. Updated 2020-07-23.

The author has shared 31 other item(s).

Description

WHAT IS SUBS2SRS • subs2srs | Learn Any Language | Wiki • substudy: A tool for learning languages using TV shows and subtitles • DJT Quizmaster Anime/Audio Cards Guide HOW TO USE 1. Download ADD-ON SETTINGS DEFAULT FIELDS "Id" | Tangled_(2010)_00.26.43.226-00.26.47.019 "Source" | Tangled (2010) "Time" | 00:26:45.395 "Line" | I was in a situation, gallivanting through the forest. "Meaning: line" | Я попал в переплёт и, пробираясь сквозь чащу... "Image" | <img src="Tangled_(2010)_00.26.45.395.jpg" /> "Audio" | [sound:Tangled_(2010)_00.26.43.226-00.26.47.019.m4a] ADDITIONAL FIELDS "Path" | D:\Movies\Tangled (2010).mkv "Image (with subtitles)" | <img src="Tangled_(2010)_00.26.45.395_S.jpg" /> "Line: before" | Gesundheit, here's the deal. "Line: after" | I came across your tower and... "Meaning: line before" | Будь здорова. Послушай. "Meaning: line after" | Увидел твою башню, а потом... "Audio (with context)" | ... "Video" | [sound:Tangled_(2010)_00.26.43.226-00.26.47.019.webm] "Video (with context)" | ... "Video (HTML5)" | Tangled_(2010)_00.26.43.226-00.26.47.019.webm "Video (HTML5 with context)" | ... "Video Subtitles" | [sound:Tangled_(2010)_00.26.43.226-00.26.47.019.srt] If the field "... (with context)" is selected then audio/video will start at the beginning of the previous line ("Line: before") and ends at the end of the next line ("Line: after"). Video can be saved either in mp4 or webm format. Default fields saves video in mp4 format. To save video in webm format select the same field name but with "[webm]" prefix in it. Probably choose webm if you're on Windows and want to embed video in the card, otherwise choose mp4 format. DEFAULT HOTKEYS b - create new card w - set the start time e - set the end time ctrl + w - replay from the start time ctrl + e - replay the last ~2 seconds and pause ctrl + r - reset the start time and the end time If the end time is set, 'ctrl + w' will pause playback after playing from the start time to the end time. Default hotkeys can be changed by editing mpv2anki.lua in the mpv2anki folder in the Anki add-ons folder (Anki - Tools - Open Add-ons Folder...). Maybe some useful mpv hotkeys: left and right - seek backward/forward 5 seconds shift + left/right - seek backward/forward 1 second . - step one frame forward , - step one frame backward See USAGE NOTES The add-on is supposed to be used with external srt subtitles that have the same name as the video file and followed by <language> code from the add-on settings screen. For example, if the video file is "Tangled (2010).mkv" and language code is "en", any of these filenames will work for subtitles: "Tangled (2010).en.srt", "Tangled (2010).eng.srt", "Tangled (2010)_track_5_eng.srt". The add-on can be used with embedded subtitles too, but in this case it can only save current video frame as a screenshot, current subtitle as a text and audio/video clip by specifying the start and end times using 'w' and 'e' hotkeys. Current synchronization of the foreign and native subtitles is a bit sloppy and sometimes may produce unexpected results. The add-on immediately creates an Anki card after pressing the hotkey button ('b'), but it may take some time to actually generate images, audio or video. Usually, it takes less than a second to export a screenshot and audio clip, but it may take more time for the video clip. The add-on is experimental and it probably lacks some useful functionality and sometimes may not work as expected. If there's an error "object has no attribute '_callbacks'" after opening the video, try closing mpv video player and reopening the video. If it doesn't generate any cards, try to check fields mapping in the add-on settings. This is the first Anki add-on. The second one is CREDITS STATUS It had been tested only on Windows and Linux, but it's supposed to work on Mac too. CHANGELOG 2018-08-21 The first release. 2019-01-25 Added a pop-up dialog to select definitions from LDOCE in a non-public test version. 2020-01-02 Initial update to Anki 2.1. The add-on for Anki 2.0 has been downloaded ~200 times. 2020-01-20 Fix syntax warning. 2020-03-06 Add macOS support. 2020-03-15 Use FFmpeg for encoding if it can be found 2020-03-15 Possible fix for mpv crash on Mac OS X 10.15 without updating mpv 2020-03-28 Revert to mpv for encoding image with subtitles 2020-04-02 Fix a bug with "Video Subtitles" if there's no "Video" field 2020-04-17 Fix a bug & save the add-on's config between updates 2020-04-27 Fix to find bundled mpv executable on macOS 2020-04-27 Support standalone mpv builds on macOS 2020-04-27 Load mpv user config 2020-07-23 Fix to correctly load subtitles with an empty space at the end of the timestamp Nickolay <kelciour@gmail.com> This add-on adds a new option in the Tools menu to open video with mpv and create subs2srs-like cards by pressing 'b' key while watching video.1. Download mpv video player. If your Anki version is less than 2.1.20, either update Anki or don't install the latest mpv builds and only use mpv builds up to 0.31.0. For Windows, update the PATH environment variable by adding a folder that contains mpv.exe - https://streamable.com/2b1l6 For Ubuntu, please install the latest mpv version, if there's no sound and your mpv version is 0.27. For macOS, the add-on might work without installing mpv separately, but I'm not sure about it, but it should work after installing mpv via brew - https://brew.sh - using the following command: brew cask install mpv Also, it may be useful to create mpv.conf with similar default settings - https://gist.github.com/kelciour/c6d4fe4042431052ab35e8137379f91a For more information please see https://mpv.io/manual/master/#configuration-files Alternatively, the same settings can be added to mpv.conf in the add-on's folder, i.e. Anki - Tools - Add-ons - Create subs2srs ... - View Files - mpv.conf 2. Maybe import this sample deck - https://ankiweb.net/shared/info/1893414250 . 3. Open the add-on via "Open Video..." option (Ctrl+O) in the Tools menu. 4. Select a note type. 5. Click on the gears icon to select which fields will be populated by the add-on. 6. Select a deck or create a new one. 7. Maybe change other settings. 8. Click on "Go!", open a video file and press 'b' key to create a new Anki card.If the field "... (with context)" is selected then audio/video will start at the beginning of the previous line ("Line: before") and ends at the end of the next line ("Line: after"). Video can be saved either in mp4 or webm format. Default fields saves video in mp4 format. To save video in webm format select the same field name but with "[webm]" prefix in it. Probably choose webm if you're on Windows and want to embed video in the card, otherwise choose mp4 format.If the end time is set, 'ctrl + w' will pause playback after playing from the start time to the end time. Default hotkeys can be changed by editing mpv2anki.lua in the mpv2anki folder in the Anki add-ons folder (Anki - Tools - Open Add-ons Folder...). Maybe some useful mpv hotkeys:See Interactive Control for more information about default mpv hotkeys.The add-on is supposed to be used with external srt subtitles that have the same name as the video file and followed by code from the add-on settings screen. For example, if the video file is "Tangled (2010).mkv" and language code is "en", any of these filenames will work for subtitles: "Tangled (2010).en.srt", "Tangled (2010).eng.srt", "Tangled (2010)_track_5_eng.srt". The add-on can be used with embedded subtitles too, but in this case it can only save current video frame as a screenshot, current subtitle as a text and audio/video clip by specifying the start and end times using 'w' and 'e' hotkeys. Current synchronization of the foreign and native subtitles is a bit sloppy and sometimes may produce unexpected results. The add-on immediately creates an Anki card after pressing the hotkey button ('b'), but it may take some time to actually generate images, audio or video. Usually, it takes less than a second to export a screenshot and audio clip, but it may take more time for the video clip. The add-on is experimental and it probably lacks some useful functionality and sometimes may not work as expected. If there's an error "object has no attribute '_callbacks'" after opening the video, try closing mpv video player and reopening the video. If it doesn't generate any cards, try to check fields mapping in the add-on settings. This is the first Anki add-on. The second one is movies2anki - watch foreign language movies with Anki. mpv.py - control mpv from Python using JSON IPC, (c) Lars Gustäbel & Damien Elmes.It had been tested only on Windows and Linux, but it's supposed to work on Mac too.2018-08-21 The first release. 2019-01-25 Added a pop-up dialog to select definitions from LDOCE in a non-public test version. 2020-01-02 Initial update to Anki 2.1. The add-on for Anki 2.0 has been downloaded ~200 times. 2020-01-20 Fix syntax warning. 2020-03-06 Add macOS support. 2020-03-15 Use FFmpeg for encoding if it can be found 2020-03-15 Possible fix for mpv crash on Mac OS X 10.15 without updating mpv 2020-03-28 Revert to mpv for encoding image with subtitles 2020-04-02 Fix a bug with "Video Subtitles" if there's no "Video" field 2020-04-17 Fix a bug & save the add-on's config between updates 2020-04-27 Fix to find bundled mpv executable on macOS 2020-04-27 Support standalone mpv builds on macOS 2020-04-27 Load mpv user config 2020-07-23 Fix to correctly load subtitles with an empty space at the end of the timestamp Nickolay

Download

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

2.1.0-2.1.20+ (updated 2020-07-23) Supported Anki versions:

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.

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

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

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". 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!

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!

Really great add-on, help me a lot, but how can i play playlist or multiple videos with this?

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. 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!

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!





no-border #



Invalid, no intention to remove the title box







I would use brew

But I just updated the plugin and it has added cards normally

Thanks for your guidance



Very good plugin

Very responsible plugin maker Comment from author I'm sorry, I don't know if it's possible and how to do it.



Yes, "no-border" or "border=no" will make the window with no border but it will also hide its title bar.



As an alternative, if you press Del or add "script-opts=osc-visibility=always" in mpv.conf, you can set OSC visibility to always, but it'll also show the bottom bar and the top bar will look differently since it's been rendered by mpv itself, or add "script-opts=osc-visibility=always,osc-windowcontrols=no" in mpv.conf to show only the bottom bar.



After a bit of googling I only found



- https://github.com/mpv-player/mpv/issues/4789

- https://github.com/mpv-player/mpv/pull/5520

- https://github.com/mpv-player/mpv/commit/938ad6ebc037ebb32b41619a31b15f8ade712867

- https://github.com/mpv-player/mpv/pull/6277



Shortly, try to use "macos-title-bar-appearance" and "macos-title-bar-material" options from the last link - https://github.com/mpv-player/mpv/pull/6277



- https://mpv.io/manual/master/#options-macos-title-bar-appearance

- https://mpv.io/manual/master/#options-macos-title-bar-material



But as far as I can understand, it won't work with "no-border", there always will be some border but maybe it won't be too noticeable.



-------------------------------



Thank you. I've added a fix for it. Please update the add-on (Tools - Add-ons - Check for Updates) and restart Anki.



As far as I can understand, the error should be fixed, but since the add-on will try to use mpv that is bundled with Anki, I'm not sure if everything will be working fine this time or not.



It'd be great if it'll work, but if it's not, I'm not sure if it's something that I can fix and it might be better to install mpv video player separately.



As far as I know, the add-on should work if mpv is installed via brew.

1. Open the Terminal app.

2. Follow the instructions and paste the line from https://brew.sh/ to the Terminal app and press Return. You'll need to type your login/admin password to be able to install it.

3. Then install mpv using the following command in the same Terminal app: brew cask install mpv



Alternatively, maybe follow https://mpv.io/installation/ and install OS X builds by stolendata from https://laboratory.stolendata.net/~djinn/mpv_osx/

I guess, just download *.tar.gz, extract it somewhere and drag-and-drop it in the Applications folder.

As far as I know, the result should be the same and everything should be working fine, but I've just added support for it and maybe there are some issues that I'm not aware of. Maybe it will be easier to install mpv this way than using brew to do it. How to configure mpv.confno-border #Invalid, no intention to remove the title boxI would use brewBut I just updated the plugin and it has added cards normallyThanks for your guidanceVery good pluginVery responsible plugin maker





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 before post was edited Please update the add-on. I've added a quick fix to enable mpv user config. 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.

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

It's a great Add-on.

It offers endless possibilities for learning foreign languages and provides an active learning experience that you can enjoyably

I was impressed by the developer's sincerity and quickness.

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

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





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. 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?

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 Does it differ from subs2srs, aside from being an internal add-on?

Thank you so much man, this is super useful!

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. Hi, Please update add-in, for support Anki last version.

Grat addon!

Спасибо большое )

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

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

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