-
-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webcam stream (as option) #223
Comments
Seems like UV4L offers amazing streaming with low CPU usage and Pi cameras 👍 |
The low cpu is due to low quality streaming. Both is motion JPEG And that is only supported in Firefox and Chrome. I think Safari can't handle it. So on iPhone it does not work well.. Also, the bitrate will be very high, and works well on a LAN. But going over the internet, you need a rather steady and fast upload speed. So there is H264 and H265. H265 is not mature enough, so that is out of the picture. H264 is currently industry standard. But converting a stream to H264 cost a lot of CPU power. The Pi is able to do it... but will eat all CPU cores. So that is not an option. I found a solution to use the Pi GPU for H264 encoding. You can mannully compile FFMPEG with --enable-mmal --enable-omx --enable-omx-rpi and then you can use the hardware encoder of the Pi. Which works pretty well. I have a Wifi webcam in a (birdhouse)[https://vogelhuisje.theyosh.nl/]. It is producing a multibitrate HLS stream. This takes about 1 CPU due to ffmpeg keyframe alignment and creating HLS chunks. But compiling ffmpeg takes about 1.5 hours. So not an option for normal users. So it is a bit more complicated. And I do know, as my job is video transcoding and streaming for a company. So I have more then 10+ years experience in video encoding. So, it is not that easy. Also both uv4l and mjpeg streamer have there own webserver and different ports that also needs to be forwarded. And currently, I tile the webcam images for zooming like Google Maps. That is not possible with a live stream. And therefore the webcam controls should be changed... What I can support is this: https://medium.com/@jaredtoddpetersen/home-security-live-streaming-with-raspberry-pi-f9293efca7ba This will produce the same type of stream as my birdhouse. And that can be added as a webcam so that you have a livestream in my interface. But this will also need some more linux experience in compiling the software you selfs. |
Ah, all browsers support motion jpeg now a days |
Thanks for the explanations, really helps me understand. Keeping it light, with as little extra bloat as possible would be the best solution, I'm streaming now at 1296x972 @ 30FPS in H264 on my Pi 3 and it's not using much CPU at all... I'm not bad with Linux, but it would be awesome to have an option built in to activate streaming... the last link you posted sounds interested, fairly lightweight and compatible... |
How are you currently watching? Using vlc? Or using the WebRTC option? |
Right now I'm using http://raspberrypi:8080/stream/video.h264 |
that does not work in a browser right? That is playing in VLC? |
Works in a browser ;-) I'm using UV4L... |
Ok... cool... but I think I will try another way. I am currently compiling ffmpeg manually with the right codecs. And will test if that will produce HLS. That can be added to my software then... But this will take some time to develop. And it will involve some manual work ;) |
And with an usb audio device and a mic you should be able to hear them also! |
Hearing them would be very cool :-) I'd like to add another camera in addition to the Pi V1 camera I use, any suggestions? |
Following: https://github.com/jaredpetersen/raspi-live#ffmpeg (so, manually compile ffmpeg) created a ffmpeg with HLs support and H264 hardware. Now testing full Hd from the rpi cam to hls. cpu load 1% of 1 core :) This looks promising.. running:
watch url: http://pi:8080/static/hls/stream.m3u8 (vlc or safari/iphone) Will add a hls player to the webcam part. This has only a 3 seconds delay :D |
Nice! 👍 |
How did you get on, I'd like to try your stream method and check out utilisation.... |
Ok, turns out... it is pretty easy to have a live stream now... Here we go!
And that should give you a live webcam in the webcam sections. It is currently missing all zoom controls. Also archiving and rotation is not yet working. And it is still alpha. But I got it working with 1.0% CPU usage :) |
Testing now... :) |
Okay, got the live stream... 2 issues I can see here:
For some reason changing the resolution has no effect, currently it's cropped their heads off... Thanks for getting this working though, superb! Edit: noticed you said rotation wasn't working yet, whoops. |
Yeah, that should be possible. But somehow my camera just stopped working ... :( And it is getting late here.. so tomorrow is another day. |
Ok, found the issue... it is getting late so stupid errors... |
Only the FPS is currently locked at 30 fps.... |
At this rate, my ducks will be getting more sleep than us :-) I'll give it a test now and report back, get some sleep! :-) |
To confirm, do I just do a pull, and then restart? |
Hmmm, not working here, it now only plays for 5 seconds when I go to webcam (seems to be the same clip), no rotation or resolution change either? |
Just wait... do a new pull now. Just made an error.. |
Did a pull, rotation / resolution still not playing here dude - sorry :-( |
hmmm... crap.. I have it working at the moment. Sorry for now... tomorrow I will try again |
Hang on, one final cache clear and reboot of the app, and it's working! Good work. |
@theyosh I'm on it... wish me luck ;-) |
@theyosh Up and running will configure now and test (btw you have some default wemo plugs in switches), any idea when you'll try and take a first shot at HLS? EDIT: They are my Wemo's, I'm dumb. Can I avoid them being added? |
@Swiftnesses HLS is already working... maybe clear browser cache? |
Else just add the full HLS url as source for the webcam. Other settings like resolution will be ignored |
No luck with HLS, even tried this test stream: http://www.streambox.fr/playlists/test_001/stream.m3u8 The error is HLS:4 Edit: restarted and it's working, super! |
It seems to stop after some time with errors like: 2018-12-17 19:50:47,451 - WARNING - terrariumEngine - Webcam update(s) took to much time. Needed 38.20912 seconds which is 8.20912 more then the limit 30 The link above is a good test... Edit: Holy s*** the archive has taken 32GB, couldn't even restart the app, connected via SSH and wiped the webcam folders on both my stable and dev release! |
Streaming seems to fill the SD card ultra fast, even with archive etc off the webcam folder fills FAST... Also seems to save about 8 seconds of the stream and then stop, retrying just plays the same clip over and over again... |
I guess you're using clappr, I tried adding a RTSP link of one of my Ubiquiti cameras for fun hoping it also worked, locked out, luckily I wiped it from the settings.cfg and it allowed me back in :-D |
It is not made to stream multibitrate FULLHD TV channels. Use proper source like a webcam at 1Mpbs. Without actually errors, I can't help... so development branch is at own risk... |
RTSP is NOT supported |
Come on, who doesn't want to watch Full HD movies while watching our pets? 👍 Joking aside, it seems to be working okay, the only issue is the flakey feed from the camera I put inside the duck coop, will need to rethink the placement. |
@Swiftnesses Is the new development version working well for you? If so, we are close to a new release. |
Hey @theyosh... development branch seems to be working for me, setup and working fine (or at least as far as I can see!). |
BTW, I'm using the websockets to update my smart home and trigger actions - it's now all fully automated! |
As a note, it would be nice long term if you can add some webcam controls, I struggle a little with contrast during the night, manually adjusting this offers improvements but it would be good from the UI. I use DRC and adjust the white balance normally... |
@theyosh the only bug I found is trying to save a RAW photo and view it gives me a 404. |
Would you be willing to explain to me how you set up web sockets? I am so lost. |
Euh, I would like to close this issue. So maybe you should exchange email addresses somehow? So you can discuss the websockets option? |
For now, I am closing this issue, as live streaming is now possible. |
Hey @theyosh,
Loving this controller, mega work my friend - thank you.
I'm currently using MJPG Streamer (available here on Github) to stream my Duck COOP webcam, rather than use static images. On my Pi 3 (A+ with only 512MB RAM), I can stream and use the controller while only using around 15% CPU (which is amazing tbh!). I doubt this is even an effective method of streaming - likely modern browsers support much better alternatives (H264/265?).
I'd love to have the stream inside Terrarium Pi rather than running via another application. Could you please add streaming as an option, given the low CPU utilisation, it seems a real possibility which would hugely improve the options available to people wanting live updates (I need them, as there's a small chance a Duck could get caught in the door, sure this applies to reptiles too?).
Many thanks,
Mark
The text was updated successfully, but these errors were encountered: