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")
|
return update_reaction("\N{TIMER CLOCK}\U0000fe0f")
|
||||||
streams = info.get("streams", [])
|
streams = info.get("streams", [])
|
||||||
|
hwaccel = True
|
||||||
for stream in streams:
|
for stream in streams:
|
||||||
self.log.info("Found stream: %s", stream.get("codec_name"))
|
self.log.info("Found stream: %s", stream.get("codec_name"))
|
||||||
if stream.get("codec_name") == "hevc":
|
if stream.get("codec_name") == "hevc":
|
||||||
self.log.info("Found HEVC stream: %r", stream)
|
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
|
break
|
||||||
else:
|
else:
|
||||||
self.log.info("No HEVC streams found in %s", uri)
|
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)
|
self.log.info("Transcoding %r to %r", uri, tmp_path)
|
||||||
update_reaction("\N{HOURGLASS WITH FLOWING SAND}")
|
update_reaction("\N{HOURGLASS WITH FLOWING SAND}")
|
||||||
args = [
|
args = [
|
||||||
"-hide_banner",
|
|
||||||
"-hwaccel",
|
|
||||||
"auto",
|
|
||||||
"-i",
|
"-i",
|
||||||
tmp_dl.name,
|
tmp_dl.name,
|
||||||
"-c:v",
|
"-c:v",
|
||||||
|
@ -150,6 +154,13 @@ class AutoResponder(commands.Cog):
|
||||||
"-profile:v",
|
"-profile:v",
|
||||||
"main",
|
"main",
|
||||||
"-y",
|
"-y",
|
||||||
|
"-hide_banner"
|
||||||
|
]
|
||||||
|
if hwaccel:
|
||||||
|
args = [
|
||||||
|
"-hwaccel",
|
||||||
|
"auto",
|
||||||
|
*args
|
||||||
]
|
]
|
||||||
process = await asyncio.create_subprocess_exec(
|
process = await asyncio.create_subprocess_exec(
|
||||||
"ffmpeg",
|
"ffmpeg",
|
||||||
|
|
Loading…
Reference in a new issue