Skip to content

Instantly share code, notes, and snippets.

@3issamben
Forked from olasd/stream_to_youtube.sh
Created January 3, 2018 07:46
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 3issamben/da701208441d24caacfdd6d239062aa7 to your computer and use it in GitHub Desktop.
Save 3issamben/da701208441d24caacfdd6d239062aa7 to your computer and use it in GitHub Desktop.
Stream video to youtube via ffmpeg
#! /bin/bash
#
# Diffusion youtube avec ffmpeg
# Configurer youtube avec une résolution 720p. La vidéo n'est pas scalée.
VBR="2500k" # Bitrate de la vidéo en sortie
FPS="30" # FPS de la vidéo en sortie
QUAL="medium" # Preset de qualité FFMPEG
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # URL de base RTMP youtube
SOURCE="udp://239.255.139.0:1234" # Source UDP (voir les annonces SAP)
KEY="...." # Clé à récupérer sur l'event youtube
ffmpeg \
-i "$SOURCE" -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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment