Created
April 26, 2020 22:53
-
-
Save gatlin/986a5610b0b4cd6c0ba0ea00d536dead to your computer and use it in GitHub Desktop.
Revisions
-
gatlin created this gist
Apr 26, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ #!/usr/bin/env bash ### # Usage ### # twitch <path-to-file> PATH_TO_TWITCH_KEY="$HOME/.config/twitch.key" if [ ! -f "$HOME/.config/twitch.key" ]; then echo "Please write your twitch key to $PATH_TO_TWITCH_KEY" exit 1 fi TWITCH_KEY=$(cat $PATH_TO_TWITCH_KEY) FILE_PATH="$1" if [ -z "$FILE_PATH" ]; then echo "Please specify a file to stream." exit 1 fi gst-launch-1.0 --gst-debug-level=2 \ filesrc location="$FILE_PATH" ! \ qtdemux name=demux \ demux.video_0 ! \ queue ! \ decodebin ! \ videoconvert ! \ x264enc threads=0 bitrate=400 tune=zerolatency key-int-max=30 ! \ queue ! \ flvmux name=flvmux ! \ queue ! \ rtmpsink location="rtmp://live-fra.twitch.tv/app/$TWITCH_KEY" \ demux.audio_0 ! \ queue ! \ decodebin ! \ audioconvert ! \ audioresample ! \ avenc_aac ! \ flvmux.