Page 1 of 1

HW Encoder h264_vaapi not working | ERR Could not send frame....

Posted: Wed Feb 02, 2022 1:34 pm
by LeffiLeftism
Hey there, im totally new to Zoneminder.
I run it in a docker on a unraid machine.

HARDWARE SPECS:
Pentium G4400
8GB DDR4 RAM
ASROCK B150M
about 6 TB Storage

Camera: TP-Link VIGI C300HP-6

In General options form my Monitor i selected:
Source Type: Ffmpeg
Function: Modect
Analysis FPS: 5

In the storage options from my Monitor i selected:
Storage Area: Default
SaveJPEGs: Analysis images only (if available)
Video Writer: Encode
OutputCodec: h264
Encoder: libx264
Optional Envoder Parameters: crf=23 (that's default)
Wheter to store the audio...: True


My CPU actually cant handle the videoencode, or is fully loaded and i cant do anything else on my server. So i decided to buy a cheap GPU with h264 decode/encode support and do the encoding via the gpu.
So i got a "AMD R5 430 OEM" to get the encode job done.

I changed the setting
Encoder: h264_vaapi
so the amd gpu should be used to encode, if i get this right.

When i force alarm via webinterface ZM tries to record something, but in the log it says:
2022-02-02 14:07:36 zmc_m1 1778 ERR Could not send frame (error 'Invalid argument') zm_videostore.cpp 1135

until i end the alarm.
The created videofile is 1kb (far to little for couple of seconds), and cant be replayed via webinterface or the file it self.

I dont know what's wrong there, maybe its a unraid related problem, maybe the GPU isnt compatible, but i dont know that it is or where to look for solution.

Hope somebody got an idea.

Re: HW Encoder h264_vaapi not working | ERR Could not send frame....

Posted: Wed Feb 02, 2022 2:34 pm
by iconnor
Unfortunately each codec takes different parameters. In this case h264_vaapi doesn't support crf=

See:
https://trac.ffmpeg.org/wiki/Hardware/VAAPI

Also, make sure that www-data is in the render group or whatever group has permission to /dev/dri/renderD128

And don't forget to turn on debugging for more info.

Re: HW Encoder h264_vaapi not working | ERR Could not send frame....

Posted: Wed Feb 02, 2022 4:25 pm
by LeffiLeftism
Thanks for the reply.

So can i just delete the optional parameters or is there a minimum / basic parameters wich has to be set?
After activating the debug log their is the information between the errors:
"deprecated pixel format used, make sure you did set range correctly"
can it be, the gpu doesnt support the resolution from the camera or something like this?

On the website you posted are "Full Examples". If i want to use the first one unter "Encode-only" can i copy the example string to the parameters board or do the options have to be in their own line?

What is www-data, where can i check if it has the permission? Is this a Unraid or ZM thing?

Re: HW Encoder h264_vaapi not working | ERR Could not send frame....

Posted: Sun Feb 20, 2022 7:13 pm
by erew
For anyone whom finds this post, I eventually found a solution, which is listed in this other post.

viewtopic.php?t=31539

Thanks

Re: HW Encoder h264_vaapi not working | ERR Could not send frame....

Posted: Sun Feb 20, 2022 8:51 pm
by dougmccrary
www-data is mostly where Apache looks for stuff. ZM puts output there, so your vaapi needs permission to write there too.