Skip to content

Instantly share code, notes, and snippets.

@andrewshulgin
Last active August 26, 2016 16:04
Show Gist options
  • Save andrewshulgin/b4eae7b1c6c1689e2e5a to your computer and use it in GitHub Desktop.
Save andrewshulgin/b4eae7b1c6c1689e2e5a to your computer and use it in GitHub Desktop.
#!/bin/sh
youtube="rtmp://a.rtmp.youtube.com/live2/username.0000-1111-2222-3333"
ustream="rtmp://0.1234.fme.ustream.tv/ustreamVideo/1234/abcdefghijklmnopqrstuvwxyz1234567890"
local_720p="rtmp://localhost:1935/output/720p"
local_1080p="rtmp://localhost:1935/output/1080p"
logfile="/tmp/avconv.log"
on_die () {
pkill -KILL -P $$
}
trap 'on_die' TERM
avconv -f flv -i "rtmp://localhost:1935/input/$1" -vcodec libx264 -b:v 2000k -g 2 -s 1280x720 -acodec aac -ac 2 -ar 44100 -b:a 128k -strict experimental -f flv $local_720p -vcodec libx264 -b:v 4000k -g 2 -s 1920x1080 -acodec aac -ac 2 -ar 44100 -b:a 128k -strict experimental -f flv $local_1080p > /tmp/avconv-transcode.log 2>&1 &
avconv -f flv -i "rtmp://localhost:1935/output/1080p" -codec copy -f flv $youtube > /tmp/avconv-youtube.log 2>&1 &
avconv -f flv -i "rtmp://localhost:1935/output/720p" -codec copy -f flv $ustream > /tmp/avconv-ustream.log 2>&1 &
wait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment