Is there a way to kill the stream, as opposed to waiting for a timeout?
Posted a solution in another channel using a modified version of PiPup that allows HTTP urls that works well with Frigate’s local API.
Just realised I posted to the wrong thread.
Original post
I’m trying to get this working on a Shield TV. I’ve now managed to get snapshot images working. I can also get online videos working using post.json ( I tried Blue stars video) or using Developer Tools->Services.
I’m still stumped with getting webrtc video working. The pop-up appears but it is blank. The link to the video works in Firefox but not in post.json or in developer tools.
I am using an NGINX reverse proxy and my HA is accessible externally. I did try the port forwarding of UDP ports but that didn’t make any difference.
Found out my issue:
There are different versions of the apk available:
The original apk from Rogro82 - This one didn’t work for me.
The forked version by gmcmicken to support web-javascript - This is the one that fully worked.
The forked version by desertblade to support http/Frigate - This one partially worked for me.
I ditched the idea of using the WebRTC player with my build. Using frigates built in MPJEG streams loads much faster and keeps everything internal on my network.
Info about Frigates MPJEG streams:
Theres a new webrtc project on the horizon that may help with this…
Its not released yet but the beta is working great as a replacement in general. I have a feeling this will help with the pipup streams as well.
Updated PipUP APK to support JavaScript to use with WebRTC. Still supports HTTP requests, so you can do internal calls.
Noticed that after 6 or so popups in short period, Frigate started to return a white video box. Added destroying of the WebView when the popup closes and that has seemed to have fixed the issue.
Tested on FireTV Cube with both MJPEG and WebRTC streams. Still getting delayed loading for local WebRTC streams, so I am sticking with local MJPEG streams.
APK: Releases · desertblade/PiPup · GitHub
Quick Write up on setting it up: https://github.com/desertblade/PiPup/blob/0759b347d7ebbc87464958a11cba644b492b9067/home_assistant.md
Question for you… I’ve found that if a stream contains audio, it will pause some apps on the Shield. I’ve worked around this by stripping the audio before it arrives but is there a possibility to always just mute the streams in this pipup? TBH, I am using the oiginal one you forked still but I am looking to test yours out soon and see how it works.
You may want to look into the go2rtc project. I have instant loading and much more. Its pretty impressive.
This is perfect! I tried to compile the source code with fixes, but I only got success messages from the gradle batch file, but no output.
I had to adopt the Frigate MJPEG streams for my Reolink cameras. I’ve tried every combination I can think of with Go2RTC (Using the RTSP stream, using RTMP, adding as a generic camera to HASS, using the Frigate RTMP restream) but they all do the loading animation for anywhere from 5 to 10 seconds. Considering I only want the pop up for a max of 10 seconds, I end up not seeing anything.
Interestingly, I have no issues with the streams from Hikvision doorbells. I have a couple of KV6113s, and they load the stream within a second. I haven’t added them to Frigate yet, so this just adding them as generic cameras. Not sure if this is an issue with the resolution of the streams or if the Reolinks are just outdated.
Its on my todo to look at go2rtc.
I looked at muting the video in webView. Looks like it will mute the entire system. I am sure there is a workaround, if I get a chance I will do some more research. I am not an Android dev so there is a lot I don’t know.
Could you explain how you acheived stripping the audio? The only way I could strip audio is through the ffmpeg option but this causes a delay to load the stream via webrtc as the process to start ffmpeg and get the stream etc can take around 5-10 seconds so pointless in the end. I’ve also managed to use my own cutom page url to obtain a webrtc stream with the video element already muted but it seems videos will still pause or stop when the pipup shows the webrtc url and starts playing the video…
Any insight to your setup will be appreciated.
I use go2rtc. You can simply strip it there.
@calisro Thats what i’m referring to I’m already using go2rtc but its not possible to get instant video on ffmpeg conversion which seems to be needed to strip audio with just having #video=copy
frontdoor_noaudio:
rtsp://127.0.0.1:8554/frontdoor_sub?video
That will grab only the video from the stream leaving the audio out. No ffmpeg involved.
?video
And then in my automation, I’ll use this url in pipup.
Awesome, Cheers! I must’ve missed that in the docs. didn’t realise there was the special param on their own rtsp loopback.‘?video’
It can be on any rtsp link. Not only loopback. I try to loopback to a single url to the Camera to prevent multiple streams from opening against the camera itself though.
Ahh interesting, I will play around with it now that my videos aren’t stopping. With it being on demand the connections would be minimal then released when the popup closes so should be alright to get rtsp straight from device for my use case.
EDIT: turns out rtsp://DEVICE_IP:DEVICE_PORT/unicast?video doesn’t even work so will stick with the loop back
Your example and help has now allowed me to easily understand how go2rtc disables audio and its simply done in Javascript so I’ve ended up porting my own view and am using RTSPToWeb and no need for extra streams etc. I am currently preferring RTSPToWeb as it’s a bit more stable on my streams but I’m ready to port everything over to go2rtc once it matures a bit as I’m wanting to have the MJPEG conversion also but without the startup delay (This is benificial for Google Hubs)… Thanks again for your quick responses and saving me more frustrations!
NOTE: Also creating my own view has allowed me to also remove the controls from appearing briefly and showing a poster image (camera snapshot) instead of the big play icon while its loading.
That’s not correct. It literally strips the audio stream from the stream itself. It doesn’t do this in javascript.
Buty glad you got something working. For me go2rtc is completely stable and has been for months.
It is correct. I literally just did it
let offer = await webrtc.createOffer({
offerToReceiveAudio:false, # this code right here is what tells the video not to render audio
offerToReceiveVideo:true
});
I mean, I literally did that on a completely different system to go2rtc and has the exact same result…
No need for loopbacks no need for extra connections or streams.
Now if the param ?video happens to strip audio from other sources like mse, hls etc then it might be possible that the audio may be being stripped internally or they just toggle the component not to render audio (I haven’t studied the code so can’t clarify) either way. that code above is literally stripping the audio (choosing not to accept it) which is the same regardless.
It isn’t correct. Just because you disabled the audio stream in javascript doesn’t mean go2rtc strips it in javascript. lol. It literally sends the stream with a blank audio stream. Check you logs in debug.
frontdoor_noaudio:
rtsp://127.0.0.1:8554/frontdoor_sub?video
That will produce a stream without audio. It doesn’t disable it in javascript.
You can literally create a new generic camera pointing to
rtsp://IP:1984/webrtc.html?src=frontdoor_noaudio
and it will not have audio in the stream. and there is no javascript in that flow with rtsp streams and no webpage.