echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
Example final command
ffmpeg -i "http://host/folder/file.m3u8" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 file.mp4
This is exactly what youtube-dl does if you just invoke
$ youtube-dl https://www.pbs.org/video/east-bay-hip-hop-dance-in-richmond-ca-ng3v7e/
i.e. it uses ffmpeg (or avconv if you so wish) in the background. No need to do that manually.