Skip to content

Instantly share code, notes, and snippets.

@Paderman
Forked from dijitalxyz/stream_to_youtube.sh
Last active January 4, 2024 00:16
Show Gist options
  • Save Paderman/c9accd1e74872ba59ad8ecafbbb09356 to your computer and use it in GitHub Desktop.
Save Paderman/c9accd1e74872ba59ad8ecafbbb09356 to your computer and use it in GitHub Desktop.
Stream video to youtube via ffmpeg
#! /bin/bash
#
# YouTube-Streaming mit FFmpeg
#
# YouTube wird mit 720p-Auflösung konfiguriert. Das Video ist nicht skaliert
# Quelldatei #
SOURCE="<File_Location.ext>" # UDP-Quelle (siehe SAP-Ankündigungen)
# ffmpeg-Einstellungen #
VBR="2500k" # Bitrate des Ausgabevideos (2500k = 2,5 MBit/s)
FPS="30" # FPS des ausgegebenen Video (30 Bilder pro Sekunde)
QUAL="medium" # FFmpeg-Qualitätsvoreinstellung (Standard: medium)
# YouTube-Einstellungen #
YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2" # RTMP-basierte YouTube-URL (Backup-URL: rtmp://b.rtmp.youtube.com/live2?backup=1)
KEY="<Your_Stream_Key>" # YouTube-Streamschlüssel
ffmpeg -stream_loop -1 -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"
@Paderman
Copy link
Author

Paderman commented Jan 4, 2024

Note: this script is the German version from original script and is a little bit modified.
Hinweis: dieses Script ist die deutsche Version des Original-Scripts und wurde ein wenig angepasst.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment