Created
March 1, 2017 13:02
-
-
Save Natata/1a2d7193404592a19fde145d1f61dd14 to your computer and use it in GitHub Desktop.
record twitcasting streaming
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/bash | |
# coding: utf-8 | |
# twitcasting_record.sh by Natata | |
# modified from showroom.sh by fcicq | |
# NOTE: need to install jq and livestreamer first | |
(jq --version 1>/dev/null 2>&1) || (echo 'install jq first'; exit) | |
(livestreamer --version 1>/dev/null 2>&1) || (echo 'install livestreamer first (run pip/pip3 install livestreamer)'; exit) | |
if [ -n "$1" ]; then | |
id=$(echo "$1" | sed 's|^.*/||g') | |
while true; do | |
fname="${id}_$(date +'%F_%H-%M-%S').ts" | |
echo "File name: $fname" | |
url="http://twitcasting.tv/$id/metastream.m3u8" | |
echo "url: $url" | |
livestreamer --hls-segment-threads 3 --hls-segment-timeout 1.5 --http-timeout 1.5 -o "$fname" "hlsvariant://$url" best | |
# ffmpeg -nostdin -i "$url" \ | |
# -vcodec copy -acodec copy -f mpegts "$fname" | |
if [ "$2" != "loop" ]; then | |
break | |
fi | |
done | |
fi | |
echo "live finish: " $fname |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment