Only use hwaccel where possible
This commit is contained in:
parent
10cb02d7f3
commit
cbd3b47aed
1 changed files with 14 additions and 3 deletions
|
@ -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,6 +154,13 @@ class AutoResponder(commands.Cog):
|
|||
"-profile:v",
|
||||
"main",
|
||||
"-y",
|
||||
"-hide_banner"
|
||||
]
|
||||
if hwaccel:
|
||||
args = [
|
||||
"-hwaccel",
|
||||
"auto",
|
||||
*args
|
||||
]
|
||||
process = await asyncio.create_subprocess_exec(
|
||||
"ffmpeg",
|
||||
|
|
Loading…
Reference in a new issue