Hardware acceleration in 1.9.13
Hello, I have updated to 1.9.13 and it seems like the hardware acceleration was broken but when I reverted to 1.9.12 its working fine. I'm not sure if I'm missing something.
Cameras: Tapo C120 Tapo TC60
compose.yaml
services:
go2rtc:
container_name: go2rtc
image: alexxit/go2rtc:latest
restart: always
user: 1000:1000
group_add:
- 992
devices:
- /dev/dri:/dev/dri
environment:
- TZ=Asia/Kuala_Lumpur
volumes:
- "./config:/config"
go2rtc.yaml
api:
listen: ":1984"
ffmpeg:
bin: "ffmpeg"
log:
format: "color"
level: "trace"
output: "stdout"
time: "UNIXMS"
rtsp:
listen: ":8554"
default_query: "video&audio"
srtp:
listen: ":8443"
webrtc:
listen: ":8555/tcp"
ice_servers:
- urls: [ "stun:stun.l.google.com:19302" ]
filters:
networks: [ udp4, tcp4 ]
streams:
c110_dining: ffmpeg:rtsp://redacted:[email protected]:554/stream1#video=h264#hardware
c110_living: ffmpeg:rtsp://redacted:[email protected]:554/stream1#video=h264#hardware
tc60_kitchen: ffmpeg:rtsp://redacted:[email protected]:554/stream1#video=h264#hardware
error message
streams: exec/rtsp
[hwupload @ 0x7fb5aca79fc0] A hardware device reference is required to upload frames to.
[AVFilterGraph @ 0x7fb5aca8dec0] Error initializing filters
Error opening output file rtsp://127.0.0.1:8554/a3fca7881f128b50708ac0a484e8ffd5.
Error opening output files: Invalid argument
1.9.13 logs
11:23:06.101 TRC [api] GET /api/streams?src=c110_dining&video=all&audio=allµphone 172.18.1.29:42160
11:23:06.101 TRC [streams] check cons=0 media=video, sendonly, ALL
11:23:06.158 DBG [ffmpeg] bin libavformat="62. 3.100" version=8.0.1
11:23:06.268 DBG [exec] run rtsp args=["ffmpeg","-hide_banner","-v","error","-hwaccel","vaapi","-hwaccel_output_format","vaapi","-hwaccel_flags","allow_profile_mismatch","-allowed_media_types","video","-fflags","nobuffer","-flags","low_delay","-timeout","5000000","-user_agent","go2rtc/ffmpeg","-rtsp_flags","prefer_tcp","-i","rtsp://redacted:[email protected]:554/stream1","-c:v","h264_vaapi","-g","50","-bf","0","-profile:v","high","-level:v","4.1","-sei:v","0","-an","-vf","format=vaapi|nv12,hwupload,scale_vaapi=out_color_matrix=bt709:out_range=tv:format=nv12","-user_agent","ffmpeg/go2rtc","-rtsp_transport","tcp","-f","rtsp","rtsp://127.0.0.1:8554/a3fca7881f128b50708ac0a484e8ffd5"]
11:23:06.565 TRC [api] GET /api/streams 172.18.1.29:59314
11:23:07.502 DBG [exec] [hwupload @ 0x7fb5aca79fc0] A hardware device reference is required to upload frames to.
[AVFilterGraph @ 0x7fb5aca8dec0] Error initializing filters
Error opening output file rtsp://127.0.0.1:8554/a3fca7881f128b50708ac0a484e8ffd5.
Error opening output files: Invalid argument
11:23:07.507 TRC [streams] dial cons=0 prod=0 error="exec/rtsp\n[hwupload @ 0x7fb5aca79fc0] A hardware device reference is required to upload frames to.\n[AVFilterGraph @ 0x7fb5aca8dec0] Error initializing filters\nError opening output file rtsp://127.0.0.1:8554/a3fca7881f128b50708ac0a484e8ffd5.\nError opening output files: Invalid argument\n"
11:23:07.507 TRC [streams] check cons=0 media=audio, sendonly, ALL
11:23:07.507 TRC [streams] skip cons=0 prod=0
11:23:07.507 TRC [streams] check cons=0 media=audio, recvonly, ANY
11:23:07.507 TRC [streams] skip cons=0 prod=0
11:23:07.507 TRC [streams] skip stop none producer
1.9.12 logs
11:13:51.929 TRC [api] GET /api/streams?src=c110_dining&video=all&audio=allµphone 172.18.1.29:45156
11:13:51.929 TRC [streams] check cons=0 media=video, sendonly, ALL
11:13:51.971 DBG [ffmpeg] bin libavformat="60. 16.100" version=6.1.2
11:13:52.103 DBG [exec] run rtsp args=["ffmpeg","-hide_banner","-v","error","-hwaccel","vaapi","-hwaccel_output_format","vaapi","-hwaccel_flags","allow_profile_mismatch","-allowed_media_types","video","-fflags","nobuffer","-flags","low_delay","-timeout","5000000","-user_agent","go2rtc/ffmpeg","-rtsp_flags","prefer_tcp","-i","rtsp://redacted:[email protected]:554/stream1","-c:v","h264_vaapi","-g","50","-bf","0","-profile:v","high","-level:v","4.1","-sei:v","0","-an","-vf","format=vaapi|nv12,hwupload,scale_vaapi=out_color_matrix=bt709:out_range=tv:format=nv12","-user_agent","ffmpeg/go2rtc","-rtsp_transport","tcp","-f","rtsp","rtsp://127.0.0.1:8554/a3fca7881f128b50708ac0a484e8ffd5"]
11:13:52.235 TRC [api] GET /api/streams 172.18.1.29:45170
11:13:53.232 TRC [api] GET /api/streams 172.18.1.29:45170
11:13:54.232 TRC [api] GET /api/streams 172.18.1.29:45170
11:13:54.310 TRC [rtsp] server request:
OPTIONS rtsp://127.0.0.1:8554/a3fca7881f128b50708ac0a484e8ffd5 RTSP/1.0
Cseq: 1
User-Agent: ffmpeg/go2rtc
11:13:54.310 TRC [rtsp] server response:
RTSP/1.0 200 OK
Public: OPTIONS, SETUP, TEARDOWN, DESCRIBE, PLAY, PAUSE, ANNOUNCE, RECORD
Cseq: 1
11:13:54.352 TRC [rtsp] server request:
ANNOUNCE rtsp://127.0.0.1:8554/a3fca7881f128b50708ac0a484e8ffd5 RTSP/1.0
Content-Type: application/sdp
Cseq: 2
User-Agent: ffmpeg/go2rtc
Content-Length: 330
v=0
o=- 0 0 IN IP4 127.0.0.1
s=Session streamed by "TP-LINK RTSP Server"
c=IN IP4 127.0.0.1
t=0 0
a=tool:libavformat 60.16.100
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z2QMKawrQBIAUdNQICAfAAADAAEAAAMAMo8IBCo=,aO44sA==; profile-level-id=640C29
a=control:streamid=0
11:13:54.352 TRC [rtsp] server response:
RTSP/1.0 200 OK
Cseq: 2
11:13:54.354 TRC [rtsp] server request:
SETUP rtsp://127.0.0.1:8554/a3fca7881f128b50708ac0a484e8ffd5/streamid=0 RTSP/1.0
Transport: RTP/AVP/TCP;unicast;interleaved=0-1;mode=record
Cseq: 3
User-Agent: ffmpeg/go2rtc
11:13:54.354 TRC [rtsp] server response:
RTSP/1.0 200 OK
Transport: RTP/AVP/TCP;unicast;interleaved=0-1;mode=record
Cseq: 3
Session: 41723327;timeout=60
11:13:54.355 TRC [rtsp] server request:
RECORD rtsp://127.0.0.1:8554/a3fca7881f128b50708ac0a484e8ffd5 RTSP/1.0
Range: npt=0.000-
Cseq: 4
User-Agent: ffmpeg/go2rtc
Session: 41723327
11:13:54.355 TRC [rtsp] server response:
RTSP/1.0 200 OK
Cseq: 4
Session: 41723327
11:13:54.356 DBG [exec] run rtsp launch=2.252031381s
11:13:54.356 TRC [streams] check cons=0 prod=0 media=video, recvonly, H264
11:13:54.356 TRC [streams] match cons=0 <= prod=0
11:13:54.356 TRC [streams] check cons=0 media=audio, sendonly, ALL
11:13:54.356 TRC [streams] check cons=0 prod=0 media=video, recvonly, H264
11:13:54.356 TRC [streams] check cons=0 media=audio, recvonly, ANY
11:13:54.356 TRC [streams] check cons=0 prod=0 media=video, recvonly, H264
Looks like latest alpine container has ffmpeg v8. Something changed in it.
Same problem, hardware acceleration was working before update. "alexxit/go2rtc:latest-hardware" using this image seems to work so it must be a problem with the alpine one.
Same problem, hardware acceleration was working before update. "alexxit/go2rtc:latest-hardware" using this image seems to work so it must be a problem with the alpine one.
![]()
yup, I just realized about the version in the logs based on @AlexxIT reply
1.9.13 - 11:23:06.158 DBG [ffmpeg] bin libavformat="62. 3.100" version=8.0.1
1.9.12 - 11:13:51.971 DBG [ffmpeg] bin libavformat="60. 16.100" version=6.1.2
You can use custom exec command before fix will be applied.
exec:ffmpeg -hide_banner -v error -vaapi_device /dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_flags allow_profile_mismatch -allowed_media_types video -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://redacted:[email protected]:554/stream1 -c:v h264_vaapi -g 50 -bf 0 -profile:v high -level:v 4.1 -sei:v 0 -an -vf format=vaapi|nv12,hwupload,scale_vaapi=out_color_matrix=bt709:out_range=tv:format=nv12 -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}
or
exec:ffmpeg -hide_banner -v error -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_flags allow_profile_mismatch -allowed_media_types video -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://redacted:[email protected]:554/stream1 -c:v h264_vaapi -g 50 -bf 0 -profile:v high -level:v 4.1 -sei:v 0 -an -vf format=vaapi|nv12,scale_vaapi=out_color_matrix=bt709:out_range=tv:format=nv12 -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}
I do NOT like any of these methods.
I think this is a degradation of ffmpeg's functionality. It forces you to specify a device when using the hwupload filter. Previous versions of ffmpeg handled this situation perfectly.
- Not all users may have a default device name.
- Most users don't need the hwupload filter, but some may needs it.
You can use custom exec command before fix will be applied.
exec:ffmpeg -hide_banner -v error -vaapi_device /dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_flags allow_profile_mismatch -allowed_media_types video -fflags nobuffer -flags low_delay -timeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_flags prefer_tcp -i rtsp://redacted:[email protected]:554/stream1 -c:v h264_vaapi -g 50 -bf 0 -profile:v high -level:v 4.1 -sei:v 0 -an -vf format=vaapi|nv12,hwupload,scale_vaapi=out_color_matrix=bt709:out_range=tv:format=nv12 -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp {output}
This is working for both cameras mentioned above, will live with this for now. Thank you for the support 🫡