From 0209d1558aa970eaef35499422bc284f64129ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis=20V=C3=A9zina?= <5130500+morpheus65535@users.noreply.github.com> Date: Mon, 14 Sep 2020 10:18:10 -0400 Subject: [PATCH] Improved subtitles synchronization by using webrtcvad if available. --- bazarr/init.py | 2 +- bazarr/subsyncer.py | 7 ++++++- requirements.txt | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/bazarr/init.py b/bazarr/init.py index 21c0cc2cc..bd4ad882d 100644 --- a/bazarr/init.py +++ b/bazarr/init.py @@ -47,7 +47,7 @@ import logging # deploy requirements.txt if not args.no_update: try: - import lxml, numpy + import lxml, numpy, webrtcvad except ImportError: try: import pip diff --git a/bazarr/subsyncer.py b/bazarr/subsyncer.py index 780b24f90..7910956d8 100644 --- a/bazarr/subsyncer.py +++ b/bazarr/subsyncer.py @@ -16,7 +16,12 @@ class SubSyncer: self.srtout = None self.ffmpeg_path = None self.args = None - self.vad = 'subs_then_auditok' + try: + import webrtcvad + except ImportError: + self.vad = 'subs_then_auditok' + else: + self.vad = 'subs_then_webrtc' self.log_dir_path = os.path.join(args.config_dir, 'log') def sync(self, video_path, srt_path, srt_lang, media_type, sonarr_series_id=None, sonarr_episode_id=None, diff --git a/requirements.txt b/requirements.txt index e0b3a30c6..983acb62e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,3 @@ lxml>=4.3.0 numpy>=1.12.0 +webrtcvad-wheels>=2.0.10 \ No newline at end of file