Closed a2nt closed 1 year ago
@NickM-27
https://docs.frigate.video/configuration/advanced#custom-ffmpeg-build
Looks like it doesn't work cuz libraries are missing: /usr/lib/btbn-ffmpeg/bin/ffmpeg: error while loading shared libraries: libvpx.so.7: cannot open shared object file: No such file or directory
It requires:
/usr/lib/aarch64-linux-gnu
/lib/aarch64-linux-gnu
You have to use a statically built binary
@a2nt If you figure out building a static ffmpeg with rkmpp please share! I've had that on my todo list for a while now and I think it will be helpful for the efforts getting the RK3588 boards working.
UPD: Built by docker image, runs ok with RKMPP codecs support, ffmpeg version 4.4 (should be less than 5)
@NateMeyer so I wasn't able to build ffmpeg using host machine. It works at armbian, but the resulting binary had missing libs at docker.
I was able to build it using frigate docker image.
git clone https://github.com/FFmpeg/FFmpeg
UPD: since frigate does not support the latest ffmpeg run this, see below why
git checkout release/4.4
and continue
Add to volumes section at docker-compose.yml:
Get into docker image shell: docker exec -it frigate /bin/bash
Install dev libs at the docker image shell:
apt-get update -qq && apt-get -y install autoconf automake build-essential cmake git-core libass-dev libfreetype6-dev libgnutls28-dev libmp3lame-dev libsdl2-dev libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev meson ninja-build pkg-config texinfo wget yasm zlib1g-dev
Install some extra libs:
apt install libvorbis-dev libvpx-dev libx264-dev libaom-dev libdrm-dev libfdk-aac-dev libx265-dev libopus-dev
Install rkmpp libs (binary and dev) from https://repo.rock-chips.com/debian/pool/main/r/rockchip-mpp/
Run configure at /ffmpeg_build inside docker image:
cd /ffmpeg-build/
./configure --enable-static --enable-version3 --enable-libdrm --enable-libx265 --enable-nonfree --enable-hardcoded-tables --enable-gpl --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-rkmpp --disable-shared
make
make install
Currently my make is still processing, will send u an update latter.
UPD: build is succesful But to get new ffmpeg running you need to install some libs each time you run docker image. (Solved)
A little hacky way:
dpkg -i /ffmpeg-build/rockchip-mpp_1.4.0-5_arm64.deb
apt update && apt install libfdk-aac2
Save installed libs to host from docker image shell:
cp /usr/lib/aarch64-linux-gnu/librockchip_mpp.so.* /ffmpeg-build
cp /usr/lib/aarch64-linux-gnu/libfdk-aac.so.* /ffmpeg-build
Stop docker container Setup docker-compose.yml volumes:
- /root/FFmpeg/ffmpeg:/usr/bin/ffmpeg
- /root/FFmpeg/ffprobe:/usr/bin/ffprobe
- /root/FFmpeg:/ffmpeg-build
- /root/FFmpeg/librockchip_mpp.so.0:/usr/lib/aarch64-linux-gnu/librockchip_mpp.so.0
- /root/FFmpeg/librockchip_mpp.so.1:/usr/lib/aarch64-linux-gnu/librockchip_mpp.so.1
- /root/FFmpeg/libfdk-aac.so.2:/usr/lib/aarch64-linux-gnu/libfdk-aac.so.2
- /root/FFmpeg/libfdk-aac.so.2.0.2:/usr/lib/aarch64-linux-gnu/libfdk-aac.so.2.0.2
UPD2: the latest ffmpeg is running and RKMPP codecs supported, but looks like frigate doesn't works with the latest ffmpeg
Unrecognized option 'stimeout'.
The -stimeout option for rtsp has been renamed to -timeout in ffmpeg 5.0. This can be verified by comparing the rtsp section of the documentation to an older version.
That's why I have switched to ffmpeg v4.4 above.
Check ffmpeg RKMPP support by running
docker exec -it frigate /bin/bash
ffmpeg -decoders | grep rkmpp
The result should look like:
ffmpeg version n4.4.4-6-gd5fa6e3a91 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 10 (Debian 10.2.1-6)
configuration: --enable-static --enable-version3 --enable-libdrm --enable-libx265 --enable-nonfree --enable-hardcoded-tables --enable-gpl --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-rkmpp --disable-shared
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
V..... h264_rkmpp h264 (rkmpp) (codec h264)
V..... hevc_rkmpp hevc (rkmpp) (codec hevc)
V..... vp8_rkmpp vp8 (rkmpp) (codec vp8)
V..... vp9_rkmpp vp9 (rkmpp) (codec vp9)
https://github.com/jjm2473/ffmpeg-rk has more supported codecs But requires librga from https://repo.rock-chips.com/debian/pool/main/libr/librga/
Same installation method as above + extra lib
root@127:/ffmpeg-build# ./ffmpeg -decoders | grep rkmpp
ffmpeg version n4.3-dev-7616-gd306ef36a2 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10 (Debian 10.2.1-6)
configuration: --enable-static --enable-version3 --enable-libdrm --enable-libx265 --enable-nonfree --enable-hardcoded-tables --enable-gpl --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-rkmpp --disable-shared
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
V..... h263_rkmpp h263 (rkmpp) (codec h263)
V..... h264_rkmpp h264 (rkmpp) (codec h264)
V..... hevc_rkmpp hevc (rkmpp) (codec hevc)
V..... mpeg1_rkmpp mpeg1 (rkmpp) (codec mpeg1video)
V..... mpeg2_rkmpp mpeg2 (rkmpp) (codec mpeg2video)
V..... mpeg4_rkmpp mpeg4 (rkmpp) (codec mpeg4)
V..... vp8_rkmpp vp8 (rkmpp) (codec vp8)
V..... vp9_rkmpp vp9 (rkmpp) (codec vp9)
Getting following error logs, can you help?
2023-06-26 13:31:16.813376366 [2023-06-26 13:31:16] frigate.record ERROR : Error occurred when attempting to maintain recording cache
2023-06-26 13:31:16.813773902 [2023-06-26 13:31:16] frigate.record ERROR : could not convert string to float: 'Rga built version:1.04 10bbe03+2021-01-20 00:44:50\n10.244000'
So I have found the best fork of ffmpeg for RKMPP https://github.com/hbiyik/FFmpeg
There's 4. branch and 5. branch, I have used 4.* for docker
It doesn't use librga, but libyuv is required. Also I had to compile mpp https://github.com/rockchip-linux/mpp cuz 1.4.* versions of mpp libs doesn't support this fork
root@127:/opt/frigate# ffmpeg -decoders | grep rkmpp
ffmpeg version 6b47e74766 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 10 (Debian 10.2.1-6)
configuration: --enable-static --enable-version3 --enable-libdrm --enable-libx265 --enable-nonfree --enable-gpl --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-rkmpp --enable-libwebp --disable-shared --enable-libaom
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
V..... av1_rkmpp av1 (rkmpp) (codec av1)
V..... h263_rkmpp h263 (rkmpp) (codec h263)
V..... h264_rkmpp h264 (rkmpp) (codec h264)
V..... hevc_rkmpp hevc (rkmpp) (codec hevc)
V..... mpeg1_rkmpp mpeg1 (rkmpp) (codec mpeg1video)
V..... mpeg2_rkmpp mpeg2 (rkmpp) (codec mpeg2video)
V..... mpeg4_rkmpp mpeg4 (rkmpp) (codec mpeg4)
V..... vp8_rkmpp vp8 (rkmpp) (codec vp8)
V..... vp9_rkmpp vp9 (rkmpp) (codec vp9)
Works perfect with, no errors at logs:
# Optional: ffmpeg configuration
ffmpeg:
hwaccel_args: -hwaccel drm -hwaccel_device /dev/dri/renderD128 -c:v h264_rkmpp -vcodec h264_rkmpp
output_args:
detect: -f rawvideo
record: -c:a aac -c:v copy -map 0 -f segment -strftime 1 -segment_time 60 -segment_format mp4 -reset_timestamps 1
rtmp: -c copy -f flv -flvflags no_duration_filesize
@a2nt nice work, can you share you docker image or Dockerfile?
@a2nt nice work, can you share you docker image or Dockerfile?
nope, but if u will tell me how to do it I will. I have docker-compose with a lot of linked files:
version: "3.9"
services:
frigate:
container_name: frigate
hostname: 127.0.0.1
#network_mode: host
privileged: true
restart: unless-stopped
image: ghcr.io/blakeblackshear/frigate:dev-ef14a43 #stable
group_add:
- "106" # render
- "44" # video
- "46" # plugdev
shm_size: "300mb" # 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/dri/renderD128:/dev/dri/renderD128 # for intel hwaccel, needs to be updated for your hardware
- /dev/dri/card0:/dev/dri/card0
- /dev/rga
- /dev/video-dec0:/dev/video-dec0
- /dev/video-enc0:/dev/video-enc0
volumes:
- /etc/localtime:/etc/localtime:ro
- /srv/docker/frigate/config.yml:/config/config.yml
- /mnt/storage/frigate:/media/frigate
- /root/host/FFmpeg:/ffmpeg-build
- /root/ffmpeg-rk/libfdk-aac.so.2:/usr/lib/aarch64-linux-gnu/libfdk-aac.so.2
- /root/ffmpeg-rk/libfdk-aac.so.2.0.2:/usr/lib/aarch64-linux-gnu/libfdk-aac.so.2.0.2
- /root/ffmpeg-rk/librga.so:/usr/lib/aarch64-linux-gnu/librga.so
- /root/ffmpeg-rk/librga.so.2:/usr/lib/aarch64-linux-gnu/librga.so.2
- /root/ffmpeg-rk/librga.so.2.0.0:/usr/lib/aarch64-linux-gnu/librga.so.2.0.0
- /root/host/FFmpeg/ffmpeg:/usr/bin/ffmpeg
- /root/host/FFmpeg/ffprobe:/usr/bin/ffprobe
- /root/host/FFmpeg/ffplay:/usr/bin/ffplay
- /root/host/FFmpeg:/usr/lib/btbn-ffmpeg
- /root/host/FFmpeg/librockchip_mpp.so:/usr/lib/aarch64-linux-gnu/librockchip_mpp.so
- /root/host/FFmpeg/librockchip_mpp.so.0:/usr/lib/aarch64-linux-gnu/librockchip_mpp.so.0
- /root/host/FFmpeg/librockchip_mpp.so.1:/usr/lib/aarch64-linux-gnu/librockchip_mpp.so.1
- /root/host/FFmpeg/librockchip_vpu.so:/usr/lib/aarch64-linux-gnu/librockchip_vpu.so
- /root/host/FFmpeg/librockchip_vpu.so.0:/usr/lib/aarch64-linux-gnu/librockchip_vpu.so.0
- /root/host/FFmpeg/librockchip_vpu.so.1:/usr/lib/aarch64-linux-gnu/librockchip_vpu.so.1
- /root/host/FFmpeg/libyuv.so:/usr/lib/aarch64-linux-gnu/libyuv.so
- /root/host/FFmpeg/libyuv.so.0:/usr/lib/aarch64-linux-gnu/libyuv.so.0
- /root/host/FFmpeg/libyuv.so.0.0.1873:/usr/lib/aarch64-linux-gnu/libyuv.so.0.0.1873
- /root/host/FFmpeg/rockchip_vpu.pc:/usr/lib/aarch64-linux-gnu/pkgconfig/rockchip_vpu.pc
- /root/host/FFmpeg/rockchip_mpp.pc:/usr/local/lib/aarch64-linux-gnu/pkgconfig/rockchip_mpp.pc
- /root/host/FFmpeg/rockchip:/usr/local/include/rockchip
- /root/frigate/frigate/detectors/plugins/armnn_tfl.py:/opt/frigate/frigate/detectors/plugins/armnn_tfl.py
- /usr/lib/aarch64-linux-gnu/libarmnn.so.32:/usr/lib/aarch64-linux-gnu/libarmnn.so.32
- /usr/lib/aarch64-linux-gnu/libarmnnTfLiteParser.so:/usr/lib/aarch64-linux-gnu/libarmnnTfLiteParser.so
- /usr/lib/aarch64-linux-gnu/libarmnnTfLiteParser.so.24.6:/usr/lib/aarch64-linux-gnu/libarmnnTfLiteParser.so.24.6
- /usr/lib/aarch64-linux-gnu/libarmnnTfLiteParser.so.24:/usr/lib/aarch64-linux-gnu/libarmnnTfLiteParser.so.24
- /usr/lib/aarch64-linux-gnu/libarmnnTfLiteParser.so.22:/usr/lib/aarch64-linux-gnu/libarmnnTfLiteParser.so.22
- /usr/lib/aarch64-linux-gnu/include/armnnTfLiteParser:/usr/lib/aarch64-linux-gnu/include/armnnTfLiteParser
- /usr/lib/aarch64-linux-gnu/libarmnnTfLiteParser.so.22.0:/usr/lib/aarch64-linux-gnu/libarmnnTfLiteParser.so.22.0
- /usr/lib/aarch64-linux-gnu/libOpenCL.so:/usr/lib/aarch64-linux-gnu/libOpenCL.so
- /usr/lib/aarch64-linux-gnu/libmali-x11:/usr/lib/aarch64-linux-gnu/libmali-x11
- /usr/lib/aarch64-linux-gnu/pkgconfig/OpenCL.pc:/usr/lib/aarch64-linux-gnu/pkgconfig/OpenCL.pc
- /etc/OpenCL/vendors/mali-arm64.icd:/etc/OpenCL/vendors/mali-arm64.icd
- /usr/lib/aarch64-linux-gnu/armnn22:/usr/lib/aarch64-linux-gnu/armnn22
- /usr/lib/aarch64-linux-gnu/armnn32:/usr/lib/aarch64-linux-gnu/armnn32
- /usr/lib/python3/dist-packages/pyarmnn:/usr/lib/python3/dist-packages/pyarmnn
- /usr/lib/ArmNN-linux-aarch64:/usr/lib/ArmNN-linux-aarch64
- /usr/lib/aarch64-linux-gnu/libarm_compute.so.31:/usr/lib/aarch64-linux-gnu/libarm_compute.so.31
- /usr/lib/aarch64-linux-gnu/libarm_compute_core.so.31:/usr/lib/aarch64-linux-gnu/libarm_compute_core.so.31
- /usr/lib/aarch64-linux-gnu/libarm_compute_graph.so.31:/usr/lib/aarch64-linux-gnu/libarm_compute_graph.so.31
- /usr/lib/aarch64-linux-gnu/libarmnnAclCommon.so.32:/usr/lib/aarch64-linux-gnu/libarmnnAclCommon.so.32
- /usr/lib/aarch64-linux-gnu/libarmnnDeserializer.so.32:/usr/lib/aarch64-linux-gnu/libarmnnDeserializer.so.32
- /usr/lib/aarch64-linux-gnu/libarmnnSerializer.so.32:/usr/lib/aarch64-linux-gnu/libarmnnSerializer.so.32
- /srv/docker/frigate/armnn-23.05:/build/armnn-ZUc8OU/armnn-23.05
- /usr/lib/aarch64-linux-gnu/libmali-x11/libmali-valhall-g610-g13p0-x11-wayland-gbm.so:/usr/lib/aarch64-linux-gnu/libmali.so
- type: tmpfs # Optional: 1GB of memory, reduces SSD/SD Card wear
target: /tmp/cache
tmpfs:
size: 1000000000
ports:
- "5000:5000" # HTTP
environment:
FFMPEG_RKMPP_PIXFMT: "YUV420P"
extra_hosts:
- "192.168.88.2:192.168.88.2"
Describe the problem you are having
Is it possible to use custom build of ffmpeg? I need rkmp codecs for Orange Pi 5 board
I have compiled ffmpeg for my architecture:
But frigate docker image ffmpeg doesn't support rkmpp
Version
0.12.0-DA3E197
Frigate config file
docker-compose file or Docker CLI command
Relevant log output
FFprobe output from your camera
Operating system
Other Linux
Install method
Docker Compose
Network connection
Wired
Camera make and model
Misecu
Any other information that may be helpful
host: Linux Armbian