frigate: [Support]: Beta2 FFmpeg QSV HW Acceleration and audio not working on Reolink Cams
Describe the problem you are having
Green screens and errors (with Reolink cameras) if using FFmpeg hwaccel_args
for QSV, plus previous detect
and record
args also throw errors.
Intel 11th Gen NUC running Clear Linux + Docker.
This FFmpeg config works without errors:
ffmpeg:
# hwaccel_args: -hwaccel_output_format qsv -c:v h264_qsv
input_args: -avoid_negative_ts make_zero -fflags nobuffer+genpts+discardcorrupt -flags low_delay -strict experimental -analyzeduration 1000M -probesize 1000M -rw_timeout 5000000
# output_args:
# detect: -f rawvideo -vf hwdownload,format=nv12 -pix_fmt yuv420p
# record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy # -an
EDIT: note - hwaccel qsv
has been deprecated according to logged output, thus my new argument in config.
[2022-05-19 11:01:12] ffmpeg.Driveway.record ERROR : WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv".
(Trying to find the new record args to get audio now…)
Version
0.11.0-D2C3CDC
Frigate config file
database:
path: /db/frigate.db
mqtt:
host: 192.168.1.5
port: 1883
user: mqtt
password: "{FRIGATE_MQTT_PASSWORD}"
birdseye:
mode: continuous
width: 1792
height: 1344
detect:
width: 896
height: 672
fps: 5
stationary:
interval: 10
detectors:
coral:
type: edgetpu
device: usb
ffmpeg:
hwaccel_args: -hwaccel_output_format qsv -c:v h264_qsv
input_args: -avoid_negative_ts make_zero -fflags nobuffer+genpts+discardcorrupt -flags low_delay -strict experimental -analyzeduration 1000M -probesize 1000M -rw_timeout 5000000
output_args:
detect: -f rawvideo -vf hwdownload,format=nv12 -pix_fmt yuv420p
record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy # -an
live:
height: 672
motion:
mask:
- 265,650,265,625,630,625,630,650
objects:
filters:
person:
min_area: 5000
min_score: 0.6
record:
enabled: True
expire_interval: 240
retain:
days: 5
mode: motion
events:
retain:
default: 21
mode: active_objects
rtmp:
enabled: False
snapshots:
enabled: True
clean_copy: False
bounding_box: True
retain:
default: 60
timestamp_style:
format: "%d/%m/%Y %H:%M:%S"
cameras:
Balcony:
ffmpeg:
inputs:
- path: http://192.168.1.76/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user={FRIGATE_USER}&password={FRIGATE_PASSWORD}
roles:
- detect
- path: http://192.168.1.76/flv?port=1935&app=bcs&stream=channel0_main.bcs&user={FRIGATE_USER}&password={FRIGATE_PASSWORD}
roles:
- record
objects:
track:
- person
- vehicle
Relevant log output
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[2022-05-19 11:33:05] frigate.app INFO : Starting Frigate (0.11.0-d2c3cdc)
Starting migrations
[2022-05-19 11:33:05] peewee_migrate INFO : Starting migrations
There is nothing to migrate
[2022-05-19 11:33:05] peewee_migrate INFO : There is nothing to migrate
[2022-05-19 11:33:05] detector.coral INFO : Starting detection process: 223
[2022-05-19 11:33:05] frigate.app INFO : Output process started: 225
[2022-05-19 11:33:05] frigate.edgetpu INFO : Attempting to load TPU as usb
[2022-05-19 11:33:05] ws4py INFO : Using epoll
[2022-05-19 11:33:05] frigate.app INFO : Camera processor started for Balcony: 231
[2022-05-19 11:33:07] frigate.edgetpu INFO : TPU found
[2022-05-19 11:33:05] frigate.app INFO : Capture process started for Balcony: 234
[2022-05-19 11:33:05] ws4py INFO : Using epoll
[2022-05-19 11:33:25] watchdog.Balcony INFO : No frames received from Balcony in 20 seconds. Exiting ffmpeg...
[2022-05-19 11:33:25] watchdog.Balcony INFO : Waiting for ffmpeg to exit gracefully...
[2022-05-19 11:33:25] frigate.video ERROR : Balcony: Unable to read frames from ffmpeg process.
[2022-05-19 11:33:25] frigate.video ERROR : Balcony: ffmpeg process is not running. exiting capture thread...
[2022-05-19 11:33:25] ffmpeg.Balcony.record ERROR : [mp4 @ 0x56024f797340] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 31200 >= 224
[2022-05-19 11:33:25] ffmpeg.Balcony.record ERROR : av_interleaved_write_frame(): Invalid argument
[2022-05-19 11:33:25] watchdog.Balcony INFO : Terminating the existing ffmpeg process...
[2022-05-19 11:33:25] watchdog.Balcony INFO : Waiting for ffmpeg to exit gracefully...
[2022-05-19 11:33:35] watchdog.Balcony ERROR : Ffmpeg process crashed unexpectedly for Balcony.
[2022-05-19 11:33:35] watchdog.Balcony ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
[2022-05-19 11:33:35] ffmpeg.Balcony.detect ERROR : Error while decoding stream #0:0: Invalid argument
[2022-05-19 11:33:35] ffmpeg.Balcony.detect ERROR : [h264_qsv @ 0x55bd5c6bec40] Error initializing the MFX video decoder: invalid video parameters (-15)
[2022-05-19 11:33:35] ffmpeg.Balcony.detect ERROR : Error while decoding stream #0:0: Invalid argument
...
[2022-05-19 11:33:35] ffmpeg.Balcony.detect ERROR : [h264_qsv @ 0x55bd5c6bec40] [IMGUTILS @ 0x7ffd71561e90] Picture size 0x0 is invalid
[2022-05-19 11:33:35] ffmpeg.Balcony.detect ERROR : [h264_qsv @ 0x55bd5c6bec40] video_get_buffer: image parameters invalid
[2022-05-19 11:33:35] ffmpeg.Balcony.detect ERROR : [h264_qsv @ 0x55bd5c6bec40] get_buffer() failed
[2022-05-19 11:33:35] ffmpeg.Balcony.detect ERROR : Error while decoding stream #0:0: Invalid argument
[2022-05-19 11:33:35] ffmpeg.Balcony.detect ERROR : Finishing stream 0:0 without any data written to it.
[2022-05-19 11:33:35] ffmpeg.Balcony.detect ERROR : Impossible to convert between the formats supported by the filter 'graph 0 input from stream 0:0' and the filter 'auto_scaler_0'
[2022-05-19 11:33:35] ffmpeg.Balcony.detect ERROR : Error configuring filter graph
[2022-05-19 11:33:35] ffmpeg.Balcony.record ERROR : [mp4 @ 0x5573757dc600] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 31712 >= 752
[2022-05-19 11:33:35] ffmpeg.Balcony.record ERROR : av_interleaved_write_frame(): Invalid argument
[2022-05-19 11:33:35] watchdog.Balcony INFO : Terminating the existing ffmpeg process...
[2022-05-19 11:33:35] watchdog.Balcony INFO : Waiting for ffmpeg to exit gracefully...
[2022-05-19 11:33:45] ffmpeg.Balcony.record ERROR : [mp4 @ 0x56242df45600] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 31728 >= 768
[2022-05-19 11:33:45] ffmpeg.Balcony.record ERROR : av_interleaved_write_frame(): Invalid argument
[2022-05-19 11:33:45] ffmpeg.Balcony.record ERROR : [mp4 @ 0x56242df45600] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 31728 >= 1792
[2022-05-19 11:33:45] ffmpeg.Balcony.record ERROR : Error writing trailer of /tmp/cache/Balcony-%Y%m%d%H%M%S.mp4: Invalid argument
[2022-05-19 11:33:45] watchdog.Balcony INFO : Terminating the existing ffmpeg process...
[2022-05-19 11:33:45] watchdog.Balcony INFO : Waiting for ffmpeg to exit gracefully...
[2022-05-19 11:33:55] watchdog.Balcony INFO : No frames received from Balcony in 20 seconds. Exiting ffmpeg...
[2022-05-19 11:33:55] watchdog.Balcony INFO : Waiting for ffmpeg to exit gracefully...
[2022-05-19 11:33:55] frigate.video ERROR : Balcony: Unable to read frames from ffmpeg process.
[2022-05-19 11:33:55] frigate.video ERROR : Balcony: ffmpeg process is not running. exiting capture thread...
[2022-05-19 11:33:55] ffmpeg.Balcony.record ERROR : [mp4 @ 0x55a0384483c0] Application provided invalid, non monotonically increasing dts to muxer in stream 1: 31728 >= 768
[2022-05-19 11:33:55] ffmpeg.Balcony.record ERROR : av_interleaved_write_frame(): Invalid argument
[2022-05-19 11:33:55] watchdog.Balcony INFO : Terminating the existing ffmpeg process...
[2022-05-19 11:33:55] watchdog.Balcony INFO : Waiting for ffmpeg to exit gracefully...
[2022-05-19 11:34:05] watchdog.Balcony ERROR : Ffmpeg process crashed unexpectedly for Balcony.
[2022-05-19 11:34:05] watchdog.Balcony ERROR : The following ffmpeg logs include the last 100 lines prior to exit.
FFprobe output from your camera
ffprobe rtsp://user:pass@192.168.1.71:554//h264Preview_01_sub
ffprobe version 4.4.1-Jellyfin Copyright (c) 2007-2021 the FFmpeg developers
built with gcc 10 (Debian 10.2.1-6)
configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-shared --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto --enable-gpl --enable-version3 --enable-static --enable-gmp --enable-gnutls --enable-libdrm --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libdav1d --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --arch=amd64 --enable-opencl --enable-vaapi --enable-amf --enable-libmfx --enable-vdpau --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, rtsp, from 'rtsp://-@192.168.1.71:554//h264Preview_01_sub':
Metadata:
title : Session streamed by "preview"
comment : h264Preview_01_sub
Duration: N/A, start: 0.000375, bitrate: N/A
Stream #0:0: Video: h264 (High), yuv420p(progressive), 640x480, 10 tbr, 90k tbn, 180k tbc
Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
Frigate stats
{"Balcony":{"camera_fps":0.0,"capture_pid":242,"detection_fps":0.0,"pid":230,"process_fps":0.0,"skipped_fps":0.0},"Deck":{"camera_fps":0.0,"capture_pid":245,"detection_fps":0.0,"pid":234,"process_fps":0.0,"skipped_fps":0.0},"Driveway":{"camera_fps":0.0,"capture_pid":250,"detection_fps":0.0,"pid":235,"process_fps":0.0,"skipped_fps":0.0},"Entrance":{"camera_fps":0.0,"capture_pid":258,"detection_fps":0.0,"pid":237,"process_fps":0.0,"skipped_fps":0.0},"Laundry":{"camera_fps":0.0,"capture_pid":264,"detection_fps":0.0,"pid":238,"process_fps":0.0,"skipped_fps":0.0},"Rumpus":{"camera_fps":0.0,"capture_pid":268,"detection_fps":0.0,"pid":240,"process_fps":0.0,"skipped_fps":0.0},"detection_fps":0.0,"detectors":{"coral":{"detection_start":0.0,"inference_speed":10.0,"pid":223}},"service":{"latest_version":"0.10.1","storage":{"/dev/shm":{"free":334.6,"mount_type":"tmpfs","total":335.5,"used":0.9},"/media/frigate/clips":{"free":648808.4,"mount_type":"ext4","total":983350.1,"used":284514.7},"/media/frigate/recordings":{"free":648808.4,"mount_type":"ext4","total":983350.1,"used":284514.7},"/tmp/cache":{"free":1073.7,"mount_type":"tmpfs","total":1073.7,"used":0.0}},"temperatures":{},"uptime":1681,"version":"0.11.0-d2c3cdc"}}
Operating system
Other Linux
Install method
Docker Compose
Coral version
USB
Network connection
Wired
Camera make and model
Reolink RLC-520A
Any other information that may be helpful
docker-compose
services:
frigate:
container_name: frigate
image: blakeblackshear/frigate:0.11.0-beta2
hostname: frigate
restart: always
shm_size: '320m'
devices:
- /dev/dri/renderD128:/dev/dri/renderD128
- /dev/bus/usb:/dev/bus/usb
volumes:
- /etc/localtime:/etc/localtime:ro
- /home/jason/docker/frigate/config.yml:/config/config.yml:ro
- /home/jason/docker/frigate/labelmap.txt:/labelmap.txt:ro
- /home/jason/docker/frigate/db:/db
- /data/frigate:/media/frigate
- type: tmpfs
target: /tmp/cache
tmpfs:
size: '1gb'
network_mode: bridge
ports:
- 5000:5000
environment:
FRIGATE_MQTT_PASSWORD: ""
FRIGATE_USER: ""
FRIGATE_PASSWORD: ""
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 102 (19 by maintainers)
HTTP streams with hwaccel and audio are working with this Frigate 0.11-beta2 config :
EDIT2: Updated ffmpeg block as below, for a complete working config.
One more update for smoother clips; similar/same as they were in 0.10, vs the above configs that produced clips full of stutter.
Three differences from my 0.10 config, but multiple hours of trying arguments to work that out. 🤦♂️
Or, as per @minglarn’s post above, use this for hardware accel using VAAPI:
hwaccel_args: -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -hwaccel_output_format yuv420p
I found something interesting related to iframes aka keyframes and http vs rtsp.
I have a reolink duo gen1 and an 810A and this thread was invaluable to getting things working great.
The newer firmware versions for these cameras have the option to set the “Interframe Space” value from 1x to 4x. I understand keyframes and fps and all that, but I wasn’t exactly sure what “Interframe Space” meant in reolink’s setting.
I used ffprobe to see how changing that value would affect the keyframe interval using:
ffprobe -loglevel error -select_streams v:0 -show_entries packet=pts_time,flags -of csv=print_section=0 "http://192.168.1.150/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=[redacted]&password=[redacted]"
But, I found that changing “Interframe Space” made no difference to the keyframe interval. With my fps set to 15 the keyframes were occuring once every other second, and then I noticed that it was actually outputting at 20 fps, not 15. After trying a few other settings the fps and keyframe interval didn’t change.I tried the same ffprobe command but pointed it to my rtsp url.
ffprobe -loglevel error -select_streams v:0 -show_entries packet=pts_time,flags -of csv=print_section=0 "rtsp://[redacted]:[redacted]@192.168.1.150:554/h264Preview_01_sub"
Using rtsp, the keyframes are once per second and the fps was what I actually set it to. So, I set my conf to use the http url for recording and the rtsp stream for detect. We’ll see how it goes but it seems fine so far.In the end, I think their “Interframe Space” setting really means number of seconds per keyframe. So, 1x would be 1 keyframe/sec, 4x would be 1 keyframe/4sec. Also, the http url doesn’t seem to adhere to the fps/keyframe settings, at least for the substream. This issue does only seem to be on the substream as the main stream was recorded via http and my videos have their keyframes 1/sec and recording at 15fps.
https://docs.frigate.video/configuration/camera_specific#reolink-cameras
Yep, I have the drivers installed. Looks like I may have just had too many args in the hwaccel_args line.
Fingers crossed, this is what appears to be working for now:
Originally I had quite a few things and now it is just stripped back to one for the hwaccel_args
Th
Thanks @jasonpstokes This does improve the recording from Reolink 410 playback even without hardware accel which doesn’t work on my system with the beta version and I don’t notice much cpu utilization difference.
Unfortunately it seems this only applies to their newer cameras. A lot of people I’ve seen on here have the RLC-410 or something from that era, which Reolink has now end of lifed and has said they will not fix the issues with it (even though the issues were apparent while they were still selling them a few months ago).
I just bit the bullet on 4 new Loryta 5442s and will be putting all of my reolinks on ebay if anyone is interested. I’m done with that company.
Just as another note, just saw this video which shows new reolink rtsp version / settings that may give another option and hopefully fix some issues with reolink cams in general
This works fine for my Reolink 811A 4K camera. Thanks for sharing. Have you been able to get audio working as well? I’ve added to the ffmpeg transcoding of the go2rtc.streams.camera section, but to no avail:
Update: got audio working. Had to enable audio recording in camera settings.
these args should not be used anymore, in general
preset-vaapi
should be used https://docs.frigate.video/configuration/hardware_accelerationyou could but that would be wasteful as it would be asking go2rtc to send another copy of the record stream including the video which won’t be used anyway. It would be better to do:
That is correct
For what it’s worth I’m running 5 Reolink cameras using RTSP h.265 without a problem.
I have 3 x 811’s at 3380x2160 h.265, 1 x Duo Floodlight at 4096x1536 h.265 and 1 x WifiDoorbell at 2560x1920 h.264. Hardware is a $200 Mini PC with at Celeron N5095A and a Coral USB module. Cameras are all set to 15fps with 1x keyframe (except the duo which won’t do 1x). Detect is set to 5fps.
This is how I have it setup, I’m converting the h.265 to 264 in
go2rtc
which avoids the playback issues with h.265 - Intel Quicksync is carrying most of the load here.Then for each camera I’m using the full res stream, example:
This is what the system load looks like. I’m fine on coral and graphics but running at the limit for CPU so if I add any more cameras I might have to upgrade to a $400 mini pc. 😃
Please create a new issue. Everyone who has contributed to this thread will be getting notifications 😃
@jasonpstokes I bugged reolink support until they sent me a beta firmware for my RLC-810A.
I sent it over to this repo, which keeps track of a lot of reolink firmware versions https://github.com/AT0myks/reolink-fw-archive
They’re more or less the same, use qsv and if it has problems use vaapi
How are you measuring that delay?
That’s an older camera with old firmware. Their newer cameras have more options like setting iframe interval and CBR.
I have been using reolinks new doorbell as well as the 511wa and on both of them rtsp or http has virtually no delay. I have their http streams setup in go2rtc and can watch via WebRTC while looking out my window and things are the same as real time.
I’ve never heard of delay being an issue. The smearing on rtsp is typical reolink due to their bad rtsp engine that they use, though cameras with newer firmware have improved on this front too.
Like I said above I’ve had great results with http on these two newer reolinks.
frps is a typo… It should be:

