[HW Accel Support]: use cpu and gpu for recording from rtsp #14506
-
Describe the problem you are havingneed some streams to be processed by the GPU and others by the CPU. Can you help me figure out how to achieve this? In my case, even if I don’t specify "global_args" for a specific camera but simply pass the argument in docker-compose to enable the GPU, everything still gets processed on the GPU, and naturally, the GPU crashes with the error: "[2024-10-22 15:42:02] ffmpeg.cam64.detect ERROR: [AVHWDeviceContext @ 0x560bd16f80c0] cu->cuCtxCreate(&hwctx->cuda_ctx, desired_flags, hwctx->internal->cuda_device) failed -> CUDA_ERROR_OUT_OF_MEMORY: out of memory." I have around 60 cameras, but I’ve simplified the config for readability. Version0.14.1-f4f3cfa Frigate config filedetect:
enabled: false
database:
path: /config/frigate.db
record:
enabled: true
retain:
days: 14
logger:
logs:
frigate.record.maintainer: debug
cameras:
cam102:
ffmpeg:
inputs:
- path: rtsp://puk:pwd@10.3.33.102/axis-media/media.amp
input_args: preset-rtsp-restream
roles:
- record
cam103:
ffmpeg:
inputs:
- path: rtsp://puk:pwd@10.3.4.81/axis-media/media.amp
input_args: preset-rtsp-restream
roles:
- record
cam105:
ffmpeg:
global_args: -hide_banner -loglevel warning -threads 2 -hwaccel_device 0
inputs:
- path: rtsp://puk:pwd@10.3.33.105/axis-media/media.amp
input_args: preset-rtsp-restream
roles:
- record docker-compose file or Docker CLI commandversion: "3.9"
services:
frigate:
privileged: true # this may not be necessary for all setups
image: ghcr.io/blakeblackshear/frigate:0.14.1
deploy:
resources:
reservations:
devices:
- driver: nvidia
device_ids: ['0']
count: 1 # number of GPUs
capabilities: [gpu]
shm_size: "40000MB" # update for your cameras based on calculation above
volumes:
- /etc/localtime:/etc/localtime:ro
- ./config:/config
- ./storage:/media/frigate
- type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
target: /tmp/cache
tmpfs:
size: 10000000000
devices:
- /dev/nvidia-caps:/dev/nvidia-caps
- /dev/nvidia0:/dev/nvidia0
- /dev/nvidiactl:/dev/nvidiactl
- /dev/nvidia-modeset:/dev/nvidia-modeset
- /dev/nvidia-uvm:/dev/nvidia-uvm
- /dev/nvidia-uvm-tools:/dev/nvidia-uvm-tools
ports:
- "5000:5000"
- "8554:8554" # RTSP feeds
- "8555:8555/tcp" # WebRTC over tcp
- "8555:8555/udp" # WebRTC over udp
environment:
FRIGATE_RTSP_PASSWORD: "S4fopae8"
networks:
- internet
restart: unless-stopped
networks:
internet:
external: true Relevant Frigate log output"[2024-10-22 15:42:02] ffmpeg.cam105.detect ERROR: [AVHWDeviceContext @ 0x560bd16f80c0] cu->cuCtxCreate(&hwctx->cuda_ctx, desired_flags, hwctx->internal->cuda_device) failed -> CUDA_ERROR_OUT_OF_MEMORY: out of memory."
and for other cam Relevant go2rtc log outputdon't using FFprobe output from your cameraroot@b3eb51f3cceb:/opt/frigate# ffprobe rtsp://puk:pwd@10.3.33.105/axis-media/media.amp
ffprobe version n5.1-2-g915ef932a3-20220731 Copyright (c) 2007-2022 the FFmpeg developers
built with gcc 12.1.0 (crosstool-NG 1.25.0.55_3defb7b)
configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=x86_64-ffbuild-linux-gnu- --arch=x86_64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --enable-libdav1d --enable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-mbedtls --enable-librist --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --enable-libmfx --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --enable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags=-pie --extra-libs='-ldl -lgomp' --extra-version=20220731
libavutil 57. 28.100 / 57. 28.100
libavcodec 59. 37.100 / 59. 37.100
libavformat 59. 27.100 / 59. 27.100
libavdevice 59. 7.100 / 59. 7.100
libavfilter 8. 44.100 / 8. 44.100
libswscale 6. 7.100 / 6. 7.100
libswresample 4. 7.100 / 4. 7.100
libpostproc 56. 6.100 / 56. 6.100
Input #0, rtsp, from 'rtsp://look:S4fopae8@10.3.33.105/axis-media/media.amp':
Metadata:
title : Media Presentation
Duration: N/A, start: 0.040000, bitrate: N/A
Stream #0:0: Video: h264 (Main), yuvj420p(pc, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn Install methodDocker Compose Object DetectorOther Network connectionWired Camera make and modelhikvision Screenshots of the Frigate UI's System metrics pagesAny other information that may be helpfulNo response |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
set
to disable hwaccel |
Beta Was this translation helpful? Give feedback.
set
to disable hwaccel