Created
February 17, 2020 10:42
-
-
Save widgetii/ec275524dd621cd55774c952bee4c622 to your computer and use it in GitHub Desktop.
This file contains 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 characters
#!/bin/sh | |
[ $# -eq 0 ] && { echo "Usage: $0 TOKEN rtsp://... <name>"; exit 1; } | |
TOKEN="$1" | |
SOURCE="$2" | |
NAME=${3:-cctv} | |
#ARCHIVE=${ARCHIVE:-archive} | |
HLS_TIME=${HLS_TIME:-5} | |
HLS_LIST_SIZE=${HLS_LIST_SIZE:-5} | |
ffmpeg -i "$SOURCE" \ | |
-stream_loop -1 \ | |
-i 10SecSilence.aac \ | |
-f hls \ | |
-vsync 0 -copyts -vcodec copy -acodec copy \ | |
-movflags frag_keyframe+empty_moov \ | |
-hls_flags delete_segments+append_list \ | |
-hls_time $HLS_TIME \ | |
-hls_list_size $HLS_LIST_SIZE \ | |
-method PUT \ | |
"https://a.upload.youtube.com/http_upload_hls?cid=${TOKEN}©=0&file=index.m3u8" | |
# append this to also enable archiving | |
# \ | |
# -f segment \ | |
# -segment_time 300 \ | |
# -segment_atclocktime 1 \ | |
# -strftime 1 \ | |
# -vcodec copy -acodec copy \ | |
# -map 0 \ | |
# "$ARCHIVE/$NAME-%F-%H-%M-%S.mp4" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
to build ffmpeg use: