Last active
August 29, 2015 14:18
-
-
Save ctroncoso/4c4b7655d9d5983f9d44 to your computer and use it in GitHub Desktop.
Captura TVN Villarrica
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 | |
set -e | |
NOW=$(date +\%Y-\%m-\%d_\%H-\%M-\%S) | |
NICENOW=$(date +"%Y-%m-%d %H:%M") | |
SECONDS=$(( (60 - $(date +\%M)) * 60 )) | |
echo "Starting capture" | |
avconv -nostats -i http://edge-71-cl.edge.mdstrm.com/tvn-live/_definst_/smil:afb76bb126ed1661821563583d2c23f3/chunklist_b800000.m3u8 -t $SECONDS -c copy ~/temp/villarrica_$NOW.mp4 | |
# if failed... wait 120 seconds and start a new process. | |
if [ $? -gt 0 ]; then | |
sleep 120 | |
# lets make sure we don't jump to next hour. | |
if [ $(date +\%M) -lt 55 ]; then | |
(~/bin/villarrica_hour_tvn_video) | |
fi | |
fi | |
echo | |
echo "Starting time compression" | |
nice -n19 avconv -nostats -i ~/temp/villarrica_$NOW.mp4 -an -vf "setpts=(1/32)*PTS" -r 30 ~/temp/villarrica_${NOW}_TL.mp4 | |
echo | |
echo "deleting capture file" | |
rm ~/temp/villarrica_$NOW.mp4 | |
echo | |
echo "*_*_*_*_*_*_*_*_*" | |
echo "Uploading to youtube" | |
/usr/local/bin/youtube-upload \ | |
--title="#VolcanVillarrica - 1h -> 2min - ${NICENOW}" \ | |
--category=Education \ | |
--tags="volcan, villarrica, erupcion, tvn, timelapse" \ | |
--privacy=public \ | |
--client-secrets=/home/ctroncoso/client_secret.json \ | |
~/temp/villarrica_${NOW}_TL.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment