PasserQi

一条咸鱼的学习之路

[Pydub] 读取mp3报错|Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work

代码:

# coding:utf8
from pydub import AudioSegment
hello = AudioSegment.from_file('hello.mp3',format = 'mp3')

报错:

C:\Python27\ArcGIS10.2\python2.exe E:/python/workspace/pydub/PyAudio.py
C:\Python27\ArcGIS10.2\lib\site-packages\pydub\utils.py:165: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work
  warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning)
Traceback (most recent call last):
  File "E:/python/workspace/pydub/PyAudio.py", line 7, in <module>
    hello = AudioSegment.from_file('hello.mp3',format = 'mp3')
  File "C:\Python27\ArcGIS10.2\lib\site-packages\pydub\audio_segment.py", line 512, in from_file
    p = subprocess.Popen(conversion_command, stdin=devnull, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
  File "C:\Python27\ArcGIS10.2\lib\subprocess.py", line 679, in __init__
    errread, errwrite)
  File "C:\Python27\ArcGIS10.2\lib\subprocess.py", line 896, in _execute_child
    startupinfo)
WindowsError: [Error 2]

问题:没有ffmpeg.exe

解决方案:

  1. 下载后放入工程目录下
  2. 使用代码引入ffmpeg.exe位置

    AudioSegment.converter = r"C:\\path\\to\\ffmpeg.exe"
    
阅读更多
版权声明:本文为博主原创文章,若有错误之处望大家批评指正!转载需附上原文链接,谢谢! https://blog.csdn.net/summer_dew/article/details/79945150
文章标签: python
个人分类: python
上一篇[最小二乘法] 多边定位--求解未知点坐标
下一篇[ENVI] 修改专题图的类别与颜色
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