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
|
@staticmethod
|
||||||
@typing.overload
|
@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
|
@staticmethod
|
||||||
@typing.overload
|
@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
|
@staticmethod
|
||||||
def extract_links(text: str, *domains: str, raw: bool = False) -> list[str | ParseResult]:
|
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")
|
return update_reaction("\N{TIMER CLOCK}\U0000fe0f")
|
||||||
streams = info.get("streams", [])
|
streams = info.get("streams", [])
|
||||||
hwaccel = True
|
hwaccel = True
|
||||||
|
maxrate = "5M"
|
||||||
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":
|
||||||
|
@ -158,6 +161,10 @@ class AutoResponder(commands.Cog):
|
||||||
)
|
)
|
||||||
hwaccel = False
|
hwaccel = False
|
||||||
break
|
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:
|
else:
|
||||||
self.log.info("No HEVC streams found in %s", uri)
|
self.log.info("No HEVC streams found in %s", uri)
|
||||||
return update_reaction()
|
return update_reaction()
|
||||||
|
@ -195,10 +202,8 @@ class AutoResponder(commands.Cog):
|
||||||
tmp_dl.name,
|
tmp_dl.name,
|
||||||
"-c:v",
|
"-c:v",
|
||||||
"libx264",
|
"libx264",
|
||||||
"-crf",
|
|
||||||
"25",
|
|
||||||
"-maxrate",
|
"-maxrate",
|
||||||
"5M",
|
maxrate,
|
||||||
"-minrate",
|
"-minrate",
|
||||||
"100K",
|
"100K",
|
||||||
"-bufsize",
|
"-bufsize",
|
||||||
|
@ -216,7 +221,7 @@ class AutoResponder(commands.Cog):
|
||||||
"-movflags",
|
"-movflags",
|
||||||
"faststart",
|
"faststart",
|
||||||
"-profile:v",
|
"-profile:v",
|
||||||
"main",
|
"high",
|
||||||
"-y",
|
"-y",
|
||||||
"-hide_banner",
|
"-hide_banner",
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue