Skip to content

Instantly share code, notes, and snippets.



Last active Dec 28, 2015
What would you like to do?
Script to stream in local network using UDP Multicas. Sends audio to port 5001 and video to the port 1234.
#UDP Multicast
#Script streams Audio to the port 5001 and Video to the port 1234 separately.
#Script uses my USB Sound card named "USB" to capture sound & "/dev/video0" video device to capture live video.
#It streams audio and video to all the computers connected to the local area network.
#Use the command : "cat /proc/asound/cards" to display your available sound cards.
#Use the command : "v4l2-ctl --list-devices" to display available video devices. You may need to install v4l2-ctl package before executing the command by running "sudo apt-get install v4l-utils"
#You can also use : "ls -ltrh /dev/video*" to list video devices.
#Capture and stream audio to port 5001
gst-launch-0.10 -v alsasrc device=plughw:USB ! audioconvert ! audio/x-raw-int,channels=1,depth=16,width=16,rate=44100 ! rtpL16pay ! udpsink host=$clientIp auto-multicast=true port=5001 &
#Capture and stream video in 1280*720 resolution to 1234 port of the clients.
gst-launch v4l2src device=/dev/video0 ! 'video/x-raw-yuv,width=1280,height=720' ! x264enc pass=qual quantizer=20 tune=zerolatency ! rtph264pay ! queue ! udpsink host=$clientIp auto-multicast=true port=1234
# To kill the gst-launch process if you Ctrl-C out of the running script
pkill gst-launch

This comment has been minimized.

Copy link
Owner Author

@ar-rahul ar-rahul commented Dec 28, 2015

You may have to install these packages to get this working

sudo apt-get install gstreamer-tools

sudo apt-get install gstreamer0.10-*

sudo add-apt-repository ppa:mc3man/gstffmpeg-keep
sudo apt-get update
sudo apt-get install gstreamer0.10-ffmpeg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment