Use presets by default (#4597)

This commit is contained in:
Felipe Santos
2022-12-16 10:41:03 -03:00
committed by GitHub
parent 420bcd7aa0
commit 9b99ba81e5
6 changed files with 33 additions and 39 deletions

View File

@@ -355,35 +355,10 @@ class BirdseyeCameraConfig(BaseModel):
FFMPEG_GLOBAL_ARGS_DEFAULT = ["-hide_banner", "-loglevel", "warning"]
FFMPEG_INPUT_ARGS_DEFAULT = [
"-avoid_negative_ts",
"make_zero",
"-fflags",
"+genpts+discardcorrupt",
"-rtsp_transport",
"tcp",
"-timeout",
"5000000",
"-use_wallclock_as_timestamps",
"1",
]
FFMPEG_INPUT_ARGS_DEFAULT = "preset-rtsp-generic"
DETECT_FFMPEG_OUTPUT_ARGS_DEFAULT = ["-f", "rawvideo", "-pix_fmt", "yuv420p"]
RTMP_FFMPEG_OUTPUT_ARGS_DEFAULT = ["-c", "copy", "-f", "flv"]
RECORD_FFMPEG_OUTPUT_ARGS_DEFAULT = [
"-f",
"segment",
"-segment_time",
"10",
"-segment_format",
"mp4",
"-reset_timestamps",
"1",
"-strftime",
"1",
"-c",
"copy",
"-an",
]
RTMP_FFMPEG_OUTPUT_ARGS_DEFAULT = "preset-rtmp-generic"
RECORD_FFMPEG_OUTPUT_ARGS_DEFAULT = "preset-record-generic"
class FfmpegOutputArgsConfig(FrigateBaseModel):

View File

@@ -77,8 +77,8 @@ class TestFfmpegPresets(unittest.TestCase):
frigate_preset_config.cameras["back"].create_ffmpeg_cmds()
assert (
# Ignore global and user_agent args in comparison
frigate_preset_config.cameras["back"].ffmpeg_cmds[0]["cmd"][6::]
== frigate_config.cameras["back"].ffmpeg_cmds[0]["cmd"][4::]
frigate_preset_config.cameras["back"].ffmpeg_cmds[0]["cmd"]
== frigate_config.cameras["back"].ffmpeg_cmds[0]["cmd"]
)
def test_ffmpeg_input_preset(self):
@@ -95,8 +95,10 @@ class TestFfmpegPresets(unittest.TestCase):
)
def test_ffmpeg_input_args_as_string(self):
argsString = " ".join(FFMPEG_INPUT_ARGS_DEFAULT) + ' -some "arg with space"'
argsList = FFMPEG_INPUT_ARGS_DEFAULT + ["-some", "arg with space"]
# Strip user_agent args here to avoid handling quoting issues
defaultArgsList = parse_preset_input(FFMPEG_INPUT_ARGS_DEFAULT, 5)[2::]
argsString = " ".join(defaultArgsList) + ' -some "arg with space"'
argsList = defaultArgsList + ["-some", "arg with space"]
self.default_ffmpeg["cameras"]["back"]["ffmpeg"]["input_args"] = argsString
frigate_config = FrigateConfig(**self.default_ffmpeg)
frigate_config.cameras["back"].create_ffmpeg_cmds()