[FFmpeg-trac] #1642(avformat:reopened): -f segment: automagically generate #EXTM3U tags to -segment_list generated playlists

FFmpeg trac at avcodec.org
Wed Aug 22 02:43:10 CEST 2012


#1642: -f segment: automagically generate #EXTM3U tags to -segment_list generated
playlists
-------------------------------------+-------------------------------------
             Reporter:  kelexel      |                    Owner:
                 Type:  enhancement  |                   Status:  reopened
             Priority:  normal       |                Component:  avformat
              Version:  git-master   |               Resolution:
             Keywords:  segment,     |               Blocked By:
  HLS, m3u8                          |  Reproduced by developer:  1
             Blocking:               |
Analyzed by developer:  1            |
-------------------------------------+-------------------------------------

Comment (by saste):

 Replying to [comment:11 kelexel]:
 > Note, in HLS-ilve here is what is happening:
 >
 > When a client reads an .m3u8 file, and if no #EXT-X-ENDLIST is found in
 the playlist.m3u8 it's in live mode not vod mode.
 >
 > In which client, when reaching the last file in the playlist, the client
 will automagically re-request the playlist until it find a playlist
 containing the #EXT-X-ENDLIST, in which case the stream won't be
 considered as "live" anymore.
 >
 > Said paylist is supposed to have changed, hence -segment_list_limit 10,
 means we will only keep the last 10 segments of -segment_time 5 duration
 >
 > Each time the playlist starts a new group of 10x segments, the following
 tag should be incremented: #EXT-X-MEDIA-SEQUENCE:1
 >
 > So, on files 0->9, #EXT-X-MEDIA-SEQUENCE:1
 > On files 10->19 #EXT-X-MEDIA-SEQUENCE:2
 > And so on
 >
 > Also, please look at apple docs under Index Files (Playlists):
 https://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/StreamingMediaGuide/HTTPStreamingArchitecture/HTTPStreamingArchitecture.html#//apple_ref/doc/uid/TP40008332-CH101-SW2
 >
 > #EXT-X-TARGETDURATION:10
 >
 > #EXTINF:10,
 >
 > Which is the format I'm desperately trying to enforce here, and the one
 you don't want to :(

 Thanks for the nice explanations.

 I'm starting to understand how this live Apple thing works, and I see why
 it is not working in our case.

 Basically I addef support to M3U8 playlists, trying to be as faithful as
 possible to the specification, but that was not compatible with how HLS
 works.

 So, in order to make HLS work we need to:
 1. set defined interval of times. In our case we request that
 -segment_time will be defined (rather than the exclusive option
 -segment_times). Issue: we can't generate segments with regular duration,
 since this will depend on how I-frames are placed in the stream to
 segment.

 2. put EXT-X-TARGETDURATION at the begin of the file. As per point 1., we
 can't guarantee that the target duration will be honoured (thus breaking
 M3U8 specs), and we don't know which will be the maximum duration of the
 segments in the list. In this case we can "fake" the format and set the
 time specified by -segment_time as target duration.

 3. not put EXT-X-ENDLIST at the end of the file if the last segment was
 not reached and -segment_list_size is != 0, and we need to update EXT-X
 -MEDIA-SEQUENCE per each file list update.

 So we need to understand which options will enable this behavior. For sure
 -segment_list_size should be specified. I'm not sure what should we do
 when both -segment_list_size and -segment_times are specified, possibly we
 should abort since I can't see a meaningful behavior in this case,
 assuming -segment_list_size was meant to deal with HLS.

 I'll possibly come with a patch in the next few days, and I'll ask you to
 test it.

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1642#comment:14>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list