I have a question about ffmpeg. I wrote a discord bot with discord.py lib, which plays audio when somebody joins a channel. I wanted the program to run on my computer in the background, so no console log will appear. Therefore I start the python script using a .bat and a .vbs file, so the process runs in the background. This works fine so far. The problem is that the ffmpeg lib (I assume it's the ffmpeg lib...) prints out a line ("[mp3 @ 0000020168869040] Estimating duration from bitrate, this may be inaccurate") in the command prompt when it plays audio, so everytime somebody joins a channel a command prompt appear on my desktop for 1 sec only to show this line, afterwards it closes, but it's really annoying that it shows up everytime. I was wondering if there is a way to prevent the ffmpeg lib to print out this line, but i couldnt find out how so far.
Can someone help me with that?
Thanks Cookie
my Code:
def getAudioSource(source):
audio_source = discord.FFmpegPCMAudio(executable="E:/PythonPrograms/DiscordBotHallo/Dateien/ffmpeg-win64-v4.2.2.exe", source=source)
return audio_source
def getRandomGreeting():
list = os.listdir("E:/PythonPrograms/DiscordBotHallo/Begrü?ungen")
Greeting = list[random.randrange(len(list))]
Greeting = "Begrü?ungen/" + Greeting
return Greeting
@client.event
async def on_voice_state_update(member, before, after):
if before.channel == None and member.id != 801800464756768768:
greetingPath = getRandomGreeting()
audio_source = getAudioSource(greetingPath)
vc = await after.channel.connect()
vc.play(audio_source)
while vc.is_playing():
await asyncio.sleep(1)
vc.stop()
await vc.disconnect()
question from:
https://stackoverflow.com/questions/65906332/how-to-prevent-ffmpeg-lib-from-printing-in-a-command-line-when-playing-audio-wit 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…