Skip to content

Instantly share code, notes, and snippets.

@marcsello
Forked from olasd/stream_to_youtube.sh
Last active September 1, 2016 22:02
Show Gist options
  • Save marcsello/b120f6aa1495315baa7723806c7e45f7 to your computer and use it in GitHub Desktop.
Save marcsello/b120f6aa1495315baa7723806c7e45f7 to your computer and use it in GitHub Desktop.
Stream video to youtube via ffmpeg
#! /bin/bash
# Youtube streaming stuff, original by: https://gist.github.com/olasd/9841772
# Configuration of stream; pootis bitrate here, resolution will be the video's
VBR="2500k" # Bitrate of ze stream
FPS="24" # FPS of ze stream
QUAL="medium" # Quality preset (ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo)
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # URL of ze Youtube, (default is ze main)
KEY="...." # Your streaming key
ffmpeg \
-i "$1" -deinterlace \
-vcodec libx264 -pix_fmt yuv420p -preset $QUAL -r $FPS -g $(($FPS * 2)) -b:v $VBR \
-acodec libmp3lame -ar 44100 -threads 6 -qscale 3 -b:a 712000 -bufsize 512k \
-f flv "$YOUTUBE_URL/$KEY"
echo "Streaming ended"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment