python-codecs: use non hw accelerated h265 by default

This commit is contained in:
Koushik Dutta
2023-10-17 10:38:14 -07:00
parent d1b57ed3ad
commit f8bcf196d3
4 changed files with 32 additions and 4 deletions

View File

@@ -316,6 +316,7 @@ async def generateVideoFramesGstreamer(
options: scrypted_sdk.VideoFrameGeneratorOptions = None,
filter: Any = None,
h264Decoder: str = None,
h265Decoder: str = None,
postProcessPipeline: str = None,
) -> scrypted_sdk.VideoFrame:
ffmpegInput: scrypted_sdk.FFmpegInput = (
@@ -367,6 +368,17 @@ async def generateVideoFramesGstreamer(
decoder = "vtdec_hw"
else:
decoder = "avdec_h264 output-corrupt=false"
elif videoCodec == "h265":
setDecoderClearDefault(h265Decoder)
if not decoder:
# hw acceleration is "safe" to use on mac, but not
# on other hosts where it may crash.
# defaults must be safe.
if platform.system() == "Darwin":
decoder = "vtdec_hw"
else:
decoder = "avdec_h265 output-corrupt=false"
else:
# decodebin may pick a hardware accelerated decoder, which isn't ideal
# so use a known software decoder for h264 and decodebin for anything else.