Open gvillo opened 3 weeks ago
I am having a similar challenge. Long time since I've wanted to smash my computer into the desk.
Trying to convert reolink h265 stream to h264 (primarily for HKSV). I cannot make it work in hardware.
Config
streams:
frontyard:
- rtsp://user:pass@10.22.22.123:554/Preview_01_main
frontyard_h264:
- ffmpeg:frontyard#video=h264/vaapi
Error
[rtsp] error=streams: exec: [hevc @ 0x55eb3e0e3b40] Could not find ref with POC 21 Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0' Error reinitializing filters! Failed to inject frame into filter network: Function not implemented Error while processing the decoded data for stream #0:0 stream=frontyard_h264
Desperate googling led me to try outputting to nv12 in some arg (I am going crosseyed) and I got a similar "failed to decode picture" error.
My hardware is a coffee lake iGPU on Debian bookwork with go2rtc running in a privileged docker (with access to /dev/dri/renderD128)
🆘
v1.9.2 seems to be the most stable version of go2rtc, besides it doesn't fix this issue, I made a workaround using the camera's substream and I was facing another issue with 1.9.4 with ffmpeg:[...]video=copy
with no logs at all (video stops from time to time during the day, camera's substream works ok), v1.9.2 works smoothly without any issues on my side (same cameras, same firmwares, same PoE and WiFi conditions).
Edit: I'll try 1.9.3 and see if I am facing the same issue with the substream #video=copy (or #video=h264#hardware)
Edit 2: 1.9.3 failed in the same way as 1.9.4 after 20 mins, so v1.9.2 ftw!
It's bad idea to use raw ffmpeg params with any transcoding presets. They can be incompatible. You should use exec source and write whole ffmpeg command yourself.
Cool, thanks for that advice, I know you can append anything and you can break stuff, but I am still getting the same error logs without the raw unfortunately. The video=copy
issue that I am mentioning I wasn't appending raw
at all.
Well. video=copy
is another issue. Maybe related to updates v1.9.3 or v1.9.4.
My computer is unshmashed but hours of my life I will never get back have led to what I think is a solution (to my issue, unclear if it's exactly the same as the OPs).
I could use VAAPI to:
But if I tried to transcode hevc to h264 all in hardware (e.g., no hwupload or hwdownload) I would get this error:
Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0'
If I took the hevc file and (re)encoded it to hevc using VAAPI and then transcode it would work. I am still unclear why it won't work outright, but I did find a setting that seems to solve the issue.
-noautoscale
(this is used after the input in the ffmpeg command)
I cranked the loglevel (-v or -loglevel) to 48 and saw this preceding the vague error above.
[graph 0 input from stream 0:0 @ 0x5600bc331080] w:1920 h:1080 pixfmt:vaapi tb:1/90000 fr:49500000/4678801 sar:0/1
[scaler_out_0_0 @ 0x5600bc2c6e00] w:1920 h:1080 flags:'' interl:0
[auto_scale_0 @ 0x5600bc687000] w:iw h:ih flags:'' interl:0
[scaler_out_0_0 @ 0x5600bc2c6e00] auto-inserting filter 'auto_scale_0' between the filter 'Parsed_null_0' and the filter 'scaler_out_0_0'
Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0'
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:0
This helped: [scaler_out_0_0 @ 0x5600bc2c6e00] auto-inserting filter 'auto_scale_0' between the filter 'Parsed_null_0' and the filter 'scaler_out_0_0'
I still have no idea why ffmpeg felt the need to insert this devil filter (auto_scale_0) but this log led me to the deepest depths of the internet where I found the (undocumented?) rarely mentioned config "-noautoscale".
As soon as I threw that in my ffmpeg command it worked. RELIEF.
In the examples below input.mp4 was a hevc filed with video and audio a la:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf59.27.100
Duration: 00:00:52.22, start: 0.000000, bitrate: 2300 kb/s
Stream #0:0[0x1](und): Video: hevc (Main), 1 reference frame (hev1 / 0x31766568), yuv420p(tv, left), 1920x1080 (1920x1088), 2292 kb/s, 10.58 fps, 90k tbr, 90k tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 15 kb/s (default)
Metadata:
handler_name : SoundHandler
vendor_id : [0][0][0][0]
Does NOT work:
ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -i input.mp4 -c:v h264_vaapi output.mp4
Does work:
ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -i input.mp4 -c:v h264_vaapi -noautoscale output.mp4
It's bad idea to use raw ffmpeg params with any transcoding presets. They can be incompatible. You should use exec source and write whole ffmpeg command yourself.
Yes, so, what I wrote above was debugging. The fully formed FFmpeg command was indeed added to go2rtc via exec. (This is all configured in Frigate which manages the go2rtc config, but if I configure directly in go2rtc it's the same outcome.)
For those wondering, here's how the exec looks:
streams:
frontyard:
- rtsp://USER:PASS@10.11.11.123:554/Preview_01_main
frontyard_h264:
- exec:ffmpeg -hide_banner -hwaccel vaapi -hwaccel_output_format vaapi -avoid_negative_ts
make_zero -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -flags
low_delay -timeout 5000000 -rtsp_flags prefer_tcp -i rtsp://127.0.0.1:8554/frontyard
-c:v h264_vaapi -vf scale_vaapi=-2:1080 -noautoscale -profile:v high -level:v
4.1 -b:v 3M -rc_mode QVBR -idr_interval 40 -rtsp_transport tcp -f rtsp {output}
AlexxIT thanks for building go2rtc. It's amazing.
Hi! first I would like to say thank you for this software, it's neat! I spent hours building a great setup for my surveillance system in my home.
Unfortunately I am blocked now and I was wondering if someone can guide me to figure out a solution for this issue that I am having here, I have a Reolink TrackMix WiFi (yes, I know regarding poor RTSP of that brand), running latest firmware (works ok with tinycam pro/VLC using RTSP), WiFi connection is stable and good.
Go2RTC 1.9.4 running in Frigate in a MiniPC Core i5-1350p 32GB, this is the only camera that I am getting the following error:
I was looking at the issues and I couldn't find anything like this. I have other reolink cameras (2 more 4K and they are working ok using HW transcoding).
The workaround was removing
#hardware
, so running CPU works ok for now, I can live with it, but wondering if there is a ffmpeg setting (or might be a bugfix for go2rtc) that mitigates this and be have to use HW transcoding.My config:
It doesn't matter which input I use (with or without ffmpeg, with or without low-latency), it's the same output.
Thanks!!