Open puterboy opened 3 weeks ago
That means the stream from the camera didn't start in 3 seconds.
Ahhh -- that is consistent with the delay behavior I am seeing, though might be helpful to make the WRN message more self-explanatory.
Also, any ideas why the USB webcam takes so long to start? Is there anything I can do to reduce the delay or is this a "camera" issue? (note my RPi5 is lightly loaded so it shouldn't be a CPU issue)
I did some more investigating of the init id=XXXXXX
warning.
It seems like the camera delay is causing Octoprint-Obico to fail to load the camera. Octoprint log shows the following error message generated by ffmpeg FFMPEG command (called from python)
ffmpeg -loglevel error -re -i http://192.168.1.048:1984/api/stream.m3u8?src=usbcam_h264&mp4 -filter:v fps=15 -b:v 944438 -pix_fmt yuv420p -s 640x360 -c:v libx264 -an -f rtp rtp://127.0.0.1:17735?pkt_size=1300
FFMPEG STDERR:
[hls @ 0xb0bea90] Error when loading first segment 'http://192.168.1.048:1984/api/hls/segment.m4s?id=z5TYEApf&n=0'
[in#0 @ 0xb0be830] Error opening input: Server returned 404 Not Found
Error opening input file http://192.168.1.048:1984/api/stream.m3u8?src=usbcam_h264&mp4.
Error opening input files: Server returned 404 Not Found
In turn, the ffmpeg
process terminates with exit code 8.
If the issue is due to camera not starting in 3 seconds, is there a way to set a longer delay?
Or is there an option to ffmpeg
to tell it to be patient and not fail?
Note the elongated delay may be because it seems like this camera needs to launch a "helper" ffmpeg process spawned by go2rtc.
ffmpeg -hide_banner -v error -f v4l2 -input_format yuyv422 -video_size 1280x720 -i /dev/v4l/by-id/usb-9734-20210906_HD_Camera-video-index0 -c:v libx264 -g 50 -profile:v high -level:v 4.1 -preset:v superfast -tune:v zerolatency -pix_fmt:v yuv420p -an -user_agent ffmpeg/go2rtc -rtsp_transport tcp -f rtsp rtsp://127.0.0.1:8554/ceeeb28d257d2f320d221087a05b29c4
So, is there a way to tell ffmpeg to be patient and wait before terminating...
I don't know any reason for using HLS as FFmpeg input. It's not real time format
Unfortunately, my understanding is that the only h264 that Octoprint works well with is HLS. WebRTC doesn't work well yet and not aware of any other h264 streaming that does.
Your tests wrong. HLS just can't be only working format.
I WISH you were right!
Webrtc is "experimental" in Octoprint and doesn't work with many streamers.
I tried the link go2rtc
offers and it fails to work.
I tried all the following variations on the link url:
mypi:1984/stream.html?src=picam_h264&mode=webrtc
webrtc://mypi:1984/stream.html?src=picam_h264&mode=webrtc
http://mypi:1984/stream.html?src=picam_h264&mode=webrtc
None of them worked and I was told to try hls
I am happy to try anything...
All this links wrong. I don't know where you get them.
I got the links from the 'links' page on YOUR app:
http://mypi:1984/links.html?src=picam_h264
The link it gives for webrtc is
[stream.html](http://mypi:1984/stream.html?src=picam_h264&mode=webrtc) WebRTC stream / browsers: all / codecs: H264, PCMU, PCMA, OPUS / +H265 in Safari
I tried it as above as well as without the http://
prefix and as well as with a webrtc:
prefix.
Nothing worked in Octoprint -- though it worked fine when typed into my browser so links themselves seem good.
Am I doing something stupid?
.html
links only for browser
Ahhhh... Well, I now tried all the below but STILL doesn't work in Octoprint (though works in my browser as well as mplayer app)
http://mypi:1984/api/stream.mp4?src=picam_h264&mp4=flac
http://mypi:1984/api/stream.mp4?src=picam_h264&mp4
http://mypi:1984/api/stream.mp4?src=picam_h264
Also tried with 'http' replaced with 'webrtc' but didn't help.
Would really love to get go2rtc work with Octoprint with Webrtc but it just doesn't seem to work. I really think go2rtc should be the DEFAULT streamer for Octopi/Octoprint if it can work since it seems so otherwise clean...
I have never seen Octoprint. And don't know how to help you.
I understand. Thanks for your help. BTW, Octoprint is the goto interface app for 3D-printing and as such is very popular.
I wish I could encourage use of your AWESOME streamer with Octoprint but if I can't get it working, I will need to try another streamer.
I am using a IMC Networks XHC Camera 720p USB 3.9mm endoscope cam. My
go2rtc.yaml
looks like this:Everything works except that I get following warning messages on the console:
The messages seem to occur often (but not always) when the stream is started or refreshed. I also notice that this stream seems to take longer to start than my PiCamera v3 stream.
Any idea what is causing this warning and what to do about it?