You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

InnoSetup打包后Python调用FFmpeg录制流失败问题排查

问题:InnoSetup打包后调用FFmpeg失败

核心功能代码

以下代码用于读取网络电台流并保存为本地文件epalxeis-radio.mp3:

self.p1 = Popen([self.ffmpeg_path,'-y','-loglevel','quiet','-i',self.retransmition_url,'epalxeis-radio.mp3'],stdin=PIPE,stdout=PIPE,stderr=PIPE, bufsize=1)

不同运行场景结果

  • 直接运行Python脚本:正常工作
  • PyInstaller打包为exe后运行:正常工作
  • InnoSetup打包安装后运行exe:失败,未生成目标文件epalxeis-radio.mp3,任务管理器中也看不到ffmpeg.exe进程

FFmpeg路径配置

FFmpeg路径设置如下:

self.ffmpeg_path = os.path.abspath("extra/ffmpeg.exe")

其中extra文件夹与InnoSetup生成的exe处于同一目录。

补充测试

使用简化脚本测试,代码如下:

from subprocess import Popen, DEVNULL, STDOUT, PIPE
import os
import time
ffmpeg_path = os.path.abspath("extra/ffmpeg.exe")
retransmition_url = "http://shaincast.caster.fm:40636/listen.mp3?authn76260dc1cdf44a9132c0b63f85d9c67a"
with Popen([ffmpeg_path,'-y','-loglevel','quiet','-i',retransmition_url,'epalxeis-radio.mp3'],stdin=PIPE,stdout=PIPE,stderr=PIPE) as p1:
    time.sleep(1)

测试结果:

  • PyInstaller打包的exe可正常运行
  • InnoSetup打包安装后的exe会立即停止

内容的提问来源于stack exchange,提问作者Chris P

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.17 14:22:06