[Config Support]: How can I force to use MSE? #14317
Describe the problem you are havingHello, I have two cameras which is connected with a bad 4G mobile connection. I am suffering that the live feed is always fallback to "jsmpeg". Can I force frigate to use only MSE? One more thing, I am using "mediamtx" to get the stream from the cameras, and the mediamtx url is added to the frigate. I see that the connection is not stable This auto fallback function is presented in 0.14.1 Release Thanks Version0.14.1 Frigate config filemqtt:
enabled: false
tls:
enabled: False
#detectors:
# cpu:
# enabled: false
# type: cpu
#detectors:
# ov:
# type: openvino
# device: AUTO
# model:
# path: /openvino-model/ssdlite_mobilenet_v2.xml
#model:
# width: 300
# height: 300
# input_tensor: nhwc
# input_pixel_format: bgr
# labelmap_path: /openvino-model/coco_91cl_bkgr.txt
birdseye:
# Optional: Enable birdseye view (default: shown below)
enabled: false
# Optional: Restream birdseye via RTSP (default: shown below)
# NOTE: Enabling this will set birdseye to run 24/7 which may increase CPU usage somewhat.
restream: false
# Optional: Width of the output resolution (default: shown below)
width: 1920
# Optional: Height of the output resolution (default: shown below)
height: 1080
# Optional: Encoding quality of the mpeg1 feed (default: shown below)
# 1 is the highest quality, and 31 is the lowest. Lower quality feeds utilize less CPU resources.
quality: 5
# Optional: Mode of the view. Available options are: objects, motion, and continuous
# objects - cameras are included if they have had a tracked object within the last 30 seconds
# motion - cameras are included if motion was detected in the last 30 seconds
# continuous - all cameras are included always
mode: motion
database:
path: /config/frigate.db
record:
enabled: true
sync_recordings: false
retain:
days: 180
mode: motion
events:
retain:
default: 30
mode: motion
snapshots:
enabled: false
quality: 100
bounding_box: false
retain:
default: 10
motion:
# Optional: The threshold passed to cv2.threshold to determine if a pixel is different enough to be counted as motion. (default: shown below)
# Increasing this value will make motion detection less sensitive and decreasing it will make motion detection more sensitive.
# The value should be between 1 and 255.
threshold: 60
# Optional: The percentage of the image used to detect lightning or other substantial changes where motion detection
# needs to recalibrate. (default: shown below)
# Increasing this value will make motion detection more likely to consider lightning or ir mode changes as valid motion.
# Decreasing this value will make motion detection more likely to ignore large amounts of motion such as a person approaching
# a doorbell camera.
lightning_threshold: 0.8
# Optional: Minimum size in pixels in the resized motion image that counts as motion (default: shown below)
# Increasing this value will prevent smaller areas of motion from being detected. Decreasing will
# make motion detection more sensitive to smaller moving objects.
# As a rule of thumb:
# - 10 - high sensitivity
# - 30 - medium sensitivity
# - 50 - low sensitivity
contour_area: 20
# Optional: Alpha value passed to cv2.accumulateWeighted when averaging frames to determine the background (default: shown below)
# Higher values mean the current frame impacts the average a lot, and a new object will be averaged into the background faster.
# Low values will cause things like moving shadows to be detected as motion for longer.
# https://www.geeksforgeeks.org/background-subtraction-in-an-image-using-concept-of-running-average/
#frame_alpha: 0.01
# Optional: Height of the resized motion frame (default: 100)
# Higher values will result in more granular motion detection at the expense of higher CPU usage.
# Lower values result in less CPU, but small changes may not register as motion.
#frame_height: 100
# Optional: motion mask
# NOTE: see docs for more detailed info on creating masks
#mask: 0,900,1080,900,1080,1920,0,1920
# Optional: improve contrast (default: shown below)
# Enables dynamic contrast improvement. This should help improve night detections at the cost of making motion detection more sensitive
# for daytime.
#improve_contrast: True
# Optional: Delay when updating camera motion through MQTT from ON -> OFF (default: shown below).
#mqtt_off_delay: 30
go2rtc:
streams:
5HSB0LCV:
- rtsp://url/5HSB0LCV#media=video#video=h264#timeout=60backchannel=0
SZ822WNA:
- rtsp://url/SZ822WNA#media=video#video=h264#timeout=60#backchannel=0
webrtc:
candidates:
- 192.168.0.2:8555
- stun:8555
# Optional: ffmpeg configuration
# More information about presets at https://docs.frigate.video/configuration/ffmpeg_presets
ffmpeg:
# Optional: global ffmpeg args (default: shown below)
global_args: -hide_banner -loglevel warning -threads 2
# Optional: global hwaccel args (default: auto detect)
# NOTE: See hardware acceleration docs for your specific device
hwaccel_args:
- -c:v
- h264_v4l2m2m
# Optional: global input args (default: shown below preset-rtsp-generic, preset-rtsp-restream-low-latency)
input_args: preset-rtsp-generic
# - -avoid_negative_ts
# - make_zero
# - -fflags
# - +genpts+discardcorrupt
# - -rtsp_transport
# - tcp
# - -timeout
# - '10000000'
# - -use_wallclock_as_timestamps
# - '1'
# - -flags
# - low_delay
# Optional: global output args
output_args:
# Optional: output args for detect streams (default: shown below)
detect: -threads 2 -f rawvideo -pix_fmt yuv420p
# Optional: output args for record streams (default: shown below)
record: preset-record-generic
# Optional: Time in seconds to wait before ffmpeg retries connecting to the camera. (default: shown below)
# If set too low, frigate will retry a connection to the camera's stream too frequently, using up the limited streams some cameras can allow at once
# If set too high, then if a ffmpeg crash or camera stream timeout occurs, you could potentially lose up to a maximum of retry_interval second(s) of footage
# NOTE: this can be a useful setting for Wireless / Battery cameras to reduce how much footage is potentially lost during a connection timeout.
retry_interval: 10
# Optional: Detect configuration
# NOTE: Can be overridden at the camera level
detect:
# Optional: width of the frame for the input with the detect role (default: use native stream resolution)
width: 1920
# Optional: height of the frame for the input with the detect role (default: use native stream resolution)
height: 1080
# Optional: desired fps for your camera for the input with the detect role (default: shown below)
# NOTE: Recommended value of 5. Ideally, try and reduce your FPS on the camera.
fps: 5
# Optional: enables detection for the camera (default: True)
enabled: False
# Optional: Number of consecutive detection hits required for an object to be initialized in the tracker. (default: 1/2 the frame rate)
min_initialized: 2
# Optional: Number of frames without a detection before Frigate considers an object to be gone. (default: 5x the frame rate)
max_disappeared: 25
# Optional: Configuration for stationary object tracking
stationary:
# Optional: Frequency for confirming stationary objects (default: same as threshold)
# When set to 1, object detection will run to confirm the object still exists on every frame.
# If set to 10, object detection will run to confirm the object still exists on every 10th frame.
interval: 50
# Optional: Number of frames without a position change for an object to be considered stationary (default: 10x the frame rate or 10s)
threshold: 50
# Optional: Define a maximum number of frames for tracking a stationary object (default: not set, track forever)
# This can help with false positives for objects that should only be stationary for a limited amount of time.
# It can also be used to disable stationary object tracking. For example, you may want to set a value for person, but leave
# car at the default.
# WARNING: Setting these values overrides default behavior and disables stationary object tracking.
# There are very few situations where you would want it disabled. It is NOT recommended to
# copy these values from the example config into your config unless you know they are needed.
max_frames:
# Optional: Default for all object types (default: not set, track forever)
default: 3000
# Optional: Object specific values
objects:
person: 1000
# Optional: Milliseconds to offset detect annotations by (default: shown below).
# There can often be latency between a recording and the detect process,
# especially when using separate streams for detect and record.
# Use this setting to make the timeline bounding boxes more closely align
# with the recording. The value can be positive or negative.
# TIP: Imagine there is an event clip with a person walking from left to right.
# If the event timeline bounding box is consistently to the left of the person
# then the value should be decreased. Similarly, if a person is walking from
# left to right and the bounding box is consistently ahead of the person
# then the value should be increased.
# TIP: This offset is dynamic so you can change the value and it will update existing
# events, this makes it easy to tune.
# WARNING: Fast moving objects will likely not have the bounding box align.
annotation_offset: 0
cameras:
5HSB0LCV:
enabled: true
review:
detections:
labels: []
ffmpeg:
inputs:
- path: rtsp://url
roles:
- record
SZ822WNA:
enabled: true
review:
detections:
labels: []
ffmpeg:
inputs:
- path: rtsp://url
roles:
- record
version: 0.14Relevant Frigate log output2024-10-13 14:33:51.075164132 [2024-10-13 14:33:51] ffmpeg.5HSB0LCV.detect ERROR : [rtsp @ 0x559a5eb2c0] method DESCRIBE failed: 404 Not Found
2024-10-13 14:33:51.075171928 [2024-10-13 14:33:51] ffmpeg.5HSB0LCV.detect ERROR : rtsp://*:*@192.168.0.2:8554/5HSB0LCV: Server returned 404 Not Found
2024-10-13 14:33:54.019125245 [2024-10-13 14:33:54] watchdog.SZ822WNA ERROR : Ffmpeg process crashed unexpectedly for SZ822WNA.
2024-10-13 14:33:54.019136449 [2024-10-13 14:33:54] watchdog.SZ822WNA ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
2024-10-13 14:33:54.019139523 [2024-10-13 14:33:54] ffmpeg.SZ822WNA.detect ERROR : [rtsp @ 0x55691ef2c0] method DESCRIBE failed: 404 Not Found
2024-10-13 14:33:54.019142542 [2024-10-13 14:33:54] ffmpeg.SZ822WNA.detect ERROR : rtsp://*:*@192.168.0.2:8554/SZ822WNA: Server returned 404 Not Found
2024-10-13 14:36:26.831737048 [2024-10-13 14:36:26] frigate.video ERROR : SZ822WNA: Unable to read frames from ffmpeg process.
2024-10-13 14:36:26.835481246 [2024-10-13 14:36:26] frigate.video ERROR : SZ822WNA: ffmpeg process is not running. exiting capture thread...
2024-10-13 14:36:26.863047049 [2024-10-13 14:36:26] frigate.video ERROR : 5HSB0LCV: Unable to read frames from ffmpeg process.
2024-10-13 14:36:26.863828155 [2024-10-13 14:36:26] frigate.video ERROR : 5HSB0LCV: ffmpeg process is not running. exiting capture thread...
2024-10-13 14:36:31.164349016 [2024-10-13 14:36:31] watchdog.5HSB0LCV ERROR : Ffmpeg process crashed unexpectedly for 5HSB0LCV.
2024-10-13 14:36:31.186116319 [2024-10-13 14:36:31] watchdog.5HSB0LCV ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
2024-10-13 14:36:31.467312611 [2024-10-13 14:36:31] frigate.video ERROR : 5HSB0LCV: Unable to read frames from ffmpeg process.
2024-10-13 14:36:31.467877886 [2024-10-13 14:36:31] frigate.video ERROR : 5HSB0LCV: ffmpeg process is not running. exiting capture thread...
2024-10-13 14:36:34.197370854 [2024-10-13 14:36:34] watchdog.SZ822WNA ERROR : Ffmpeg process crashed unexpectedly for SZ822WNA.
2024-10-13 14:36:34.197589760 [2024-10-13 14:36:34] watchdog.SZ822WNA ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
2024-10-13 14:36:34.436236438 [2024-10-13 14:36:34] frigate.video ERROR : SZ822WNA: Unable to read frames from ffmpeg process.
2024-10-13 14:36:34.437049544 [2024-10-13 14:36:34] frigate.video ERROR : SZ822WNA: ffmpeg process is not running. exiting capture thread...
2024-10-13 14:36:41.215429016 [2024-10-13 14:36:41] watchdog.5HSB0LCV ERROR : Ffmpeg process crashed unexpectedly for 5HSB0LCV.
2024-10-13 14:36:41.215440404 [2024-10-13 14:36:41] watchdog.5HSB0LCV ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
2024-10-13 14:36:41.215443404 [2024-10-13 14:36:41] ffmpeg.5HSB0LCV.detect ERROR : [rtsp @ 0x5596f882c0] method DESCRIBE failed: 404 Not Found
2024-10-13 14:36:41.215446330 [2024-10-13 14:36:41] ffmpeg.5HSB0LCV.detect ERROR : rtsp://*:*@192.168.0.2:8554/5HSB0LCV: Server returned 404 Not Found
2024-10-13 14:36:44.227099364 [2024-10-13 14:36:44] watchdog.SZ822WNA ERROR : Ffmpeg process crashed unexpectedly for SZ822WNA.
2024-10-13 14:36:44.227110364 [2024-10-13 14:36:44] watchdog.SZ822WNA ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
2024-10-13 14:36:44.227464751 [2024-10-13 14:36:44] ffmpeg.SZ822WNA.detect ERROR : [rtsp @ 0x55be8d92c0] method DESCRIBE failed: 404 Not Found
2024-10-13 14:36:44.227751064 [2024-10-13 14:36:44] ffmpeg.SZ822WNA.detect ERROR : rtsp://*:*@192.168.0.2:8554/SZ822WNA: Server returned 404 Not Found
2024-10-13 14:39:13.170123020 [2024-10-13 14:39:13] frigate.video ERROR : SZ822WNA: Unable to read frames from ffmpeg process.
2024-10-13 14:39:13.173494942 [2024-10-13 14:39:13] frigate.video ERROR : SZ822WNA: ffmpeg process is not running. exiting capture thread...
2024-10-13 14:39:13.223664591 [2024-10-13 14:39:13] frigate.video ERROR : 5HSB0LCV: Unable to read frames from ffmpeg process.
2024-10-13 14:39:13.223676146 [2024-10-13 14:39:13] frigate.video ERROR : 5HSB0LCV: ffmpeg process is not running. exiting capture thread...
2024-10-13 14:39:14.398544814 [2024-10-13 14:39:14] watchdog.SZ822WNA ERROR : Ffmpeg process crashed unexpectedly for SZ822WNA.
2024-10-13 14:39:14.401061075 [2024-10-13 14:39:14] watchdog.SZ822WNA ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
2024-10-13 14:39:14.682616392 [2024-10-13 14:39:14] frigate.video ERROR : SZ822WNA: Unable to read frames from ffmpeg process.
2024-10-13 14:39:14.682628466 [2024-10-13 14:39:14] frigate.video ERROR : SZ822WNA: ffmpeg process is not running. exiting capture thread...
2024-10-13 14:39:21.371434322 [2024-10-13 14:39:21] watchdog.5HSB0LCV ERROR : Ffmpeg process crashed unexpectedly for 5HSB0LCV.
2024-10-13 14:39:21.371444785 [2024-10-13 14:39:21] watchdog.5HSB0LCV ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
2024-10-13 14:39:24.430661094 [2024-10-13 14:39:24] watchdog.SZ822WNA ERROR : Ffmpeg process crashed unexpectedly for SZ822WNA.
2024-10-13 14:39:24.432062585 [2024-10-13 14:39:24] watchdog.SZ822WNA ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
2024-10-13 14:39:24.432476175 [2024-10-13 14:39:24] ffmpeg.SZ822WNA.detect ERROR : [rtsp @ 0x559cea62c0] method DESCRIBE failed: 404 Not Found
2024-10-13 14:39:24.433093837 [2024-10-13 14:39:24] ffmpeg.SZ822WNA.detect ERROR : rtsp://*:*@192.168.0.2:8554/SZ822WNA: Server returned 404 Not FoundRelevant go2rtc log output2024-10-13 14:12:43.648904297 [INFO] Preparing new go2rtc config...
2024-10-13 14:12:44.793082819 [INFO] Not injecting WebRTC candidates into go2rtc config as it has been set manually
2024-10-13 14:12:45.094975876 [INFO] Starting go2rtc...
2024-10-13 14:12:45.293437560 14:12:45.293 INF go2rtc platform=linux/arm64 revision=b2399f3 version=1.9.2
2024-10-13 14:12:45.293497930 14:12:45.293 INF config path=/dev/shm/go2rtc.yaml
2024-10-13 14:12:45.294707790 14:12:45.294 INF [rtsp] listen addr=:8554
2024-10-13 14:12:45.295646097 14:12:45.295 INF [api] listen addr=:1984
2024-10-13 14:12:45.296002113 14:12:45.295 INF [webrtc] listen addr=:8555
2024-10-13 14:12:53.373831624 [INFO] Starting go2rtc healthcheck service...
2024-10-13 14:13:39.230472715 14:13:39.228 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=rtsp://secretF@192.168.0.2:8554/SZ822WNA#media=video#video=h264#timeout=60#backchannel=0
2024-10-13 14:14:03.809193815 14:14:03.808 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=rtsp://secretF@192.168.0.2:8554/5HSB0LCV#media=video#video=h264#timeout=60backchannel=0
2024-10-13 14:15:09.990556081 14:15:09.990 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error="read tcp 172.27.0.6:36738->192.168.0.2:8554: i/o timeout" url=rtsp://secretF@192.168.0.2:8554/5HSB0LCV#media=video#video=h264#timeout=60backchannel=0
2024-10-13 14:24:32.808500366 14:24:32.806 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=rtsp://secretF@192.168.0.2:8554/SZ822WNA#media=video#video=h264#timeout=60#backchannel=0
2024-10-13 14:25:37.563089361 14:25:37.562 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=rtsp://secretF@192.168.0.2:8554/SZ822WNA#media=video#video=h264#timeout=60#backchannel=0
2024-10-13 14:29:02.840127254 14:29:02.839 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=rtsp://secretF@192.168.0.2:8554/SZ822WNA#media=video#video=h264#timeout=60#backchannel=0
2024-10-13 14:33:23.210036344 14:33:23.208 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=rtsp://secretF@192.168.0.2:8554/SZ822WNA#media=video#video=h264#timeout=60#backchannel=0
2024-10-13 14:36:26.806862820 14:36:26.804 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=rtsp://secretF@192.168.0.2:8554/SZ822WNA#media=video#video=h264#timeout=60#backchannel=0
2024-10-13 14:39:13.097027838 14:39:13.096 WRN github.com/AlexxIT/go2rtc/internal/streams/producer.go:171 > error=EOF url=rtsp://secretF@192.168.0.2:8554/SZ822WNA#media=video#video=h264#timeout=60#backchannel=0Frigate statsNo response Operating systemOther Linux Install methodDocker Compose docker-compose file or Docker CLI commandnvr:
privileged: true # this may not be necessary for all setups
restart: unless-stopped
image: ghcr.io/blakeblackshear/frigate:0.14.1
shm_size: "128mb" # update for your cameras based on calculation above
# devices:
#- /dev/bus/usb:/dev/bus/usb # Passes the USB Coral, needs to be modified for other versions
#- /dev/apex_0:/dev/apex_0 # Passes a PCIe Coral, follow driver instructions here https://coral.ai/docs/m2/get-started/#2a-on-linux
#- /dev/video10:/dev/video10 # For Raspberry Pi 4B
#- /dev/video11:/dev/video11 # For Raspberry Pi 4B
#- /dev/dri/renderD128:/dev/dri/renderD128 # For intel hwaccel, needs to be updated for your hardware
volumes:
- /etc/localtime:/etc/localtime:ro
#- E:/frigate/config:/config
#- E:/frigate/storage:/media/frigate
- /media/nas/frigate/config:/config
- /media/nas/frigate/storage:/media/frigate
- type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
target: /tmp/cache
tmpfs:
size: 500000000
ports:
- "8971:8971"
- "5000:5000" # Internal unauthenticated access. Expose carefully.
#- "8554:8554" # RTSP feeds
- "8555:8555/tcp" # WebRTC over tcp
- "8555:8555/udp" # WebRTC over udp
environment:
FRIGATE_RTSP_PASSWORD: "password"
networks:
- traefik-public
- default
labels:
- traefik.enable=true
- traefik.docker.network=traefik-public
- traefik.constraint-label=traefik-public
- traefik.http.routers.${STACK_NAME?Variable not set}-nvr-https.rule=(Host(`nvr.${DOMAIN?Variable not set}`))
- traefik.http.routers.${STACK_NAME?Variable not set}-nvr-https.entrypoints=https
- traefik.http.routers.${STACK_NAME?Variable not set}-nvr-https.tls=true
- traefik.http.routers.${STACK_NAME?Variable not set}-nvr-https.tls.certresolver=le
- traefik.http.services.${STACK_NAME?Variable not set}-nvr.loadbalancer.server.port=8971Object DetectorCPU (no coral) Screenshots of the Frigate UI's System metrics pagesNo response Any other information that may be helpfulNo response |
Replies: 2 comments 3 replies
|
No, this is not possible in Frigate 0.14. Frigate 0.14 intelligently switches live modes and prioritizes showing an actual up-to-date live view of your camera's stream as quickly as possible. If it is switching to jsmpeg, it's due to either an initial timeout or a low bandwidth condition that would cause buffering of the stream. There is an open feature request for selecting a different stream (not stream technology type) that you can leave a thumbs up on here: #12832 |
|
I noticed you aren't showing the urls for your cameras in your config file. If you aren't using restream with a single connection to the camera, you should consider that. Because of your setup, you may find that your Live view spins up more quickly and you avoid the initial timeout. Additionally, codec settings are an important consideration. See the recommended camera settings for Live view. If you do have a low bandwidth situation though, there isn't much that can be done. |
Frigate is behaving as expected here. Once it falls back to jsmpeg, it stays in jsmpeg until you refresh or navigate away and return. There are no connection or bandwidth checks once it is streaming as jsmpeg.