fps=fps=5
Edit: found the video where Linus is showing his config for Frigate. https://www.youtube.com/watch?v=B635wcdr6-w It’s about 7:20 into the video.Thanks @Minglarn & @jasonpstokes for posting the configs. I’ve got the RLC-410 & RLC-511. So I’ll have a look today and see what difference using your config/s goes. Once that’s up & running then I’ll also try to get my nvidia acceleration working as well 😃
Thanks @NickM-27 will do - will learn how! - after running it for a few days to confirm, plus to see what feedback others have.
Can confirm that THIS works with ReoLink rtmp streams. Nice! Thanks for finding out the right settings… Edit: Works with both 510A, 520A and 410 models… 👍
Turns out hardware acceleration AND audio both work for RTSP and RTMP streams,
but not for HTTP streams. 🤷♂️(see updated config here ) At least with my Reolink RLC-520A cameras - anyone else seeing this?e.g. working RTSP stream config:
e.g. working RTMP stream config (RTMP has the advantage of a ‘Balanced’ stream option for better detect/live view resolution and, for me at least, less delay when viewing a live stream, vs. RTSP)
GPU working again:
EDIT: updated
input_args
to closer match the recommended ones in the docs.There’s likely two different issues here: hardware acceleration for Intel QSV with Jellyfin FFmpeg using VAAPI, and then finding the new correct arguments to get a stable stream with audio for the (troublesome) Reolink cameras.
The latest camera firmware lists updates to RTSP and stream fixes, so I’ll try it and different protocols/arguments over the weekend. (Hopefully it’s raining…!)
Really like the direction of 11 and especially the UI improvements.