Skip to content

Commit

Permalink
Update stream_videos.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
simeononsecurity committed Feb 15, 2024
1 parent 5d54485 commit 0a8bccb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions stream_videos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@ stream_videos() {
while true; do
# Find all MP4 files recursively in the video directory
find "$VIDEO_DIR" -type f -name '*.mp4' | while read -r file; do
echo "Streaming $file to Twitch and YouTube..."
ffmpeg -re -i "$file" -c:v libx264 -preset veryfast -maxrate 1000k -bufsize 6000k -g 50 -c:a aac -b:a 128k -ar 44100 -f flv "rtmp://live-lax.twitch.tv/app/$TWITCH_STREAM_KEY" \
-c:v libx264 -preset veryfast -maxrate 1000k -bufsize 6000k -g 50 -c:a aac -b:a 128k -ar 44100 -f flv "rtmp://a.rtmp.youtube.com/live2/$YOUTUBE_API_KEY"
if [ -n "$YOUTUBE_API_KEY" ]; then
echo "Streaming $file to Twitch and YouTube..."
ffmpeg -re -i "$file" -c:v libx264 -preset veryfast -maxrate 1000k -bufsize 6000k -g 50 -c:a aac -b:a 128k -ar 44100 \
-f flv "rtmp://live-lax.twitch.tv/app/$TWITCH_STREAM_KEY" \
-c:v copy -c:a copy -f flv "rtmp://a.rtmp.youtube.com/live2/$YOUTUBE_API_KEY"
else
echo "Streaming $file to Twitch..."
ffmpeg -re -i "$file" -c:v libx264 -preset veryfast -maxrate 1000k -bufsize 6000k -g 50 -c:a aac -b:a 128k -ar 44100 -f flv "rtmp://live-lax.twitch.tv/app/$TWITCH_STREAM_KEY"
fi
done
done
}
Expand Down

0 comments on commit 0a8bccb

Please sign in to comment.