From 27fc6f39d578a772896b4a7fcc2512addae0dea7 Mon Sep 17 00:00:00 2001 From: Hung Nguyen Date: Thu, 19 Oct 2017 14:12:28 +0700 Subject: [PATCH 1/2] Fix error returned non-zero exit status 1 when invoke ffmpeg on Windows --- bin/autosub | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/autosub b/bin/autosub index 26ddd20a..950db343 100755 --- a/bin/autosub +++ b/bin/autosub @@ -49,7 +49,8 @@ class FLACConverter(object): command = ["ffmpeg","-ss", str(start), "-t", str(end - start), "-y", "-i", self.source_path, "-loglevel", "error", temp.name] - subprocess.check_output(command, stdin=open(os.devnull)) + use_shell = True if os.name == "nt" else False + subprocess.check_output(command, stdin=open(os.devnull), shell=use_shell) return temp.read() except KeyboardInterrupt: @@ -139,7 +140,8 @@ def extract_audio(filename, channels=1, rate=16000): print "ffmpeg: Executable not found on machine." raise Exception("Dependency not found: ffmpeg") command = ["ffmpeg", "-y", "-i", filename, "-ac", str(channels), "-ar", str(rate), "-loglevel", "error", temp.name] - subprocess.check_output(command, stdin=open(os.devnull)) + use_shell = True if os.name == "nt" else False + subprocess.check_output(command, stdin=open(os.devnull), shell=use_shell) return temp.name, rate From c8e41f9a4a0cd02386adac6ac1872f9fd6b6ebb3 Mon Sep 17 00:00:00 2001 From: Hung Nguyen Date: Thu, 19 Oct 2017 14:13:51 +0700 Subject: [PATCH 2/2] Deleted unused code --- bin/autosub | 2 -- 1 file changed, 2 deletions(-) diff --git a/bin/autosub b/bin/autosub index 950db343..9e4a113f 100755 --- a/bin/autosub +++ b/bin/autosub @@ -150,8 +150,6 @@ def find_speech_regions(filename, frame_width=4096, min_region_size=0.5, max_reg sample_width = reader.getsampwidth() rate = reader.getframerate() n_channels = reader.getnchannels() - - total_duration = reader.getnframes() / rate chunk_duration = float(frame_width) / rate n_chunks = int(math.ceil(reader.getnframes()*1.0 / frame_width))