Skip to content

Instantly share code, notes, and snippets.

@antonijn
Forked from brodul/streaming.sh
Last active December 23, 2015 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save antonijn/6561014 to your computer and use it in GitHub Desktop.
Save antonijn/6561014 to your computer and use it in GitHub Desktop.
#! /bin/bash
# originaly from http://tinyurl.com/twitch-linux from taladan
# www.youtube.com/user/taladan
# gist created by brodul
INRES="1280x800" # input resolution
#OUTRES="1024x640" # Output resolution
OUTRES="800x500" # Output resolution
FPS="30" # target FPS
QUAL="medium" # one of the many FFMPEG preset on (k)ubuntu found in /usr/share/ffmpeg
# If you have low bandwidth, put the qual preset on 'fast' (upload bandwidth)
# If you have medium bandwitch put it on normal to medium
# Write your key in a file named .twitch_key in your home directory
STREAM_KEY=$(cat ~/.twitch_key) # This is your streamkey generated by jtv/twitch found at: http://www.justin.tv/broadcast/adv_other
ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0+0,0 -itsoffset 00:00:01 -f alsa -ac 2 -i pulse -vcodec libx264 -vpre "$QUAL" -s "$OUTRES" -acodec libmp3lame -ab 96k -threads 6 -qscale 5 -b 1024kb -f flv STREAM_KEY
@ubuntuaddicted
Copy link

i see that you forked this from the original script and added somethings like -itsoffset and added the -ab option. Does the -ab option set the audio bitrate and then the -b towards the end set the video bitrate? Cause I was noticing the original script had only -b setting and I noticed that whatever I sset it to was the bitrate for both my audio and video which i believe was causing issues. I also am trying to fix horrible sync issue with my microphone. i, using pulse null-outputs and loopbacks to mix the game audio and the mic audio together, and then within pavucontrol I select that null-output to be chosen by avconv to stream that to twitch but my voice is way after the actions already occurred in the video game. Is that what I can use the -itsoffset option for do you know? is that setting actually delaying what's captured by x11grab by 1 second?

Any help would be appreciated.

@Kranium31
Copy link

I changed to this script after having sound issues with the avconv one. I am still having issues with sound though going out of sync as I go through my playlist. Not sure if its the settings or the rips. Thanks for the script.

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