EnergoStalin/subtitle-translate-mpv

install instructions?

Opened this issue · 6 comments

install instructions?

Just clone repository into mpv scripts folder and make sure CrowTranslate available in path. For windows you can install it using winget. For config i already specified example in readme.

@EnergoStalin Thanks it worked but its too slow (I meant unsynchronized) what can I do? I made delay 0 from config but did not do the trick. I use xubuntu 22 04. here is terminal output

 (+) Video --vid=1 (*) 'Tenrai-Sensei | 23 CRF VerySlow' (hevc 1448x1080 23.976fps)
 (+) Audio --aid=1 --alang=eng (*) '' (opus 6ch 48000Hz)
     Audio --aid=2 --alang=jpn '' (opus 6ch 48000Hz)
     Subs  --sid=1 --slang=eng (f) 'S&S' (ass)
 (+) Subs  --sid=2 --slang=eng (*) 'Dialog - ENG' (ass)
[ffmpeg/video] hevc: No support for codec hevc profile 2.
[subtitle_translate_mpv] Started                                                                                                      
AO: [pulse] 48000Hz 5.1 6ch float
VO: [gpu] 1448x1080 yuv420p10
(Paused) AV: 00:03:29 / 00:24:43 (14%) A-V:  0.000
[subtitle_translate_mpv] defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer```

In general you need a negative initial delay so subtitles will appear earlier and script have time to translate. Then it will be automatically adjusted by average crow translation time.

May become slightly inaccurate when running long time and you have unstable internet connection(guess i need to add detection for internet connection problems to automate this like don't allow delay go beyond some treshhold). But lua branch now is unmaintaned i did tried to rewrite it to js with normal async support in master-js branch but abandoned it at some point for the sake of alternatives like you know miru and language specific torrent trackers. To put it simply Lua works fine in stable environment but handles definitely not all edge cases such as encoding for example as stated in #2.

So you need to:

  • experimenting with negative delay to adjust timings by your base average crow response speed(I have -0.5 and it's enough for me. Means half a second earlier but actually crow responds around 200-300ms it's a good thing to set it a bit bigger and let average module adjust it after).

Added benchmark script for easier setup. Still need to put it into config file manually.

And hopefully fixed your issue because i somehow 🤦🏻‍♂️ measured time after calling translator but should done it before.

Yeah after i said what it's unmaintaned)

thank you so much @EnergoStalin now my pc got broken i will be able to check it on this saturday :)