用subprocess中Popen并行运行时,ffmpeg无法运行,提示如下
ffmpeg version 2022-04-07-git-607ecc27ed-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 11.2.0 (Rev7, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 .......
libavutil 57. 24.101 / 57. 24.101
libavcodec 59. 25.101 / 59. 25.101
libavformat 59. 20.101 / 59. 20.101
libavdevice 59. 6.100 / 59. 6.100
libavfilter 8. 30.100 / 8. 30.100
libswscale 6. 6.100 / 6. 6.100
libswresample 4. 6.100 / 4. 6.100
libpostproc 56. 5.100 / 56. 5.100
"20211003_100402.m4a": Invalid argument
而直接运行相同命令时,正常运行。
命令:ffmpeg -i "20211003_100402.m4a" "20211003_100402.mp3"
相关代码:
[Python] 纯文本查看 复制代码 from subprocess import Popen,PIPE,DEVNULL
files=['20211003_100402.m4a', '20211010_100254.m4a', ...] # 仅贴出部分以举例
pool=[]
for i in files:
name=i
cmd=[
'ffmpeg',
'-i',
f'"{name}"',
'"{}.mp3"'.format(name.split('.')[0])
]
print(' '.join(cmd))
pool.append(Popen(cmd,stderr=PIPE,stdout=PIPE))
running+=1
请问问题在哪里,谢谢。 |