Pass -hide_banner -level error to ffmpeg
This commit is contained in:
parent
a7a932a96a
commit
ca25d44b9e
|
@ -47,18 +47,18 @@ async def saucenao(client, message):
|
||||||
return
|
return
|
||||||
if os.path.getsize(filename) > 20 * 1024:
|
if os.path.getsize(filename) > 20 * 1024:
|
||||||
new_path = os.path.join(tempdir, '1.jpg')
|
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()
|
await proc.communicate()
|
||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
filename = new_path
|
filename = new_path
|
||||||
elif mimetype.startswith('video/'):
|
elif mimetype.startswith('video/'):
|
||||||
new_path = os.path.join(tempdir, '1.gif')
|
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()
|
await proc.communicate()
|
||||||
if os.path.getsize(new_path) > 20 * 1024:
|
if os.path.getsize(new_path) > 20 * 1024:
|
||||||
os.remove(new_path)
|
os.remove(new_path)
|
||||||
new_path = os.path.join(tempdir, '1.jpg')
|
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()
|
await proc.communicate()
|
||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
filename = new_path
|
filename = new_path
|
||||||
|
|
|
@ -29,7 +29,7 @@ async def whatanime(client, message):
|
||||||
reply = await message.reply_text('Downloading...')
|
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))
|
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')
|
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 proc.communicate()
|
||||||
await reply.edit_text('Uploading...')
|
await reply.edit_text('Uploading...')
|
||||||
with open(new_path, 'rb') as file:
|
with open(new_path, 'rb') as file:
|
||||||
|
|
Loading…
Reference in New Issue