Do not apply -user_agent for rtmp streams (#4596)

This commit is contained in:
Felipe Santos 2022-12-04 12:46:03 -03:00 committed by GitHub
parent 007fa75294
commit 87e2810725
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 16 deletions

View File

@ -142,7 +142,7 @@ birdseye:
# Optional: ffmpeg configuration
ffmpeg:
# Optional: global ffmpeg args (default: shown below)
global_args: -hide_banner -loglevel warning -user_agent "FFmpeg Frigate"
global_args: -hide_banner -loglevel warning
# Optional: global hwaccel args (default: shown below)
# NOTE: See hardware acceleration docs for your specific device
hwaccel_args: []

View File

@ -359,13 +359,7 @@ class BirdseyeCameraConfig(BaseModel):
)
FFMPEG_GLOBAL_ARGS_DEFAULT = [
"-hide_banner",
"-loglevel",
"warning",
"-user_agent",
f"FFmpeg Frigate/{VERSION}",
]
FFMPEG_GLOBAL_ARGS_DEFAULT = ["-hide_banner", "-loglevel", "warning"]
FFMPEG_INPUT_ARGS_DEFAULT = [
"-avoid_negative_ts",
"make_zero",

View File

@ -2,6 +2,12 @@
from typing import Any
from frigate.version import VERSION
_user_agent_args = [
"-user_agent",
f"FFmpeg Frigate/{VERSION}",
]
PRESETS_HW_ACCEL = {
"preset-rpi-32-h264": ["-c:v", "h264_v4l2m2m"],
@ -39,7 +45,8 @@ def parse_preset_hardware_acceleration(arg: Any) -> list[str]:
PRESETS_INPUT = {
"preset-http-jpeg-generic": [
"preset-http-jpeg-generic": _user_agent_args
+ [
"-r",
"{}",
"-stream_loop",
@ -59,7 +66,8 @@ PRESETS_INPUT = {
"-use_wallclock_as_timestamps",
"1",
],
"preset-http-mjpeg-generic": [
"preset-http-mjpeg-generic": _user_agent_args
+ [
"-avoid_negative_ts",
"make_zero",
"-fflags",
@ -73,7 +81,8 @@ PRESETS_INPUT = {
"-use_wallclock_as_timestamps",
"1",
],
"preset-http-reolink": [
"preset-http-reolink": _user_agent_args
+ [
"-avoid_negative_ts",
"make_zero",
"-fflags",
@ -107,7 +116,8 @@ PRESETS_INPUT = {
"-f",
"live_flv",
],
"preset-rtsp-generic": [
"preset-rtsp-generic": _user_agent_args
+ [
"-avoid_negative_ts",
"make_zero",
"-fflags",
@ -119,7 +129,8 @@ PRESETS_INPUT = {
"-use_wallclock_as_timestamps",
"1",
],
"preset-rtsp-udp": [
"preset-rtsp-udp": _user_agent_args
+ [
"-avoid_negative_ts",
"make_zero",
"-fflags",
@ -131,7 +142,10 @@ PRESETS_INPUT = {
"-use_wallclock_as_timestamps",
"1",
],
"preset-rtsp-blue-iris": [
"preset-rtsp-blue-iris": _user_agent_args
+ [
"-user_agent",
f"FFmpeg Frigate/{VERSION}",
"-avoid_negative_ts",
"make_zero",
"-flags",

View File

@ -76,8 +76,9 @@ class TestFfmpegPresets(unittest.TestCase):
frigate_config.cameras["back"].create_ffmpeg_cmds()
frigate_preset_config.cameras["back"].create_ffmpeg_cmds()
assert (
frigate_preset_config.cameras["back"].ffmpeg_cmds[0]["cmd"]
== frigate_config.cameras["back"].ffmpeg_cmds[0]["cmd"]
# 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::]
)
def test_ffmpeg_input_preset(self):