Created
December 27, 2017 15:44
-
-
Save thermatk/ca4a8091fc2b03788e7b9ec2552865bc to your computer and use it in GitHub Desktop.
HLS videos download
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 | |
url="$1" | |
filen="$2" | |
base=$(dirname "$url") | |
mkdir tmpwip | |
cd tmpwip | |
wget -O index.m3u8 $url | |
cp index.m3u8 files.txt | |
sed -i -e '/#EXT/d' files.txt | |
while read ts; do | |
wget --retry-connrefused --waitretry=1 --read-timeout=20 --timeout=15 -t 0 --continue $base/$ts | |
done <files.txt | |
ffmpeg -y -v warning -loglevel debug -i index.m3u8 -vcodec copy -c copy -f mpegts out.ts | |
ffmpeg -i out.ts -acodec copy -vcodec copy out.mp4 | |
cp out.mp4 ../$filen.mp4 | |
cd .. | |
rm -rf tmpwip |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment