Giter Site home page Giter Site logo

rtp-raw-video-player's Introduction

rtp-raw-video-player

Plays RTP stream with raw video payload.

Introduction

RAW video can be sent over RTP, the way the video is packed in RTP frames is described in RFC. Video is not encoded and images are streamed as YUV 4:2:0 frames. Each RTP packet contains portions of image scanlines. This RTP video payload is rarely used because it consumes a lot of network bandwidth compared to other payloads like h264.

It makes it very easy to write a very simple video player with a few lines of C without any external dependencies. This is the purpose of this project.

The player will output RGB frames either diretly to /dev/fb0 or to a file which is memory mapped. Another program can mmap the same file and render the video in a window, take snapshots, convert the video to another format ... A demo program displaying the video in a window is provided, it uses SDL2.

As raw video pixels are received in YCbCr color space, the output can be black and white (Y only is used which is very fast) or color. A compilation option (BLACK_AND_WHITE) can be used to build a player doing black and white rendering, by default is does color video. The pixel format conversion is pure software which is not very efficient but doesn't add any dependency.

Building

Dependencies

The player itself doesn't have any dependency. SDL2 is required for the demo program rendering the video in a window. On debian systems, the following command install the required dependencies :

apt-get install libsdl2-dev

A RAW video RTP streamer is provided because. It's a small shell script running a gstreamer pipeline, which means that gstreamer needs to be installed too. On debian systems, use the following :

apt-get install gstreamer1.0-plugins-base-doc gstreamer1.0-plugins-base gstreamer1.0-tools

Compiling

make will build the player and make sdl-win will build the SDL2 video renderer.

Using the program

Streaming

Starts the gstreamer pipeline in a terminal

./stream-raw.sh

Remember to add the famous 'multicast route' on the interface used for streaming :

sudo /sbin/route add -net 224.0.0.0 netmask 240.0.0.0 dev lo

Display video in a window

Starts the video decoder in a second terminal

./vpl -i lo -o /tmp/video.img -w 720 -h 576

In a third terminal, starts the video display program

./sdl-win -i /tmp/video.img -w 720 -h 576

Here is a screenshot of sdl-win output :

alt text

Display video in the framebuffer

Open a console with <Ctrl-Alt-F4> and start the player like this :

sudo ./vpl -i lo

Here is a screenshot of the screen :

alt text

Programs reference

For the video player

localadmin@buster:~/rtp-raw-video-player$ ./vpl -?
./vpl usage :
./vpl [-h] [-i nic] [-m group] [-p port] [-d fbdev] [-o file] [-w width] [-h height]
	-?		Prints this message.
	-i		Sets network interface to bind to (default eth0.10).
	-g		Sets multicast group to join (default 239.192.77.10).
	-p		Sets port to use (default 5004).
	-d		Sets the framebuffer device (default /dev/fb0).
	-o		Sets the image output file.
	-w		Sets the width of the image.
	-h		Sets the height of the image.
	-x		Sets the x offset of the image when rendering to framebuffer.
	-y		Sets the y offset of the image when rendering to framebuffer.
Options -o -w -h must be used together and are incompatible with -d.

For the SDL display program

localadmin@buster:~/rtp-raw-video-player$ ./sdl-win -?
./sdl-win usage :
./sdl-win [-?] -i file [-f fps] [-x x] [-y y] [-w width] [-h height]
	-?		Prints this message.
	-i		Sets input video frame file.
	-f		Sets the video framerate (default 10).
	-w		Sets the width of the image (default 720).
	-h		Sets the height of the image (default 576).
	-x		Sets the x position of the window (default 100).
	-y		Sets the y position of the window (default 100).

External links

RFC 4175

RFC 4421

rtp-raw-video-player's People

Contributors

vzvca avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

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.