Install ffmpeg:
brew install ffmpeg
Download file through url, like this:
ffmpeg -protocol_whitelist file,http,https,tcp,tls,crypto -i "https://path/to/playlist.m3u8" -c copy ~/Downloads/video.mp4
Shell script (E.g. dl_m3u8.sh
):
#!/bin/sh
url="$1"
dir="$(cd ~/Downloads && pwd)"
filename="$dir/${2:-video}.mp4"
# brew install ffmpeg
rm -rf "$filename"
ffmpeg -protocol_whitelist file,http,https,tcp,tls,crypto -i "$url" -c copy "$filename"