homebridge-camera-rpi icon indicating copy to clipboard operation
homebridge-camera-rpi copied to clipboard

Multiple video device support

Open milmber opened this issue 5 years ago • 5 comments

Support for multiple people to view streams using v4l2loopback

Iterate over multiple video devices if the first device is not available.

E.g. Try /dev/video1, if busy try /dev/video2, if busy try /dev/video3, etc.

This may be possible by adding the video device in use for streaming in the ongoingSessions array ? https://github.com/moritzmhmk/homebridge-camera-rpi/blob/4474cf5485ae43d98d3fdc6a406b7a0857ba9aad/CameraSource.js#L193

milmber avatar Mar 10 '19 19:03 milmber

Great idea! Did you have any success so far?

moritzmhmk avatar Apr 05 '19 20:04 moritzmhmk

Great idea! Did you have any success so far?

Struggling to find a way to detect if a video device is already in use. Any ideas?

milmber avatar Jun 26 '19 08:06 milmber

as noted in #50 I do consider to aim for optimal Pi zero support from now on. The reason is that using h264_omx seems to be the better solution on newer Pis.

While with h264_omx one would redirect the raw stream to multiple video device endpoints we would need to redirect the h264 stream from the camera. This would require setting the resolution and for all clients to receive that same resolution (e.g. 720p).

Keeping track of the used video devices could be done with another array that just holds a boolean value and is set when stream starts/stops on a specific device. If you take a look at the develop branch on wich I did some refactoring you will see that there now is a separate StreamDelegate object which could be assigned a specific video device and make tracking them unnecessary.

moritzmhmk avatar Jun 26 '19 11:06 moritzmhmk

This would require setting the resolution and for all clients to receive that same resolution (e.g. 720p).

What is prohibiting us running this multiplied stream through ffmpeg with corresponding parameters to resize the stream to match every device's requirements?

jankais3r avatar Aug 01 '19 11:08 jankais3r

Check https://github.com/moritzmhmk/homebridge-camera-rpi/tree/feature-loopback for a possible solution.

Resizing each stream would cause a lot of cpu usage... might still work on a pi model 3

moritzmhmk avatar Aug 01 '19 12:08 moritzmhmk