mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Simplify hwaccel filter args and fix qsv bugs (#5054)
* Simplify hwaccel filter args and fix qsv bugs * Formatting * Remove dead code * Set framerate and size for rpi as well
This commit is contained in:
parent
3c708d7672
commit
54bfa4679c
@ -80,44 +80,14 @@ PRESETS_HW_ACCEL_DECODE = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PRESETS_HW_ACCEL_SCALE = {
|
PRESETS_HW_ACCEL_SCALE = {
|
||||||
"preset-rpi-32-h264": ["-f", "rawvideo", "-pix_fmt", "yuv420p"],
|
"preset-rpi-32-h264": "-r {} -s {}x{} -f rawvideo -pix_fmt yuv420p",
|
||||||
"preset-rpi-64-h264": ["-f", "rawvideo", "-pix_fmt", "yuv420p"],
|
"preset-rpi-64-h264": "-r {} -s {}x{} -f rawvideo -pix_fmt yuv420p",
|
||||||
"preset-vaapi": [
|
"preset-vaapi": "-vf fps={},scale_vaapi=w={}:h={},hwdownload,format=yuv420p -f rawvideo",
|
||||||
"-vf",
|
"preset-intel-qsv-h264": "-r {} -vf vpp_qsv=w={}:h={}:format=nv12,hwdownload,format=nv12,format=yuv420p -f rawvideo",
|
||||||
"fps={},scale_vaapi=w={}:h={},hwdownload,format=yuv420p",
|
"preset-intel-qsv-h265": "-r {} -vf vpp_qsv=w={}:h={}:format=nv12,hwdownload,format=nv12,format=yuv420p -f rawvideo",
|
||||||
"-f",
|
"preset-nvidia-h264": "-vf fps={},scale_cuda=w={}:h={}:format=nv12,hwdownload,format=nv12,format=yuv420p -f rawvideo",
|
||||||
"rawvideo",
|
"preset-nvidia-h265": "-vf fps={},scale_cuda=w={}:h={}:format=nv12,hwdownload,format=nv12,format=yuv420p -f rawvideo",
|
||||||
],
|
"default": "-r {} -s {}x{}",
|
||||||
"preset-intel-qsv-h264": [
|
|
||||||
"-vf",
|
|
||||||
"vpp_qsv=framerate={},scale_qsv=w={}:h={}:format=nv12,hwdownload,format=nv12,format=yuv420p",
|
|
||||||
"-f",
|
|
||||||
"rawvideo",
|
|
||||||
],
|
|
||||||
"preset-intel-qsv-h265": [
|
|
||||||
"-vf",
|
|
||||||
"vpp_qsv=framerate={},scale_qsv=w={}:h={}:format=nv12,hwdownload,format=nv12,format=yuv420p",
|
|
||||||
"-f",
|
|
||||||
"rawvideo",
|
|
||||||
],
|
|
||||||
"preset-nvidia-h264": [
|
|
||||||
"-vf",
|
|
||||||
"fps={},scale_cuda=w={}:h={}:format=nv12,hwdownload,format=nv12,format=yuv420p",
|
|
||||||
"-f",
|
|
||||||
"rawvideo",
|
|
||||||
],
|
|
||||||
"preset-nvidia-h265": [
|
|
||||||
"-vf",
|
|
||||||
"fps={},scale_cuda=w={}:h={}:format=nv12,hwdownload,format=nv12,format=yuv420p",
|
|
||||||
"-f",
|
|
||||||
"rawvideo",
|
|
||||||
],
|
|
||||||
"default": [
|
|
||||||
"-r",
|
|
||||||
"{}",
|
|
||||||
"-s",
|
|
||||||
"{}",
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PRESETS_HW_ACCEL_ENCODE = {
|
PRESETS_HW_ACCEL_ENCODE = {
|
||||||
@ -159,14 +129,17 @@ def parse_preset_hardware_acceleration_scale(
|
|||||||
) -> list[str]:
|
) -> list[str]:
|
||||||
"""Return the correct scaling preset or default preset if none is set."""
|
"""Return the correct scaling preset or default preset if none is set."""
|
||||||
if not isinstance(arg, str) or " " in arg:
|
if not isinstance(arg, str) or " " in arg:
|
||||||
scale = PRESETS_HW_ACCEL_SCALE["default"].copy()
|
scale = PRESETS_HW_ACCEL_SCALE["default"].format(fps, width, height).split(" ")
|
||||||
scale[1] = str(fps)
|
|
||||||
scale[3] = f"{width}x{height}"
|
|
||||||
scale.extend(detect_args)
|
scale.extend(detect_args)
|
||||||
return scale
|
return scale
|
||||||
|
|
||||||
scale = PRESETS_HW_ACCEL_SCALE.get(arg, PRESETS_HW_ACCEL_SCALE["default"]).copy()
|
scale = PRESETS_HW_ACCEL_SCALE.get(arg, "")
|
||||||
scale[1] = scale[1].format(fps, width, height)
|
|
||||||
|
if scale:
|
||||||
|
return scale.format(fps, width, height).split(" ")
|
||||||
|
else:
|
||||||
|
scale = scale.format(fps, width, height).split(" ")
|
||||||
|
scale.extend(detect_args)
|
||||||
return scale
|
return scale
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user