ivadim / fruitnanny

Raspberry PI based baby monitor
136 stars 57 forks source link

PSEye support (audio works fine) #31

Open mauricioduarte01 opened 4 years ago

mauricioduarte01 commented 4 years ago

Dear @ivadim . Thank you a lot for this initiative. I manage to get it working well using your new docker installation guide using my Pi3 with a PSeye Camera. The microphone is working great but the camera is not being detected by the device. Any hint on how to make all of this working? Thank you in advance. Keep up the good work!

rayrrr commented 4 years ago

Correct me if I'm wrong, @ivadim, but I don't think any of us FruitNanny-ers know the answer to this. The NoIR Raspberry Pi Cam is recommended. There are thousands of webcams under the sun. https://raspberrypi.stackexchange.com/questions/92156 seems to indicate that the PSeye may have stopped working w/RaspPi after a major OS update (this is known to happen with older proprietary/closed devices). See if you can get this all working with an older version of Raspbian, like Wheezy. That's my best advice. Please report back with results!

phardy commented 4 years ago

The short version is that a PSeye won't work with fruitnanny without significant changes.

The gstreamer pipeline that reads data from a camera and passes it to the webrtc gateway is specifically tailored for the Pi camera device, and how it works. If you're familiar with gstreamer and are able to use it to get h264 video from your PSeye, then you can modify the video container gst-launch command to work for your camera.

I'm currently doing a little bit of tinkering in a new branch, to overhaul how the gstreamer bits work, and make it easier to customise the gstreamer pipeline for things like USB cameras. But that's slow going (the baby I was building my fruitnanny system for arrived a lot sooner than expected :D ), and won't be perfect or come close to covering every possible use case. At the end of the day it'll still take some knowledge about how your particular camera works.

mauricioduarte01 commented 4 years ago

Thank you both for the answers! @rayrrr I have other 3 raspies with motion + pseye cameras running streaming video that I use to control my cat without issues. But yeah, I agree with you and @phardy now just confirmed my fears that the PSeye won't work because this method only works with the Pi Camera sadly. I may just go that route and buy the Pi Camera and use it. For one part I am happy that I finally found a solution to this (It's impossible to find much good answers/guide about streaming both audio+video successfully on the Pi) but also a bit sad that running the PSeye or any other USB camera doesn't works yet by this method.

Congratulations @phardy for your baby. My best wishes. Thank you for everything.

ivadim commented 4 years ago

There are two problems with usb cameras on RaspberriPi and fruitnanny or more with WebRTC protocol in general:

  1. Not all of them produce h.264 stream and it may require transcoding which requires significant hardware resources
  2. Even if camera supports h.264 stream it needs to be transferred from usb to CPU and than back to the network. This may produces some load. In opposite to Raspberry Pi camera which doesn't load CPU at all.

As @phardy mentioned you need to change gstreamer pipeline to take the stream from usb device: command: https://github.com/ivadim/fruitnanny/blob/d6b28a2e5cdbaf427eb7311d1224fa776e65159f/docker-compose.yml#L29

should be as easy as changing rpicamsrc to v4l2src (or similar). You may need to install additional dependencies into gstreamer container though...

P.s @phardy Congratulations 👋

mauricioduarte01 commented 4 years ago

Thank you all.. I will see what I can do :)