Skip to content

Compress and stream live images over UDP protocol with OpenCV and then sends them away using the same method

Notifications You must be signed in to change notification settings

austingreisman/Raspberry-Pi-UDP-Stream-to-PC

 
 

Repository files navigation

UDP Live Image Streaming

This project is inspired by https://www.cs.utexas.edu/~teammco/misc/udp_video/ , where images are grabbed from camera on one machine and transfered to another machine via UDP, resulting in negligible latency.

Parameters such as stream size or quality can be adjusted in config.h before re-compile the program.

Grabbing

The code grabs video stream from a Raspberry Pi that is pushing UDP packets to port 8080 for the machine that you are running this code on.

Encoding

To avoid latency altogether there is no video codec involved during this process. Every frame is individually encoded to jpeg format by OpenCV to drastically reduce the bandwidth consumption.

If passing raw image is preferred, consider changing jpeg to bmp.

Demo

Run the following command to see stream your camera through localhost: (CMake and OpenCV required)

git clone https://github.com/pokeastuff/Raspberry-Pi-UDP-Stream-to-PC.git
cd Raspberry-Pi-UDP-Stream-to-PC/
cmake . && make
./server 10000 &
./client 127.0.0.1 10000

server alternation:
./server PORT TYPE-OF-IMAGE-PROCESSING
./server 10000 0
./server 10000 1

Note

You will need to change the IP of the destination for the UDP stream. At the moment, you will need to re-compile every time the IP changes. So I reccommend making your local IP static on the recieving end.

Acknowledgement and Copyright

This project is built upon various open-sourced libraries, like Practical C++ Sockets and OpenCV 3 ; please refer to their original license accordingly (GPL/BSD). Code of this project is puslished under MIT License.

About

Compress and stream live images over UDP protocol with OpenCV and then sends them away using the same method

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 98.7%
  • Other 1.3%