From f415c0d4d3548a4375697c339646340ab97f2107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deniz=20=C5=9Eafak?= Date: Sat, 10 May 2025 01:12:37 +0300 Subject: [PATCH] Fix ffmpeg error in Linux --- abogen/conversion.py | 4 ++-- abogen/utils.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/abogen/conversion.py b/abogen/conversion.py index d1ee171..f4084aa 100644 --- a/abogen/conversion.py +++ b/abogen/conversion.py @@ -519,7 +519,7 @@ class ConversionThread(QThread): "-ac", "1", "-i", - "pipe:", + "pipe:0", "-c:a", "libopus", "-b:a", @@ -598,7 +598,7 @@ class ConversionThread(QThread): ffmpeg_cmd_opus = [ "ffmpeg", "-y", "-thread_queue_size", "1024", # Increased thread_queue_size - "-f", "f32le", "-ar", "24000", "-ac", "1", "-i", "pipe:", + "-f", "f32le", "-ar", "24000", "-ac", "1", "-i", "pipe:0", "-c:a", "libopus", "-b:a", "24000", # Original bitrate opus_out_path, ] diff --git a/abogen/utils.py b/abogen/utils.py index 63e4ffe..6536102 100644 --- a/abogen/utils.py +++ b/abogen/utils.py @@ -118,8 +118,10 @@ def create_process(cmd, stdin=None, text=True): root.addHandler(handler) root.setLevel(logging.INFO) + # Determine shell usage: use shell only for string commands + use_shell = isinstance(cmd, str) kwargs = { - "shell": True, + "shell": use_shell, "stdout": subprocess.PIPE, "stderr": subprocess.STDOUT, "bufsize": 1, # Line buffered