Create m3u8 file with extended M3U directives by ffmpeg

I am generating m3u8 files using ffmpeg.

The command is as follows:

ffmpeg -i sourcefile.mp4 -vcodec libx264 -acodec libvo_aacenc -b:v 128k -flags -global_header -map 0:0 -map 0:1 -f segment -segment_time 4 -segment_list_size 0 -segment_list testlist.m3u8 -segment_format mpegts stream%05d.ts 

This creates the m3u8 files successfully, but does not add the extended m3u8 directives.

So how to add these directives?

Thanking in Advance,

Sagar Joshi

+4
source share
1 answer

According to the specification of HTTP Live Streaming , and if you are not using an older version of ffmpeg (I use 1.0), the m3u8 file it creates is beautiful.

My looks like this (while ffmpeg is still encoding):

 #EXTM3U #EXT-X-VERSION:3 #EXT-X-MEDIA-SEQUENCE:0 #EXT-X-ALLOWCACHE:1 #EXTINF:8.308300, stream00000.ts #EXTINF:8.341667, stream00001.ts 

By disabling the # EXT-X-ENDLIST tag, the client must know to reload this m3u8 file for more media. This is described here . As soon as ffmpeg exits (or I ctrl-c from it) # EXT-X-ENDLIST is added to the end of the file.

+4
source

Source: https://habr.com/ru/post/1432478/


All Articles