Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

So I'm running the following code which is part of a bigger file. It keeps throwing up the below error even though I've installed ffmpeg and set it to the $PATH variable. I'm on a Mac running OSX El Capitan. This code uses the discord module for python 3.5.2.

            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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
188 views
Welcome To Ask or Share your Answers For Others

1 Answer

The solution which worked for me involved building ffmpeg from source.

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

The previous commands should work, just be prepared to wait a long time for it to build.


Source:

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...