Convert to JPEG and force 5fps in right-behind-you
All checks were successful
Build and Publish / build_and_publish (push) Successful in 5m2s

This commit is contained in:
Nexus 2024-06-17 14:37:33 +01:00
parent a195869217
commit 9a44a39933
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -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