I am trying to stream live video from a Pi to multiple devices. Since the Pi is connected to a WiFi with very bad signal, I would like it to only stream to one device (proxy-server). This device should then distribute the stream to other devices.
I tried to write my own python scripts to achieve this. The server just reads the data from a socket and distributes it to multiple connected client sockets. The clients read the data from their sockets and write it to a subprocess pipe, like in this tutorial: https://picamera.readthedocs.io/en/release-1.13/recipes1.html#recording-to-a-network-stream
Although this solution works, it comes with various restrictions for me:
- The solution does not seem to work with VLC. Every view seconds the VLC starts to buffer. After Buffering it plays the video again for some seconds before buffering again. I think that the VLC somehow plays the video faster than it is recorded. Maybe someone has a solution to fix this?
- The solution works perfectly with MPlayer. Unfortunately, MPlayer does not seem to work on newer Raspian distributions (it has problems with some codec library). I planned one of the clients to be raspberry, so this does not work. In Addition, MPlayer is old and not supported anymore as far as I know.
- The solution does not work with MPV (which seems to be the successor of MPlayer. When I call player.stdin.write(data) for MPV I always get a broken pipe exception (Maybe the player does not support this? ).
Sorry if my problem seems really simple. I am new to writing code for streams (network streams, file streams and the input stream of the player).
I really appreciate any ideas for my streaming problem or maybe someone can help me fix the problem in VLC or MPV, which would also solve the situation for me.
Another solution could be a VLC RTSP stream, but I could not work out a way to forward it on a server.
Thanks in advance!