【问题标题】:Convert audio files to mp3 using ffmpeg in python在 python 中使用 ffmpeg 将音频文件转换为 mp3
【发布时间】:2022-01-06 15:50:58
【问题描述】:

我正在为 Dyscord 从事 BOT 行业,我需要在 32 位计算机上播放动态知识中的语音片段

import discord
from discord.ext import commands
import os
client = commands.Bot(command_prefix="!")
@client.command()
async def play(ctx, url : str):
    print('We have logged in as {0.user}'.format(client))
    voiceChannel = discord.utils.get(ctx.guild.voice_channels, name="Lounge")
    await voiceChannel.connect()
    voice = discord.utils.get(client.voice_clients, guild=ctx.guild)

    voice.play(discord.FFmpegPCMAudio("song.mp3"))

@client.command()
async def ext(ctx):
    voice = discord.utils.get(client.voice_clients, guild=ctx.guild)
    await voice.disconnect()

client.run('token')


【问题讨论】:

标签: python python-3.x ffmpeg


【解决方案1】:

喂!我建议查看这个 GitHub 存储库:https://github.com/pariweshsubedi/python-ffmpeg-audio-converter

这会让事情变得更容易。

【讨论】:

    猜你喜欢
    • 2011-03-16
    • 2020-08-25
    • 2015-03-17
    • 2011-07-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-23
    • 1970-01-01
    相关资源
    最近更新 更多