Create Live Video Streaming App using OpenCV and Socket Programming

M G GOVARDHAN GOWDA
4 min readSep 6, 2021

For Camera live-streaming app over the network, TCP(Transmission Control Protocol) or IP(Internet Protocol )could be relied upon. This method allows a large piece of information or data let it be in the form of the image of burst images forming a video to be transmitted reliably, as it manages how a larger packet is broken into smaller packets to be transmitted and again reassembled in the right order at 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 the 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 endpoints over the network to communicate with each other.
One Socket is a combination of IP and Port no.
The IP address is the address of your Local system 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 is being used to further compress the raw image size significantly but still maintaining decent image quality after decompress.

First, we have to create 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 your 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:

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

M G GOVARDHAN GOWDA
M G GOVARDHAN GOWDA

Written by M G GOVARDHAN GOWDA

MLOPS internship trainee @LinuxWorld informatics Pvt. LTD. || Student @Dayananda Sagar University |

No responses yet

Write a response