Create Live Video Streaming App using OpenCV and Socket Programming

For Camera live-streaming app over the network, TCP(Transmission Control Protocol) or IP(Internet Protocol )could be rely upon. This method allows a large piece of information or data let it be in the form of image of burst images forming a video to be transmitted reliably, as it manages how a larger packet being broken into smaller packets to be transmitted and again reassembled in the right order at the the destination without losing the property.

Another known network protocol is UDP (User Datagram Protocol). The use of this protocol is for faster data transmission over a network. However, UDP’s drawback is less reliable compared to TCP/IP as there is always chance of data loss (packet drop).

PRE-REQUISITES
Python 3
OpenCV
Numpy
Webcam
IP webcam(mobile application)

Step :1 In this Task we have used socket programming and cv2 libraries in python :

Socket programming is a way of connecting two end points over network to communicate with each other.
One Socket is a combination of IP and Port no .
IP address is the address of your Local system and and port number is the random value on which your program will run on a particular IP

CV2 module is a cross-platform library using which we can develop real-time computer vision applications. It mainly focuses on image processing, video capture and analysis including features like face detection and object detection. Something to note here is that the encoding and decoding feature in OpenCV being used to further compress the raw image size significantly but still maintaining decent image quality after decompress.

First we have to create a two python programming files one Client.py and another Server.py

Before that please make sure your IP address putting given below ip address won’t work for your local device ,If you don’t you ip address just open CMD(command prompt) and write the high lighted part:

Client.py:

Before running this code let’s us set the server side so that that client can mak end to end connection .

Server.py

Step 2 : Now lets run the code on browser via juypter notebook IDE

client.py

After running put IP address which you want to connect along with the port number

There was a lag in the video because of the low bandwidth on my end

The final Output:

FOR CODE :

linkedin:

https://www.linkedin.com/in/sachin-joshi-755a1a137/

Thank You for Reading! Keep sharing ❤