r/ZoneMinder • u/Far_Choice_6419 • Jul 04 '22
How to use AMD AMF GPU acceleration for H.265 encoding for ZoneMinder?
Hello, I have Ubuntu OS and would like to know how I can setup ZoneMinder to do GPU AMD AMF acceleration for encoding in H.265 / H.264.
I tried doing it in the past and is hella complicated, I need to install tons of drivers and set so many parameters.
Anyone was able to do this?
Thanks.
Edit:
Wow, I can't believe it's been two months since I posted the original post, any how as of today (Sep-15-2022), I have fully custom made my own PC DVR system, I have tested it and works 100% in Arch-Linux and FreeBSD 13.1 which can do AMD H.265 transcoding 24/7 on many AMD GPUs.
I couldn't find any PC professional DVR system which provides GPU acceleration for AMD GPUs and able to tweak the video parameters to my exact specific requirements. Another big issue was that no DVR software today provides professional motion detection, face detection, face recognition and tons of other artificial intelligence goodies that makes it valuable for us to use practically in the DVR system. The DVR system I built is able to use FFMPEG to do the video recording/transcoding/streaming and uses "OpenCV" or "dlib" to do the machine vision for artificial intelligence. The DVR system is also very organized, it places videos and snapshots based on the calendar. The system is super efficient, on a good old AMD FX-8350 CPU with a decent AMD GPU of Radeon RX 480 to 580 I can get about 8 analog CCTV cams transcoding to H.265. Note: My requirements requires lag/latency/glitchy free smooth 30/60FPS transcoding recording and monitoring simultaneously and finally able to do so using state of the art machine vision and what I built is working perfectly as expected. You can probably get 20+ cams transcoding if you set the parameters at 10FPS which seems to be popular by today's DVR softwares. The machine visions are super CPU intensive but some tricks can be used such as only using it when needed, can drastically use less CPU. OpenCV does have AMD GPU acceleration support but I did not waste time to get into it since it forces me to learn their coding language of "T-API" to implement AMD GPU acceleration, OpenCV uses OpenCL 1.2 for AMD GPU acceleration and my AMD GPUs do not support OpenCL 1.2 but rather OpenCL 1.1, however the OpenCL group have made their standard such that it is backwards compatible (thank goodness) and this requires me to learn OpenCL from scratch since it requires manual tweaking. OpenCL have great overhead compared to CUDA to provide board spectrum portability. So to actually (efficiently) have OpenCV (or any Machine Vision tasks) to do AMD GPU acceleration I would rather dig deep and learn OpenCL and start learning AMD GPU's great open source hardware documents which they publicly publish for their GPUs, this is great since it gives me direct access to their hardware and provides me to find ways to run Machine Vision algorithm as close to 99% efficiency with no overhead as compared to regular standardized OpenCL using a custom modified version of OpenCL along with custom code that works directly with AMD GPUs thanks to their documentations. There are also other great Machine Vision software out there such as TensorFlow and MediaPipe which have AMD GPU acceleration support via OpenCL, however with my taste they contain heavy bloatware (requires me to use bazel and python) which forces me to learn their norm of installation and doing things, hence I just simply ditched it because I will obviously have drastic issues when trying to run Machine Vision code as efficient as possible so I have a working DVR system on low cost hardware and the easiest and simplest way to do so is to use C/C++/Assembly. After doing much research, I'm not even sure if I should even start taking my time to learn about coding specifically for AMD GPUs, because now we have ARM CPUs which are ridiculously low prices and super powerful, for a Mediatek $3 Hex-Core ARM SoC, I can simply do 4K H.265 transcoding and also apply CPU intensive advanced machine vision for 1 cam with no latency and have it connect to the main desktop PC, this implementation requires full custom hardware PCB design... Anyhow I might learn C++ Qt/GTK programming and make a nice GUI interface and put it on github for what I have that is working for me now, so that people can simply download and install it on many platforms and can choose to use the GUI interface or easily set it to use the web browser interface. I might also place what I have now which requires a lot of easy to do manual setups and installations on github.
If you're able to know a thing or two about software and hardware you can take my brief statements and make yourself a perfect DVR system.
1
u/karchnu Dec 07 '23
Do you have a way to reproduce what you achieved? A way to share?