Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

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 dardevelin/0163487115507261a763d3c51ff9c543 to your computer and use it in GitHub Desktop.
Save dardevelin/0163487115507261a763d3c51ff9c543 to your computer and use it in GitHub Desktop.
stream with the command line
#!/usr/bin/env bash
INRES="1600x900" # input resolution
OUTRES="1600x900" # output resolution
FPS="10" # target FPS
GOP="20" # i-frame interval, should be double of FPS,
THREADS="4" # max 6
CBR="1300k" # constant bitrate (should be between 1000k - 3000k)
QUALITY="veryfast" # one of the many FFMPEG preset
STREAM_KEY="foo"
SERVER="rtmp://eumedia1.livecoding.tv:1935/livecodingtv"
KEY_FRAME="2" # Livecoding says it MUST be 2, please do not change it unless you know what you are doing.
ffmpeg -f x11grab -s "$INRES" -r "$FPS" -i :0.0 -f alsa -i pulse -f flv -ac 2 -ar 44100 \
-vcodec libx264 -force_key_frames "expr:gte(t,n_forced*$KEY_FRAME)" -g $GOP -keyint_min $FPS -b:v $CBR -minrate $CBR -maxrate $CBR -pix_fmt yuv420p\
-s $OUTRES -preset $QUALITY -tune film -acodec libmp3lame -threads $THREADS -strict normal \
-bufsize $CBR "$SERVER/$STREAM_KEY"
# $FFMPEG_PATH -f x11grab -s $INRES -framerate "$FPS" -i :0.0+$TOPXY -f alsa -i pulse -f flv -ac 2 -ar $AUDIO_RATE -vcodec libx264 -force_key_frames "expr:gte(t,n_forced*$KEY_FRAME)" -g $GOP -keyint_min $GOPMIN -b $CBR -minrate $CBR -maxrate $CBR -pix_fmt yuv420p -s $OUTRES -preset $QUALITY -tune film -acodec libmp3lame -threads $THREADS -vf "movie=$WEBCAM:f=video4linux2, scale=$WEBCAM_WH , setpts=PTS-STARTPTS [WebCam]; [in] setpts=PTS-STARTPTS [Screen]; [Screen][WebCam] overlay=$WEBCAM_XY [out]" -strict normal -bufsize $CBR $LOGLEVEL_ARG "rtmp://$SERVER.livecoding.tv:1935/livecodingtv/$STREAM_KEY"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment