Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- exec 3>&1 4>&2
- trap 'exec 2>&4 1>&3' 0 1 2 3
- exec 1>>/var/log/streamToYoutbue.log 2>&1
- set -x
- YOUTUBE_URL="rtmp://a.rtmp.youtube.com/live2/"
- FFMPEG="/usr/local/ffmpeg/bin/ffmpeg"
- function usage() {
- echo "usage:"
- echo "streamToYoutbue youtube-channel-id"
- exit 1
- }
- function startStreaming() {
- echo "start streaming to youtube channel $1"
- date
- raspivid -o - -t 0 -w 1280 -h 720 -fps 25 -b 4000000 -g 50 | "$FFMPEG" -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv "$YOUTUBE_URL$1"
- }
- if [ -z "$1" ]; then
- usage
- else
- startStreaming $1
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement