Add ability to restream birdseye (#4761)

* Try using RTSP for restream

* Add ability to get snapshot of birdseye when birdseye restream is enabled

* Write to pipe instead of encoding mpeg1

* Write to cache instead

* Use const for location

* Formatting

* Add hardware encoding for birdseye based on ffmpeg preset

* Provide framerate

* Adjust args

* Fix order

* Delete pipe file if it exists

* Cleanup spacing

* Fix spacing
This commit is contained in:
Nicolas Mowen
2022-12-31 07:54:10 -07:00
committed by GitHub
parent da1b7c2e28
commit ff56262c6e
11 changed files with 303 additions and 17 deletions

View File

@@ -129,6 +129,107 @@ PRESETS_HW_ACCEL_SCALE = {
],
}
PRESETS_HW_ACCEL_ENCODE = {
"preset-intel-vaapi": [
"-c:v",
"h264_vaapi",
"-g",
"50",
"-bf",
"0",
"-profile:v",
"high",
"-level:v",
"4.1",
"-sei:v",
"0",
],
"preset-intel-qsv-h264": [
"-c:v",
"h264_qsv",
"-g",
"50",
"-bf",
"0",
"-profile:v",
"high",
"-level:v",
"4.1",
"-async_depth:v",
"1",
],
"preset-intel-qsv-h265": [
"-c:v",
"h264_qsv",
"-g",
"50",
"-bf",
"0",
"-profile:v",
"high",
"-level:v",
"4.1",
"-async_depth:v",
"1",
],
"preset-amd-vaapi": [
"-c:v",
"h264_vaapi",
"-g",
"50",
"-bf",
"0",
"-profile:v",
"high",
"-level:v",
"4.1",
"-sei:v",
"0",
],
"preset-nvidia-h264": [
"-c:v",
"h264_nvenc",
"-g",
"50",
"-profile:v",
"high",
"-level:v",
"auto",
"-preset:v",
"p2",
"-tune:v",
"ll",
],
"preset-nvidia-h265": [
"-c:v",
"h264_nvenc",
"-g",
"50",
"-profile:v",
"high",
"-level:v",
"auto",
"-preset:v",
"p2",
"-tune:v",
"ll",
],
"default": [
"-c:v",
"libx264",
"-g",
"50",
"-profile:v",
"high",
"-level:v",
"4.1",
"-preset:v",
"superfast",
"-tune:v",
"zerolatency",
],
}
def parse_preset_hardware_acceleration_decode(arg: Any) -> list[str]:
"""Return the correct preset if in preset format otherwise return None."""
@@ -158,6 +259,14 @@ def parse_preset_hardware_acceleration_scale(
return scale
def parse_preset_hardware_acceleration_encode(arg: Any) -> list[str]:
"""Return the correct scaling preset or default preset if none is set."""
if not isinstance(arg, str):
return PRESETS_HW_ACCEL_ENCODE["default"]
return PRESETS_HW_ACCEL_ENCODE.get(arg, PRESETS_HW_ACCEL_ENCODE["default"])
PRESETS_INPUT = {
"preset-http-jpeg-generic": _user_agent_args
+ [