Last active
February 9, 2016 12:54
-
-
Save dbrownidau/26d2327b38d10a079e15 to your computer and use it in GitHub Desktop.
Linux stream to youtube via libav. (for distributions utilizing Aptitude)
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 | |
INRES="1366x768" | |
OUTRES="1366x768" | |
VBR="1800k" | |
FPS="30" # fps | |
QUAL="slow" | |
STREAM_KEY=$(cat ~/bin/youtube_key) | |
if [ $(dpkg-query -W -f='${Status}' libav-tools 2>/dev/null | grep -c "ok installed") -eq 0 ]; | |
then | |
echo "Need to install libav-tools." | |
sudo apt-get update; | |
sudo apt-get install -y libav-tools; | |
fi | |
avconv \ | |
-f x11grab -s $INRES -r "$FPS" -i :0.0 \ | |
-f alsa -ac 2 -i pulse \ | |
-vcodec libx264 -pix_fmt yuv420p -preset $QUAL -r $FPS -g $(($FPS * 2)) -b:v $VBR \ | |
-acodec libmp3lame -ar 44100 -threads 4 -qscale 3 -b:a 712000 -bufsize 512k \ | |
-f flv "rtmp://a.rtmp.youtube.com/live2/$STREAM_KEY" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment