Last active
December 28, 2015 07:59
-
-
Save ar-rahul/50b5044aca38918223e7 to your computer and use it in GitHub Desktop.
Script to stream in local network using UDP Multicas. Sends audio to port 5001 and video to the port 1234.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#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. | |
clientIp=224.0.0.1 | |
#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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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