【问题标题】:Discord Bot Python ffmpeg errorDiscord Bot Python ffmpeg错误
【发布时间】:2017-11-05 08:27:51
【问题描述】:

所以我正在运行以下代码,它是更大文件的一部分。即使我已经安装了 ffmpeg 并将其设置为 $PATH 变量,它仍然会抛出以下错误。我在运行 OSX El Capitan 的 Mac 上。此代码使用 python 3.5.2 的 discord 模块。

            author_channel = (message.author).voice_channel
            voice = await media_bot.join_voice_channel(author_channel)
            player = await voice.create_ytdl_player(video)
            player.start()

Traceback (most recent call last):
      File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/discord/voice_client.py", line 431, in create_ffmpeg_player
        p = subprocess.Popen(args, stdin=stdin, stdout=subprocess.PIPE, stderr=stderr)
      File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 947, in __init__
        restore_signals, start_new_session)
      File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 1551, in _execute_child
        raise child_exception_type(errno_num, err_msg)
    FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg'

    The above exception was the direct cause of the following exception:

    Traceback (most recent call last):
      File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/discord/client.py", line 307, in _run_event
        yield from getattr(self, event)(*args, **kwargs)
      File "/Users/bobgaudinmusic/Desktop/Programming/python/Discord Bots/MediaBot/mediaBot.py", line 37, in on_message
        player = await voice.create_ytdl_player(video)
      File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/discord/voice_client.py", line 541, in create_ytdl_player
        player = self.create_ffmpeg_player(download_url, **kwargs)
      File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/discord/voice_client.py", line 434, in create_ffmpeg_player
        raise ClientException('ffmpeg/avconv was not found in your PATH environment variable') from e
    discord.errors.ClientException: ffmpeg/avconv was not found in your PATH environment variable

【问题讨论】:

    标签: python discord


    【解决方案1】:

    对我有用的解决方案是从源代码构建 ffmpeg。

    cd /usr/src
    sudo git clone https://github.com/FFmpeg/FFmpeg.git
    cd FFmpeg
    sudo ./configure --enable-openssl
    sudo make 
    sudo make install
    

    前面的命令应该工作,只是准备等待很长时间才能构建。


    来源:

    https://github.com/Just-Some-Bots/MusicBot/wiki/Guide-for-Raspbian#1d-ffmpeg

    【讨论】:

    • 太棒了,今晚有空我会试试看。
    猜你喜欢
    • 2019-11-22
    • 2018-07-16
    • 2021-02-16
    • 2022-11-28
    • 2021-03-31
    • 1970-01-01
    • 1970-01-01
    • 2019-08-12
    • 2021-04-22
    相关资源
    最近更新 更多