python - 找不到docker discord.py ffmpeg.exe

标签 python docker ubuntu ffmpeg discord.py

我的代码在 Windows 上运行良好,出于稳定性原因,我只是不知道如何将它迁移到我的 docker 服务器,而我的旧 vm 把床弄脏了。下面是我的主要播放循环

async def main_playing_loop(vc, ctx):
    global skip
    while len(queued[str(ctx.guild.id)]) > 0:
        try:
            print(vc.is_playing())
            while vc.is_playing() or vc.is_paused():
                await asyncio.sleep(2)
                skip_func(vc)
                pass

        except AttributeError:
            pass
        try:
            url = str(queued[str(ctx.guild.id)][0])
            download_video(ctx, url)
            vc.play(discord.FFmpegPCMAudio(executable="ffmpeg.exe", source=str(ctx.guild.id) + ".mp3"))
            del queued[str(ctx.guild.id)][0]
        except:
            break
它在做什么的日志
discord_main_1  | [youtube] dQw4w9WgXcQ: Downloading android player API JSON
discord_main_1  | [youtube] dQw4w9WgXcQ: Downloading webpage
discord_main_1  | stoping
discord_main_1  | [youtube] dQw4w9WgXcQ: Downloading android player API JSON
discord_main_1  | [info] dQw4w9WgXcQ: Downloading 1 format(s): 251
discord_main_1  | [download] Destination: 866270239342460930.mp3
[download] 100% of 3.28MiB in 00:00                  
discord_main_1  | Ignoring exception in command play:
discord_main_1  | Traceback (most recent call last):
discord_main_1  |   File "/usr/local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 85, in wrapped
discord_main_1  |     ret = await coro(*args, **kwargs)
discord_main_1  |   File "/usr/src/bot/main.py", line 125, in play
discord_main_1  |     vc.play(discord.FFmpegPCMAudio(executable="ffmpeg.exe", source=str(ctx.guild.id) + ".mp3"))
discord_main_1  |   File "/usr/local/lib/python3.10/site-packages/discord/player.py", line 225, in __init__
discord_main_1  |     super().__init__(source, executable=executable, args=args, **subprocess_kwargs)
discord_main_1  |   File "/usr/local/lib/python3.10/site-packages/discord/player.py", line 138, in __init__
discord_main_1  |     self._process = self._spawn_process(args, **kwargs)
discord_main_1  |   File "/usr/local/lib/python3.10/site-packages/discord/player.py", line 147, in _spawn_process
discord_main_1  |     raise ClientException(executable + ' was not found.') from None
discord_main_1  | discord.errors.ClientException: ffmpeg.exe was not found.
discord_main_1  | 
discord_main_1  | The above exception was the direct cause of the following exception:
discord_main_1  | 
discord_main_1  | Traceback (most recent call last):
discord_main_1  |   File "/usr/local/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 939, in invoke
discord_main_1  |     await ctx.command.invoke(ctx)
discord_main_1  |   File "/usr/local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 863, in invoke
discord_main_1  |     await injected(*ctx.args, **ctx.kwargs)
discord_main_1  |   File "/usr/local/lib/python3.10/site-packages/discord/ext/commands/core.py", line 94, in wrapped
discord_main_1  |     raise CommandInvokeError(exc) from exc
discord_main_1  | discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ClientException: ffmpeg.exe was not found.
我仍然有我在 win 上使用的 ffmpeg 的旧 exe,但这在 Ubuntu 上不起作用。感谢任何帮助。

最佳答案

您似乎正在尝试使用 Windows .exe在 Ubuntu Docker 上可执行。这不起作用,因为 Windows 应用程序只能在 Windows 上运行。因此,您需要找到一种方法来安装 Docker 容器 ffmpeg通过包管理器(apt 用于 Ubuntu)。
为此,我希望这另一个 thread有帮助。

关于python - 找不到docker discord.py ffmpeg.exe,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72149438/

相关文章:

python - 如何使用 Python (Ubuntu) 创建桌面快捷方式?

python - 如何遍历数组数组中的键?

python - 用于密码重置的 Django-rest-auth HTML 电子邮件

python - 如果数据输入多次,则不同的响应

docker - 带有构建参数的ENTRYPOINT和CMD

phpmyadmin 页面显示源代码,Ubuntu 16.04 安装了 Vagrant 和 Puphpet

python - 为什么 Shapely 无法检测给定的地理坐标点是否在 route

无法删除 Docker Registry v2 镜像

spring - "Logging system failed to initialize using configuration from ' null '"在本地计算机上运行 Docker 容器时

maven - 在 Ubuntu 上安装 findbugs