I have >30 wireless clients which I need to stream video to (Specifically 4 video streams totalling about 20-30Mbps).
My original plan was to UDP multicast the streams as individual JPEG frames (MJPEG stream). I am splitting each frame into chunks of 1472 bytes and transmitting them separately to avoid having a fragmented datagram which I would have if I sent the entire frame in one go.
I have also tried using ffMPEG to create a MPEG4 stream.
Both of these plans are currently working to a fashion but not well enough. Basically I am getting too much packet loss for the video to be usable, especially when I have more than one client subscribed to the broadcast.
I am now aware (I wasn't when I came up with this plan) that multicast over WiFi doesn't work very well (Depending upon how the WiFi router implements it, some routers seem to handle it better than others depending upon what settings they make available).
Things I have yet to try
- UDP Unicast/TCP (Although I think I will be struggling on WiFi bandwidth as this will total about 900Mbps (my WiFi router is 802.11ac compliant though which should give me 1300Mbps) This is my next port of call
- I do have another idea which is based around re transmitting each frame and the listeners assembling the frame from the data it recieves. Any gaps because of dropped packets would be filled on the subsequent retransmissions. I don't like this...it sounds like a like a lot of work with questionable likelihood of success.
Does anyone have any other suggestions on what I can do here? Third party streaming software which an API or CLI which I could use or another approach entirely?
I was just wondering firstly, if you have tried anything since you posted your question? My suggestion would be to use a third-party tool which is called in LabVIEW as mentioned in the article: How Do I Stream Video over RSTP in LabVIEW? I would also suggest that you take a look at the example code: VLC scripting in LabVIEW as I believe this might help.
I have already implemented something using ffMPEG (Both VLC and ffMPEG use the libavcodec so they should be comparable)
The more work I have done on it it has become clear that it is less of a problem with my implementation in LabVIEW and more of a networking issue. I have come to this conclusion because I noticed that I see the same performance issues whether I am streaming MJPEG frames using my own server that I have written, MJPEG frames using ffMPEG or MPEG4 using ffMPEG. This is the same even when I use ffMPEG as both the clients and server.
These problems go away slightly when I increase the buffer on my network switch but they come back eventually, I am guessing when the network buffer overflows:
This has led me to two possibilities:
- Something on my wireless network is hogging the WiFi bandwidth and filling up the buffer (I am not convinced because I am only seeing 10Mbps of traffic on the WiFi switch)
- I am getting issues transmitting data to the WiFi interface (slower than gigabit) via a gigabit interface (Computer ethernet). I wonder if the computer is trying to transmit data at gigabit speeds and the WiFi switch is storing the packets in an internal buffer and only sending them out at whatever speed the WiFi is set to in the switch.
Weirdly it works fine with about <10 clients, but any more than that and it falls over. I need to do some more experimentation but haven't had time.
I am open to anyone's thoughts on this (I appreciate there is no longer a clear question, I might have more specific questions when I have done more experimentation)
For anyone who stumbles across this post later:
The more research I have done the more clear it has become that trying to multicast over WiFi is fraught with problems and it is important that you have a switch which give you access to a lot of level WiFi settings. APPROACH WITH CAUTION
I am afraid I don't think I can be much help with a networking issue, but good luck, I hope you can resolve the issue!
If you post your code (not a picture) of what you're doing, I am sure you'll get more responses and perhaps some ideas on what to try or solutions.