I am trying to solve two problems, in the same application. I am open to alternatives because I am really not happy with how it is working at the moment.
I need to get live image data from 3-4 cameras to about 30 clients on a WiFi network simultaneously. Originally I planned on doing this by transmitting the JPEG binary data via UDP multicast which works well on a wired network but I was getting to many dropped fragments (and therefore dropped datagrams) over WiFi for it to be useful. I can't use TCP because there would not be enough bandwidth to do that to 30 clients. I started looking into MPEG4 streaming, and therefore FFmpeg. As part of the application I need to do some image manipulation within LabVIEW. My current dataflow is:
Cameras ---IMAQdx-----> LabVIEW -----MJPEG via TCP---- -> MPEG4 stream via UDP (FFmpeg) --------WiFi--------> Client reciever (FFmpeg) -------MJPEG via TCP------> LabView
Next week I am going to revisit trying to just do a MJPEG stream in LabView over UDP becasue what I have described above is currently quite ropey.
Second problem. It is a bit of a bodge, but I need to stream a screen capture of a particular application which is running on the server to all of the tablets. Again I need to do a little bit of manipulation before it goes to the tablets. I don't know of another way of bringing a live screen capture of an individual window into LabVIEW apart from FFmpeg (I know you can use some windows API's for screen capture but FFmpeg still works if the application is behind other windows). Beyond that I have got the same issues with streaming the data and was planning on using FFmpeg.
I was sending the q command so that FFmpeg would close its network connections so that I can reopen them later...may not be necessary so I will test it without.
In summary, my questions are:
- My internal MJPEG stream over TCP to 127.0.0.1 works fine but I am sure there is a neater way if you know of one...I did consider using a file as the middle man but could think of a way of doing this other than writing indiviudal frames to disk as seperate files which I though was just as bad...if not worse from a CPU and disk usage point of view
- As I said previously, sometimes when I try to close the FFMPEG instance, it crashes LabView with no error. I haven't been able to identify a pattern so far.
I am open to other suggestions as far as the overall system is concerned.