From 1934fc1e1b22c4c162bba1bbe7d7ebb132944cdc Mon Sep 17 00:00:00 2001 From: RVC-Boss <129054828+RVC-Boss@users.noreply.github.com> Date: Thu, 29 May 2025 11:14:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Duvr5=E5=92=8Connx=E5=8E=BB?= =?UTF-8?q?=E6=B7=B7=E5=93=8D=E6=A8=A1=E5=9E=8Bffmpeg=E7=BC=96=E7=A0=81mp3?= =?UTF-8?q?=E5=92=8Cm4a=E5=8E=9F=E8=B7=AF=E5=BE=84=E5=B8=A6=E7=A9=BA?= =?UTF-8?q?=E6=A0=BC=E4=BC=9A=E6=9C=89bug=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复uvr5和onnx去混响模型ffmpeg编码mp3和m4a原路径带空格会有bug的问题 --- tools/uvr5/mdxnet.py | 4 ++-- tools/uvr5/vr.py | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/tools/uvr5/mdxnet.py b/tools/uvr5/mdxnet.py index e109827..6548ce2 100644 --- a/tools/uvr5/mdxnet.py +++ b/tools/uvr5/mdxnet.py @@ -190,14 +190,14 @@ class Predictor: opt_path_vocal = path_vocal[:-4] + ".%s" % format opt_path_other = path_other[:-4] + ".%s" % format if os.path.exists(path_vocal): - os.system("ffmpeg -i '%s' -vn '%s' -q:a 2 -y" % (path_vocal, opt_path_vocal)) + os.system("ffmpeg -i \"%s\" -vn \"%s\" -q:a 2 -y" % (path_vocal, opt_path_vocal)) if os.path.exists(opt_path_vocal): try: os.remove(path_vocal) except: pass if os.path.exists(path_other): - os.system("ffmpeg -i '%s' -vn '%s' -q:a 2 -y" % (path_other, opt_path_other)) + os.system("ffmpeg -i \"%s\" -vn \"%s\" -q:a 2 -y" % (path_other, opt_path_other)) if os.path.exists(opt_path_other): try: os.remove(path_other) diff --git a/tools/uvr5/vr.py b/tools/uvr5/vr.py index 4ca8a3b..8f24ca6 100644 --- a/tools/uvr5/vr.py +++ b/tools/uvr5/vr.py @@ -140,7 +140,9 @@ class AudioPre: ) if os.path.exists(path): opt_format_path = path[:-4] + ".%s" % format - os.system("ffmpeg -i %s -vn %s -q:a 2 -y" % (path, opt_format_path)) + cmd="ffmpeg -i \"%s\" -vn \"%s\" -q:a 2 -y" % (path, opt_format_path) + print(cmd) + os.system(cmd) if os.path.exists(opt_format_path): try: os.remove(path) @@ -175,7 +177,9 @@ class AudioPre: ) if os.path.exists(path): opt_format_path = path[:-4] + ".%s" % format - os.system("ffmpeg -i %s -vn %s -q:a 2 -y" % (path, opt_format_path)) + cmd="ffmpeg -i \"%s\" -vn \"%s\" -q:a 2 -y" % (path, opt_format_path) + print(cmd) + os.system(cmd) if os.path.exists(opt_format_path): try: os.remove(path) @@ -303,7 +307,9 @@ class AudioPreDeEcho: ) if os.path.exists(path): opt_format_path = path[:-4] + ".%s" % format - os.system("ffmpeg -i %s -vn %s -q:a 2 -y" % (path, opt_format_path)) + cmd="ffmpeg -i \"%s\" -vn \"%s\" -q:a 2 -y" % (path, opt_format_path) + print(cmd) + os.system(cmd) if os.path.exists(opt_format_path): try: os.remove(path) @@ -334,7 +340,9 @@ class AudioPreDeEcho: ) if os.path.exists(path): opt_format_path = path[:-4] + ".%s" % format - os.system("ffmpeg -i %s -vn %s -q:a 2 -y" % (path, opt_format_path)) + cmd="ffmpeg -i \"%s\" -vn \"%s\" -q:a 2 -y" % (path, opt_format_path) + print(cmd) + os.system(cmd) if os.path.exists(opt_format_path): try: os.remove(path)