diff --git a/src/cogs/ffmeta.py b/src/cogs/ffmeta.py index aec19ad..8678787 100644 --- a/src/cogs/ffmeta.py +++ b/src/cogs/ffmeta.py @@ -247,7 +247,10 @@ class FFMeta(commands.Cog): if not image.content_type.startswith("image"): return await ctx.respond("That's not an image!") with tempfile.NamedTemporaryFile(suffix=Path(image.filename).suffix) as temp: - await image.save(temp.name) + img_tmp = io.BytesIO(await image.read()) + dst: io.BytesIO = await asyncio.to_thread(self.jpegify_image, img_tmp, 50, "jpeg") + temp.write(dst.getvalue()) + temp.flush() process = await asyncio.create_subprocess_exec( "ffmpeg", "-hide_banner", @@ -271,7 +274,7 @@ class FFMeta(commands.Cog): "-pix_fmt", "yuv420p", "-vf", - "fade=in:0:d=22,pad='iw+mod(iw\\,2)':'ih+mod(ih\\,2)'", + "fade=in:0:d=22,pad='iw+mod(iw\\,2)':'ih+mod(ih\\,2)',fps=5", "-tune", "stillimage", "-preset", @@ -284,6 +287,8 @@ class FFMeta(commands.Cog): "-y", "-f", "mp4", + f"-r", + "5", "pipe:1", stdout=asyncio.subprocess.PIPE, stderr=sys.stderr