How to download the streaming m3u8 videos formats?

Ubuntu:

sudo apt-get install ffmpeg
ffmpeg -i http://.../playlist.m3u8 -c copy -bsf:a aac_adtstoasc output.mp4

Mac:

brew install ffmpeg
ffmpeg -i http://.../playlist.m3u8 -c copy -bsf:a aac_adtstoasc output.mp4