Skip to content

Instantly share code, notes, and snippets.

@wookietreiber
Created November 29, 2015 10:44
Show Gist options
  • Save wookietreiber/33d9d80c8f0ecd4d7e3f to your computer and use it in GitHub Desktop.
Save wookietreiber/33d9d80c8f0ecd4d7e3f to your computer and use it in GitHub Desktop.
stream with ffmpeg, pulseaudio.
# To record both mic and other audio input sources we need to add a named output sink. See:
# http://www.linuxquestions.org/questions/linux-software-2/alsa-and-pulseaudio-recording-multiple-input-devices-877614/
# http://www.youtube.com/watch?v=oJADNOY615Y&feature=player_embedded
# Add this to your /etc/pulse/default.pa file
load-module module-null-sink sink_name=stream
load-module module-loopback latency_msec=5 sink=stream
load-module module-loopback latency_msec=5 sink=stream
#!/bin/bash
STREAM_KEY="<justin.tv stream key>"
INRES="hd1080"
OUTRES="hd720"
FPS="24"
QUAL="fast"
ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0+1680,0 \
-f alsa -i pulse -ac 2 -vcodec libx264 -preset "$QUAL" -s "$OUTRES" \
-acodec libmp3lame -ar 44100 -ab 128k -threads 0 \
-f flv "rtmp://live.justin.tv/app/$STREAM_KEY flashver=FMLE/3.0\20(compatible;\20FMSc/1.0)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment