Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions python/vosk/transcriber/transcriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,12 @@ def format_result(self, result, words_per_line=7):
return processed_result

def resample_ffmpeg(self, infile):
cmd = shlex.split("ffmpeg -nostdin -loglevel quiet "
"-i \'{}\' -ar {} -ac 1 -f s16le -".format(str(infile), SAMPLE_RATE))
cmd = ["ffmpeg", "-nostdin", "-loglevel", "quiet", "-i", str(infile), "-ar", str(SAMPLE_RATE), "-ac", "1", "-f", "s16le", "-"]
stream = subprocess.Popen(cmd, stdout=subprocess.PIPE)
return stream

async def resample_ffmpeg_async(self, infile):
cmd = "ffmpeg -nostdin -loglevel quiet "\
"-i \'{}\' -ar {} -ac 1 -f s16le -".format(str(infile), SAMPLE_RATE)
cmd = ["ffmpeg", "-nostdin", "-loglevel", "quiet", "-i", str(infile), "-ar", str(SAMPLE_RATE), "-ac", "1", "-f", "s16le", "-"]
return await asyncio.create_subprocess_shell(cmd, stdout=subprocess.PIPE)

async def server_worker(self):
Expand Down