From 6c2295394ece45edd5b3012a98f8aed62c66d7a5 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Wed, 27 Jun 2018 08:04:54 -0700 Subject: WIP scripts --- twitch | 46 ++++++++++++++++++++++++++++++++++++++++++++++ workon | 42 ++++++++++++++++++++---------------------- 2 files changed, 66 insertions(+), 22 deletions(-) create mode 100755 twitch diff --git a/twitch b/twitch new file mode 100755 index 0000000..b84af77 --- /dev/null +++ b/twitch @@ -0,0 +1,46 @@ +#! /usr/bin/env nix-shell +#! nix-shell -i bash -p ffmpeg +# +# https://wiki.archlinux.org/index.php/Streaming_to_twitch.tv + +FILE=$(date +%Y.%m.%d..%H.%M) + +INRES="1920x1080" +OUTRES="1920x1080" +FPS="15" +GOP="30" +GOPMIN="15" +THREADS="2" +CBR="1000k" +QUALITY="ultrafast" +AUDIO_RATE="44100" +KEY=$(pass internet/twitch.tv-key) +SERVER="live-lax" + +ffmpeg \ + -f alsa -i default \ + -f x11grab -s "$INRES" -r "$FPS" -i :0.0 \ + -f video4linux2 -i /dev/video0 \ + -filter_complex '[2:v]scale=480:-1[cam];[1:v][cam]overlay=W-w-10:H-h-10' \ + -f flv "rtmp://$SERVER.twitch.tv/app/$KEY" + -c:v libx264 \ + -preset veryfast \ + -maxrate 1984k \ + -bufsize 3968k \ + -g "$GOP" \ + -keyint_min "$GOPMIN" \ + -b:v "$CBR" \ + -minrate "$CBR" \ + -maxrate "$CBR" \ + -pix_fmt yuv420p \ + -s "$OUTRES" \ + -preset "$QUALITY" \ + -tune film \ + -crf:v 18 \ + -c:a libmp3lame \ + -b:a 128k \ + -threads "$THREADS" \ + -strict normal \ + -bufsize "$CBR" \ + -ar "$AUDIO_RATE" \ + -ac 2 \ diff --git a/workon b/workon index 42efb77..8c0c3b8 100755 --- a/workon +++ b/workon @@ -6,29 +6,27 @@ # Original author: https://github.com/sumitsu GITHUB_USER=bsima -GITHUB_WORK=LiaisonTechnologies -DESK="${HOME}/desk" # or wherever you typically put your code +GITHUB_WORK=${2:-LiaisonTechnologies} +DESK="${HOME}/work/${GITHUB_WORK}/" # or wherever you typically put your code -for REPO in "$@" -do - echo "${REPO}"; - if [ ! -d "${DESK}/${REPO}" ] +echo "${REPO}" +if [ ! -d "${DESK}/${REPO}" ] +then + if ( ! git clone git@github.com:${GITHUB_USER}/${REPO}.git ${DESK}/${REPO} ) then - if ( ! git clone git@github.com:${GITHUB_USER}/${REPO}.git ${DESK}/${REPO} ) - then - echo "FAILED"; - exit 1; - fi; - else - echo "(already exists)"; - exit 1; - fi; - cd "${DESK}/${REPO}"; - git remote add upstream git@github.com:${GITHUB_WORK}/${REPO}.git; - git config branch.master.remote upstream - git config branch.master.merge refs/heads/master - git config remote.pushDefault origin - git remote -v; -done; + echo "FAILED" + exit 1 + fi +else + echo "(already exists)" + cd "${DESK}/${REPO}" + exit 1 +fi; +cd "${DESK}/${REPO}" +git remote add upstream git@github.com:${GITHUB_WORK}/${REPO}.git +git config branch.master.remote upstream +git config branch.master.merge refs/heads/master +git config remote.pushDefault origin +git remote -v exit 0; -- cgit v1.2.3