Choose download resolution in m3u8 list with ffmpeg

Bruno Andrade picture Bruno Andrade · Apr 23, 2018 · Viewed 12.3k times · Source

I'm trying to download video from a m3u8 playlist using ffmpeg but I do not know how to choose the resolution to download. Currently the command is downloading the highest version

the command I am using is:

/home/user/bin/ffmpeg -user_agent "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:49.0) Gecko/20100101 Firefox/49.0" -i "https://sitevideo.com/list.m3u8" -c copy "/home/file/video.ts"

My list is this

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:BANDWIDTH=400000,NAME="low"
size1.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=800000,NAME="med"
size2.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=1900000,NAME="best"
size3.m3u8

Answer

Gyan picture Gyan · Apr 23, 2018

You have to use the -map option.

ffmpeg ... -i "https://sitevideo.com/list.m3u8" -map p:1 -c copy "/home/file/video.ts"

p:1 refers to the 2nd program (variant playlist, in this case)..