mirror of
https://github.com/LC044/WeChatMsg
synced 2025-02-23 03:22:17 +08:00
ffmpeg命令加引号,彻底解决语音路径的问题
This commit is contained in:
parent
4a8556a3e0
commit
72468624d6
1
.github/ISSUE_TEMPLATE/1_bug_report.yml
vendored
1
.github/ISSUE_TEMPLATE/1_bug_report.yml
vendored
@ -40,6 +40,7 @@ body:
|
||||
attributes:
|
||||
label: '🐛 问题描述 | Bug Description'
|
||||
description: A clear and concise description of the bug.
|
||||
value: '报错截图:'
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
|
2
.github/ISSUE_TEMPLATE/2_feature_request.yml
vendored
2
.github/ISSUE_TEMPLATE/2_feature_request.yml
vendored
@ -9,6 +9,8 @@ body:
|
||||
options:
|
||||
- 是
|
||||
- 否
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: '🥰 需求描述 | Feature Description'
|
||||
|
@ -84,20 +84,20 @@ class MediaMsg:
|
||||
ffmpeg_path = get_ffmpeg_path()
|
||||
# # 调用 FFmpeg
|
||||
if os.path.exists(ffmpeg_path):
|
||||
cmd = f'''{ffmpeg_path} -loglevel quiet -y -f s16le -i {pcm_path} -ar 44100 -ac 1 {mp3_path}'''
|
||||
cmd = f'''"{ffmpeg_path}" -loglevel quiet -y -f s16le -i "{pcm_path}" -ar 44100 -ac 1 "{mp3_path}"'''
|
||||
# system(cmd)
|
||||
# 使用subprocess.run()执行命令
|
||||
subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
else:
|
||||
# 源码运行的时候下面的有效
|
||||
# 这里不知道怎么捕捉异常
|
||||
cmd = f'''{os.path.join(os.getcwd(), 'app', 'resources', 'data','ffmpeg.exe')} -loglevel quiet -y -f s16le -i {pcm_path} -ar 44100 -ac 1 {mp3_path}'''
|
||||
cmd = f'''"{os.path.join(os.getcwd(), 'app', 'resources', 'data','ffmpeg.exe')}" -loglevel quiet -y -f s16le -i "{pcm_path}" -ar 44100 -ac 1 "{mp3_path}"'''
|
||||
# system(cmd)
|
||||
# 使用subprocess.run()执行命令
|
||||
subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
cmd = f'''{os.path.join(os.getcwd(), 'app', 'resources', 'data', 'ffmpeg.exe')} -loglevel quiet -y -f s16le -i {pcm_path} -ar 44100 -ac 1 {mp3_path}'''
|
||||
cmd = f'''"{os.path.join(os.getcwd(), 'app', 'resources', 'data', 'ffmpeg.exe')}" -loglevel quiet -y -f s16le -i "{pcm_path}" -ar 44100 -ac 1 "{mp3_path}"'''
|
||||
# system(cmd)
|
||||
# 使用subprocess.run()执行命令
|
||||
subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
@ -147,6 +147,7 @@ class ImageMessage(QLabel):
|
||||
# self.setFixedSize(self.max_width,self.max_height)
|
||||
self.setMaximumWidth(self.max_width)
|
||||
self.setMaximumHeight(self.max_height)
|
||||
self.setCursor(Qt.PointingHandCursor)
|
||||
if isinstance(image, str):
|
||||
pixmap = QPixmap(image)
|
||||
self.image_path = image
|
||||
|
Loading…
Reference in New Issue
Block a user