Pass -hide_banner -level error to ffmpeg

This commit is contained in:
blank X 2022-01-02 22:39:00 +07:00
parent a7a932a96a
commit ca25d44b9e
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
2 changed files with 4 additions and 4 deletions

View File

@ -47,18 +47,18 @@ async def saucenao(client, message):
return
if os.path.getsize(filename) > 20 * 1024:
new_path = os.path.join(tempdir, '1.jpg')
proc = await asyncio.create_subprocess_exec('ffmpeg', '-an', '-sn', '-i', filename, '-frames:v', '1', new_path)
proc = await asyncio.create_subprocess_exec('ffmpeg', '-hide_banner', '-loglevel', 'error', '-an', '-sn', '-i', filename, '-frames:v', '1', new_path)
await proc.communicate()
os.remove(filename)
filename = new_path
elif mimetype.startswith('video/'):
new_path = os.path.join(tempdir, '1.gif')
proc = await asyncio.create_subprocess_exec('ffmpeg', '-an', '-sn', '-i', filename, new_path)
proc = await asyncio.create_subprocess_exec('ffmpeg', '-hide_banner', '-loglevel', 'error', '-an', '-sn', '-i', filename, new_path)
await proc.communicate()
if os.path.getsize(new_path) > 20 * 1024:
os.remove(new_path)
new_path = os.path.join(tempdir, '1.jpg')
proc = await asyncio.create_subprocess_exec('ffmpeg', '-an', '-sn', '-i', filename, '-frames:v', '1', new_path)
proc = await asyncio.create_subprocess_exec('ffmpeg', '-hide_banner', '-loglevel', 'error', '-an', '-sn', '-i', filename, '-frames:v', '1', new_path)
await proc.communicate()
os.remove(filename)
filename = new_path

View File

@ -29,7 +29,7 @@ async def whatanime(client, message):
reply = await message.reply_text('Downloading...')
path = await client.download_media(media, file_name=os.path.join(tempdir, '0'), progress=progress_callback, progress_args=(reply, 'Downloading...', False))
new_path = os.path.join(tempdir, '1.png')
proc = await asyncio.create_subprocess_exec('ffmpeg', '-i', path, '-frames:v', '1', new_path)
proc = await asyncio.create_subprocess_exec('ffmpeg', '-hide_banner', '-loglevel', 'error', '-i', path, '-frames:v', '1', new_path)
await proc.communicate()
await reply.edit_text('Uploading...')
with open(new_path, 'rb') as file: