Giter Site home page Giter Site logo

video-streaming-server-and-client's Introduction

Video-Stream-with-RTSP-and-RTP How to:

Example:

Open a terminal:
    python Server.py 1025

Open another terminal:
    python ClientLauncher.py 127.0.0.1 1025 5008 video.mjpeg

Start the server with the command line

	python Server.py server_port

Where server_port is the port your server listens to for incoming RTSP connections
    # 1025
	# Standard RTSP port is 554 
	# But need to choose a #port > 1024

Open a new terminal

Start the client with the command line
	
	python ClientLauncher.py server_host server_port RTP_port video_file

Where 
	# server_host : the name of the machine where server is running (here "127.0.0.1")
        Use command line
            hostname
        to get the hostname(IP address,human readable hostname may not work)
	# server_port : port the server is listening on (here "1025")
	# RTP_port : port where the RTP packets are received (here "5008")
	# video_file : name of video file you want to request,here "video.mjpeg"















	@ file format
		Lab`s` proprietary MJPEG(Motion JPEG) format
			# The server streams a video which has been encoded into a proprietary MJPEG file format
			# This format stores the video as concatenated JPEG-encoded images
			# Each image being preceded by a 5-Byte header which indicates the bit size of the image
			# Server parses the bitstream of MJPEG file to extract the JPEG images
			# Server sends the images to client at periodic intervals
			# Client then displays the individual JPEG images sent from server			
    

    @ Client 
        
            # Send RTSP commands to server by pressing buttons:
                > RTSP(Real Time Streaming Protocol) 
                    * A network control protocol designed for use in entertainment and communications system to control streaming media servers
                    * Used for establishing and controlling media sessions between end points
                    * Clients issue VCR-style commands e.g play, pause .. to facilitate real-time control of playback of media files from server
            # Most RTSP servers use the RTP(Real-time Transport Protocol) in conjunction with RTCP(Real-time Control Protocol) for media stream delivery.
    
            # Commands
                
                > SETUP
                    * Send SETUP request to the server
                    * Insert Transport header(specify port for RTP data socket you just created)
                    * RTP : Real-time Transport Protocol
                    * Read server`s` response
                    * Parse Session header(from response) to get RTSP Session ID
                    * Create a datagram socket for receiving RTP data
                    * Set timeout on socket to 0.5 seconds
            
                > PLAY
                    * Send PLAY request
                    * Insert Session header
                    * Use the Session ID(returned in the SETUP response)
                    * Not put the Transport header in the request
                    * Read the Server`s` response

                > PAUSE 
                    * Send PAUSE request
                    * Insert the Session header
                    * Use the Session ID returned in the SETUP response
                    * Not put the Transport header in this request
                    * Read the server`s` response

                > TEARDOWN
                    * Send TEARDOWN request
                    * Insert the Session header
                    * Use the Session ID returned in the SETUP response
                    * Not put the Transport header in this request
                    * Read the server`s` response

                *** Must insert CSeq header in every request you send
                        Which starts at 1 and incremented by one for each request you send

What we need to implement

@ Client.py
    # SETUP function
    # PLAY function
    # PAUSE function
    # TEARDOWN function

@ RtpPacket.py
    # Set the RTP-version filed(V) = 2
    # Set padding(P), extension(X), # of contributing sources(CC), and marker(M) fields => all to 0
    # Set payload type field(PT). we use MJPEG type, type number is 26
    # Set sequence number.(frameNbr argument)
    # Set timestamp (via Python time module)
    # Set source identifier(SSRC)(identifies the server,pick an ID you like)
    # We have no other contributing sources(field CC == 0), the CSRC-field does not exist. The packet header is 12 bytes

video-streaming-server-and-client's People

Contributors

amindadgar avatar tibbersdrivemustang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

video-streaming-server-and-client's Issues

Can I play this rtsp video in vlc player

Hi,

I am new to RTSP/ RTP. I have compile your client server code , I am able to play video.mpeg file using client launcher.

But i am unable to play rtsp://10.0.226.162:1024 using vlc player.
10.0.226.162 : my system ip address
1024 : port used by server.py

Can you please tell me . is rtsp url incorrect ?

Please let me

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.