Answer the question
In order to leave comments, you need to log in
When converting mp3 file gives an error! (I use ffmpeg), telebot. how to fix?
@bot.message_handler(content_types=['audio'])
def mp3(message: Message):
fileID = message.audio.file_id
file = bot.get_file(fileID)
download = bot.download_file(file.file_path)
title = message.audio.title
perfor = message.audio.performer
with open('audio1.mp3', 'wb') as f:
f.write(download)
process = subprocess.run(['ffmpeg', '-i', 'audio1.mp3', '-b:a 64k', '-c:a libmp3lame', 'output.mp3', '-y'])
audioR = open('output.mp3', 'rb')
bot.send_audio(message.chat.id, audioR, title=title, performer=perfor)
Answer the question
In order to leave comments, you need to log in
Here the problem is not in your script, but in the parameters passed to ffmpeg, your script works out and, apparently, correctly passes the parameters. Better ask this question in the ffmpeg section.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question