Use ffmpeg to download stream from m3u8 file with a particular resolution

7,363

When you access a HLS master playlist using FFmpeg, all the variants are presented as numbered programs. You need to map the desired program.

So, first run

ffmpeg -i hls-link

to identify the program.

Then run,

ffmpeg -i hls-link -map 0:p:2 -c copy out

to download Program 2.

Share:
7,363
C.J.
Author by

C.J.

Updated on September 18, 2022

Comments

  • C.J.
    C.J. almost 2 years

    I recently found how to download 'HLS' from a site and that works.

    But one thing I could not find is if a particular site has available video in more than one resolution, say 1280x720 and 1920x1080.

    How can I tell 'FFMPEG' to download 1280x720 and not 1920x1080?

    This is the code I tried:

    ffmpeg -i "https://hsprepack.akamaized.net/videos/hotstarint/world/kwks6/1_2/master.m3u8?hdnea=st=1540184067~exp=1540185867~acl=/*~hmac=a8945f016b594e1e2e4192ee05e2feaa5811c687d1891f69be1acc9057dd725f" -c copy output.mp4
    
  • C.J.
    C.J. over 5 years
    thank you very much it worked i had the idea it had something to do with -map but i was lacking knowledge of p that stand for program which ring the bell when i saw the logs
  • Admin
    Admin almost 2 years
    How can I download all three resolutions... Besides running this command three times? Ideally I'd like to do them all in one command, so I assume I need multiple MAP params ?