joaquintorres / autosubsync-mpv Goto Github PK
View Code? Open in Web Editor NEWAutomatic subtitle synchronization script for mpv media player
License: MIT License
Automatic subtitle synchronization script for mpv media player
License: MIT License
I'm getting this error when trying to sync a subtitle
the complete error is
` autosubsync: Starting ffsubsync...
autosubsync: [14:53:46] INFO extracting speech segments from reference ffsubsync.py:444
autosubsync: 'video.mp4'...
autosubsync: Traceback (most recent call last):
autosubsync: File "/home/user/.local/bin/ffsubsync", line 8, in
autosubsync: sys.exit(main())
autosubsync: ^^^^^^
autosubsync: File "/home/user/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/ffsubsync/ffsubsync.py", line 727, in main
autosubsync: return run(parser)["retval"]
autosubsync: ^^^^^^^^^^^
autosubsync: File "/home/user/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/ffsubsync/ffsubsync.py", line 509, in run
autosubsync: sync_was_successful = _run_impl(args, result)
autosubsync: ^^^^^^^^^^^^^^^^^^^^^^^
autosubsync: File "/home/user/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/ffsubsync/ffsubsync.py", line 445, in _run_impl
autosubsync: reference_pipe.fit(args.reference)
autosubsync: File "/home/user/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/ffsubsync/sklearn_shim.py", line 255, in fit
autosubsync: self._final_estimator.fit(Xt, y, **fit_params)
autosubsync: File "/home/user/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/ffsubsync/speech_transformers.py", line 333, in fit
autosubsync: detector = _make_webrtcvad_detector(
autosubsync: ^^^^^^^^^^^^^^^^^^^^^^^^^
autosubsync: File "/home/user/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/ffsubsync/speech_transformers.py", line 136, in _make_webrtcvad_detector
autosubsync: import webrtcvad
autosubsync: File "/home/user/.local/share/pipx/venvs/ffsubsync/lib/python3.12/site-packages/webrtcvad.py", line 1, in
autosubsync: import pkg_resources
autosubsync: ModuleNotFoundError: No module named 'pkg_resources'
autosubsync: Subtitle synchronization failed.
`
I'm using
mpv 0.38.0 Copyright © 2000-2024 mpv/MPlayer/mplayer2 projects
libplacebo version: v6.338.2
FFmpeg version: n6.1.1
FFmpeg library versions:
libavutil 58.29.100
libavcodec 60.31.102
libavformat 60.16.100
libswscale 7.5.100
libavfilter 9.12.100
libswresample 4.12.100
package ffsubsync 0.4.25, installed using Python 3.12.3 (using pipx)
- ffs
- ffsubsync
- subsync
ffmpeg_path="C:\Users\Apt_S\Downloads\3. ดาวน์โหลดทั้งหมด\EXE\ffmpeg.exe"
ffsubsync_path="C:\Users\Apt_S\AppData\Local\Programs\Python\Python310\Scripts\ffsubsync.exe"
#alass_path=C:/Program Files/ffmpeg/bin/alass.exe
#alass_path=/usr/bin/alass
audio_subsync_tool=ask
audio_subsync_tool=ffsubsync
audio_subsync_tool=alass
altsub_subsync_tool=ask
altsub_subsync_tool=ffsubsync
unload_old_sub=yes
unload_old_sub=no
Hi,
I am facing an issue with autosubsync-mpv.
The original subtitles are for example:
5 00:01:23,206 --> 00:01:26,331 Avant de commencer, je pense que vous avez une déclaration à faire..
Once I run autosubsync-mpv, the subtitles are perfectly synched, but the special characters such as "é" or "à" are badly transformed:
5 00:01:25,599 --> 00:01:28,727 Avant de commencer, je pense que vous avez une dťclaration ŗ faire..
Could you please help me to fix it?
I set
default_subsync_location = "C:\Users\PAUL\AppData\Local\Programs\Python\Python38\Scripts\ffsubsync.exe"
and
subsync = "C:\Users\PAUL\AppData\Local\Programs\Python\Python38\Scripts\ffsubsync.exe"
so when I press "n" nothing happens. What else should I do?
I also tried
subsync = "C:\Users\PAUL\AppData\Local\Programs\Python\Python38\Scripts\ffsubsync"
and just
subsync = "C:\Users\PAUL\AppData\Local\Programs\Python\Python38\Scripts"
I am getting this error.
[autosubsync] [22:16:08] ERROR unable to read reference https://user: ffsubsync.py:387
[autosubsync] [email protected]/T
[autosubsync] V/Star%20Trek%20The%20Next%20Generation/St
[autosubsync] ar.Trek.TNG.Season.2/Star.Trek.The.Next.Ge
[autosubsync] neration.S02E02.Where.Silence.Has.Lease.10
[autosubsync] 80p.bluray.AAC.5.1.x265.mkv; try ensuring
[autosubsync] file exists and has correct permissions
[autosubsync] Subtitle synchronization failed.
Is it incompatible with URLs or is the issues something else?
The subtitles are in a location like this:
C:\Users\me\AppData\Local\Temp\Star.Trek.The.Next.Generation.S02E02.Where.Silence.Has.Lease.1080p.bluray.AAC.5.1.x265.nl.srt
EDIT: I just tried ffsubsync by itself and it throws the same error. So not an issue of the script...
This oseiskar/autosubsync works well! Could you add support for it? That would be greatly appreciated!
At least on Windows, when trying to extract internal subs with Alass, the plugin starts the process and then fails out saying that it could not find any external subs. It does not create any subfiles during this process. However, if you manually extract the subtitles and then retime them with the tool, it works fine.
(The above is an example of the type of output I am seeing.)
In situations where there are no internal subs available, synced external sub files are often easily available. Even when there are internal subs available, they're not always usable. I had an issue with what I assume to be bitmap DVD subs not being recognized.
The current workaround is to simply use alass
or ffsubsync
directly from the terminal to sync the file, but it would be convenient to have support for it in the script. My understanding is that the way the script deals with internal subs is to extract them and then feed them to alass
/ffs
as if they were external files, so based on that I don't think it would be that difficult to implement.
Hello, I am not good with programming so I am looking to make this script fully automatic, I want it always run when starting the file without asking me if I want ffsubsync or alass '"ffsubsync always for current video'" after that, it should delete the old subtitle if this possible /:
$ pip install ffsubsync
$ trizen -S alass-git # for Arch Linux users
I'm using EndeavourOS (Arch based), and the pip install works fine. I initially skipped it and went straight to trizen, but the command didn't get recognized. I'm opening this issue because the “# for Arch Linux users” comment might be confusing.
PS Amazing script, thank you.
I'm trying to sync a subtitle to a k-on episode that has internal subtitles, but it fails. I've tried the script before and it works with no issues on other k-on episodes. I use alass and Arch, dunno what might be causing the fail
Hello,
I'm using Linux (Manjaro) and noticed that the subtitle syncing process fails when there are special characters inside the subtitle file name / path.
It happened both with a space and apostrophe.
They seem to get replaced with a Percent-encoded variant, and then the script fails to find / open the file path that got percent-encoded.
I'm sorry, i personally don't know Lua and don't really have the knowledge to debug it myself, but it definetly fails inside the file_exists(filepath) function, which then presumable gets called somewhere.
I would assume either the filepath somewhere gets a weird encoding, which isn't wanted, or if that is wanted, that the relevant Lua functions to open a file / check if a file exists are not able to work with such an encoded filepath?
I also don't know if this also occurs on Windows, as i don't use that and can't test on that.
It is not the biggest problem, as i can just remove such characters from the filenames,
but it would be cool if this could get fixed!
Thank you
I recently updated python to 3.10, when doing so, i noticed in mpv that autosubsync was no longer working for whatever reason, whevener i try to use it with ffsubsync it gives this error: "couldn't add synchronized subtitle", alass: "subtitle synchronization failed", can you help me sort out this bug? i'm not really sure what caused it, it just started happening after i updated python to do a project, i installed python 3.9.13, uninstalled every other python version i had, reinstalled ffsubsync and autosubsync on mpv and yet i i'm not able to use the script.
Windows 10 x64 21H1, mpv 0.34.0-468-gba81e4ed88, Python 3.9.13, FFmpeg version: git-2022-09-17-ed83a3a5b
I set audio-file-auto=fuzzy and put audio and video same location, but autosubsync can't sync with both alass and ffsubsync it feels like it still use internal audio, I use external audio cuz its filtered.
I've checked many times and "n" is not mapped to anything, tried mapping another key... but the menu never appears.
alass and ffsubsync and ffmpeg are installed and are present in system path as well as I have tried updating path in both the lua as well as conf, tried "\ ", "/", "" as path separators
Don't get any error message or indicator from the script, what am I doing wrong?
mpv 0.33.0-204-ga1c6762156
When attempting to sync against an internal bitmap sub, the same error message is printed as if there had been no internal subs present at all. This happens because the sync engines are incompatible with bitmap subs. Adding a separate error message for incompatible sub types would signal to the user that the script is functioning properly and that they need to find a different subtitle.
Something along the lines of Couldn't extract internal subtitle. Internal subtitle filetype is incompatible.
instead of
Couldn't extract internal subtitle. Make sure the video has internal subtitles.
*Also, very minor detail, but changing Sync to an internal subtitle
to simply Sync to internal subtitle
causes to text to fully fit inside the textbox.
https://github.com/oseiskar/autosubsync
same args as alass so just setting the config alass_path to autosubsync works, but this program sometimes returns code 1 on success
I ran some tests comparing how alass
and ffsubsync
perform using various options. What I noticed was that alass
more consistently output correctly synced subs when syncing against a reference subtitle, while ´ffsubsync´ performed better than ´alass´ when syncing against audio.
Given that the script already supports both engines, I think it could be convenient if it was possible to allow for configuring the script to use ´alass´ when syncing against a subtitle and ´ffsubsync´ when syncing against audio. Alternatively, the script could simply ask for which engine to use when run, but I can imagine that would clutter up the UI and be annoying for people who want to configure once and be done with it.
Pressing 'n' does nothing and console outputs: "[input] No key binding found for key 'n'"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.