Hard limit file sizes, reduce audio bitrate

This commit is contained in:
Matthew Adams
2021-04-18 20:30:39 +10:00
parent bd161412d7
commit 54491985e6

View File

@@ -112,7 +112,7 @@ async def on_message(message):
else: else:
bitrateKilobits = 800 bitrateKilobits = 800
print("Calced bitrate = " + str(bitrateKilobits)) print("Calced bitrate = " + str(bitrateKilobits))
ffmpeg.input(fileName).output("small_" + fileName, **{'b:v': str(bitrateKilobits) + 'k', 'threads': '4'}).run() ffmpeg.input(fileName).output("small_" + fileName, **{'b:v': str(bitrateKilobits) + 'k', 'b:a': '64k', 'fs': '8M', 'threads': '4'}).run()
with open("small_" + fileName, 'rb') as fp: with open("small_" + fileName, 'rb') as fp:
await message.channel.send(file=discord.File(fp, str("small_" + fileName))) await message.channel.send(file=discord.File(fp, str("small_" + fileName)))
# Delete the compressed and original file # Delete the compressed and original file