Hwaccel on RPi 4

I get true when doing

$ curl -X POST http://localhost:8089/hls/hwaccel

but nothing in the logs. Is this expected?

Also there are suggestions to use method PUT instead of POST but I get 404 when doing this.

You need 64 bit OS

So no hw acceleration on 32 bit despite what the admin GUI says?

If the web admin shows it, then it's enabled already. The behavior of the endpoint is expected.

1 Like

I don't see any options fused or hw transcoding when watching in my browser:

ffmpeg-dl

/home/pi/channels-dvr/2021.10.25.1801/ffmpeg-dl
-hide_banner
-nostats
-loglevel warning
-noautoscale
-progress http://127.0.0.1:8089/dvr/files/3348/hls/progress?key=file3348-ip10.168.0.244
-fflags discardcorrupt+genpts
-ss 1313.4533979999806
-copyts
-start_at_zero -probesize 8000000
-i /mnt/sda1/Channels/recordings/TV/KRON 4 News at 7am/KRON 4 News at 7am 2021-11-29-0700.mpg
-enc_time_base -1
-max_muxing_queue_size 4096
-muxdelay 0
-map 0:v:0?
-map 0:a?
-ignore_unknown
-sn
-c:v h264_omx
-g:v 60 -force_key_frames:v source -profile:v high
-filter:v fastdeint=blend,scale_v4l2m2m=-2:min(ih,720)
-zerocopy 0
-b:v 1000k
-minrate 900k
-maxrate 1100k
-bufsize 2000k
-c:a aac
-ac 2
-b:a 96k
-filter:a aresample=async=1
-f hls
-hls_time 0.010000
-hls_list_size 0
-hls_flags temp_file
-start_number 1226
/mnt/sda1/Channels/recordings/Streaming/file3348-ip10.168.0.244-368086717/encoder-1227-2854011112/stream.m3u8

Also:

$ ./ffmpeg-dl -hwaccels
Hardware acceleration methods:
drm

Looks correct to me. It's using h264_omx

The CPU usage is over 100% and playback stutters.
lsof shows only /dev/video18 and /dev/vchiq open by the ffmpeg-dl process

Might be better if you upgrade to prerelease.

If you want the best performance, then I recommend using the Pi image we publish which uses a 64-bit kernel and the latest rpi encoder firmware fixes.

You may be able to improve things with an sudo rpi-update, but there are limits to the performance of the 32-bit h/w encoder.

1 Like

What is the expected CPU usage of the ffmpeg-dl process when transcoding on 64-bit? I can upgrade but would hate to do it for no reason.

I agree! Have been using your Raspberry PI image for almost a month now and it works great. No buffering or stutters. A little complicated to get the boot part working.
Thanks for a great Program.

Like I said first step would be a simple prerelease upgrade, which will probably fix it.

Downloading 2021.11.23.2219 update...

EDIT: Uhmmmm, nope .... Over 100% CPU usage and stuttering ...

$ dmesg|egrep -i 'v4l|video'

[ 19.591897] bcm2835_vc_sm_cma_probe: Videocore shared memory driver
[ 19.642202] videodev: Linux video capture interface: v2.00
[ 19.744940] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
[ 19.752261] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
[ 19.752309] bcm2835-codec bcm2835-codec: Loaded V4L2 decode
[ 19.753309] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video13
[ 19.754762] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video14
[ 19.756546] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video15
[ 19.757016] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video16
[ 19.757343] bcm2835-isp bcm2835-isp: Loaded V4L2 bcm2835-isp
[ 19.766519] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
[ 19.766565] bcm2835-codec bcm2835-codec: Loaded V4L2 encode
[ 19.787810] bcm2835-codec bcm2835-codec: Device registered as /dev/video12
[ 19.787861] bcm2835-codec bcm2835-codec: Loaded V4L2 isp
[ 19.804630] bcm2835-codec bcm2835-codec: Device registered as /dev/video18
[ 19.804677] bcm2835-codec bcm2835-codec: Loaded V4L2 image_fx

$ lsof -n -p $(pidof ffmpeg-dl) | grep dev/v

ffmpeg-dl 7482 pi mem CHR 81,6 246 /dev/video12
ffmpeg-dl 7482 pi 7u CHR 81,6 0t0 246 /dev/video12
ffmpeg-dl 7482 pi 8u CHR 242,0 0t0 133 /dev/vchiq

So it seems the V4L2 encode is not used .....

Here is a difference between stock and channels supplied ffmpeg

$ ./ffmpeg -hwaccels
Hardware acceleration methods:
drm

$ ffmpeg -hwaccels 2>/dev/null
Hardware acceleration methods:
vdpau
vaapi
drm
rpi
rpi

We currently only use V4L2 on 64-bit OS. I've added it to HWE test for 32-bit OS with v2021.11.29.2014

Is there a performance difference when transcoding between 64 bit and 32 bit OS on RPi 4?
The answer to this question would allow me to decide if I should switch to 64 bit.

Yes there is a difference in performance, but I don't recall how much. 100% cpu does not sound normal.

What does the HWE test show in logs now with the latest prerelease?

Same as in the beginning. I think it is too fast to generate anything.

2021/11/29 17:23:29.537975 [HTTP] | 200 | 241.755µs | ::1 | POST "/hls/hwaccel"

Did you update to the correct build?

Version

2021.11.23.2219