amcneil
amcneil

Reputation: 21

Creating m3u8 file that points to other m3u8 files

I'm looking to create a m3u8 file that points to other m3u8 files based on bandwidth, something like this

#EXTM3U
#EXT-X-VERSION:4
#EXT-X-TARGETDURATION:7
#EXT-X-MEDIA-SEQUENCE:4
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=500000,RESOLUTION=480x270
480x270.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1000000,RESOLUTION=640x360
640x360.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2000000,RESOLUTION=1280x720
1280x720.m3u8
#EXT-X-ENDLIST

I was hoping to be able to do this using ffmpeg but I can't seem to find any information on doing it that way. This may be the wrong way to do it so if anyone can point me in the right direction that would be greatly appreciated.

Upvotes: 2

Views: 6818

Answers (1)

aergistal
aergistal

Reputation: 31209

Update January 2018

You can now create master playlists directly with FFmpeg using master_pl_name and var_stream_map. See the documentation.


You cannot create a HLS master playlist directly with FFmpeg (yet). You can encode the same source for multiple bitrates and get each variant playlist, but you'll have to provide the master yourself.

Of course, the resulting streams have to be aligned so you either:

  • use a fixed GOP size (-g <size> -sc_threshold 0, x264 --keyint <size> --min-keyint <size> --scenecut -1)

  • if applicable, do 2-pass encoding using the same first pass statfile for each second pass. This works better if you use generate the statfile for a rendition in the middle of the required bitrates since there will be some loss of precision.

Upvotes: 4

Related Questions