Enable better compression for auto-transcoding
This commit is contained in:
parent
00b80a929c
commit
608dd46afa
1 changed files with 13 additions and 8 deletions
|
@ -68,11 +68,13 @@ class AutoResponder(commands.Cog):
|
|||
|
||||
@staticmethod
|
||||
@typing.overload
|
||||
def extract_links(text: str, *domains: str, raw: typing.Literal[True] = False) -> list[ParseResult]: ...
|
||||
def extract_links(text: str, *domains: str, raw: typing.Literal[True] = False) -> list[ParseResult]:
|
||||
...
|
||||
|
||||
@staticmethod
|
||||
@typing.overload
|
||||
def extract_links(text: str, *domains: str, raw: typing.Literal[False] = False) -> list[str]: ...
|
||||
def extract_links(text: str, *domains: str, raw: typing.Literal[False] = False) -> list[str]:
|
||||
...
|
||||
|
||||
@staticmethod
|
||||
def extract_links(text: str, *domains: str, raw: bool = False) -> list[str | ParseResult]:
|
||||
|
@ -147,6 +149,7 @@ class AutoResponder(commands.Cog):
|
|||
return update_reaction("\N{TIMER CLOCK}\U0000fe0f")
|
||||
streams = info.get("streams", [])
|
||||
hwaccel = True
|
||||
maxrate = "5M"
|
||||
for stream in streams:
|
||||
self.log.info("Found stream: %s", stream.get("codec_name"))
|
||||
if stream.get("codec_name") == "hevc":
|
||||
|
@ -158,6 +161,10 @@ class AutoResponder(commands.Cog):
|
|||
)
|
||||
hwaccel = False
|
||||
break
|
||||
else:
|
||||
if int(info["format"]["size"]) >= 25 * 1024 * 1024:
|
||||
self.log.warning("%s is too large to render in discord, compressing", uri)
|
||||
maxrate = "1M"
|
||||
else:
|
||||
self.log.info("No HEVC streams found in %s", uri)
|
||||
return update_reaction()
|
||||
|
@ -195,10 +202,8 @@ class AutoResponder(commands.Cog):
|
|||
tmp_dl.name,
|
||||
"-c:v",
|
||||
"libx264",
|
||||
"-crf",
|
||||
"25",
|
||||
"-maxrate",
|
||||
"5M",
|
||||
maxrate,
|
||||
"-minrate",
|
||||
"100K",
|
||||
"-bufsize",
|
||||
|
@ -216,7 +221,7 @@ class AutoResponder(commands.Cog):
|
|||
"-movflags",
|
||||
"faststart",
|
||||
"-profile:v",
|
||||
"main",
|
||||
"high",
|
||||
"-y",
|
||||
"-hide_banner",
|
||||
]
|
||||
|
|
Loading…
Reference in a new issue