From cbd3b47aed1b509a68307011516ad4705f4218ec Mon Sep 17 00:00:00 2001 From: nexy7574 Date: Tue, 16 Apr 2024 01:06:53 +0100 Subject: [PATCH] Only use hwaccel where possible --- src/cogs/auto_responder.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/cogs/auto_responder.py b/src/cogs/auto_responder.py index 9902981..93b616a 100644 --- a/src/cogs/auto_responder.py +++ b/src/cogs/auto_responder.py @@ -82,10 +82,17 @@ class AutoResponder(commands.Cog): ) return update_reaction("\N{TIMER CLOCK}\U0000fe0f") streams = info.get("streams", []) + hwaccel = True for stream in streams: self.log.info("Found stream: %s", stream.get("codec_name")) if stream.get("codec_name") == "hevc": self.log.info("Found HEVC stream: %r", stream) + if stream.get("profile", "Main ?") != "Main": + self.log.warning( + "Unsupported profile: %r - disabling hardware accelerated read.", + stream.get("profile", "Main ?") + ) + hwaccel = False break else: self.log.info("No HEVC streams found in %s", uri) @@ -120,9 +127,6 @@ class AutoResponder(commands.Cog): self.log.info("Transcoding %r to %r", uri, tmp_path) update_reaction("\N{HOURGLASS WITH FLOWING SAND}") args = [ - "-hide_banner", - "-hwaccel", - "auto", "-i", tmp_dl.name, "-c:v", @@ -150,7 +154,14 @@ class AutoResponder(commands.Cog): "-profile:v", "main", "-y", + "-hide_banner" ] + if hwaccel: + args = [ + "-hwaccel", + "auto", + *args + ] process = await asyncio.create_subprocess_exec( "ffmpeg", *args,