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

FFmpeg trac at avcodec.org
Sun Aug 19 22:43:08 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 kelexel):

 Hi again,

 So, a little background, here are my encoding settings:
 {{{
         cmd="$ffmpeg -threads 2 -i rtmp://1.2.3.4:1935/app/streamName -re
 -acodec libfaac -ar 44000 -b:a 48k -vcodec libx264 -s 426x250  -b:v 128k
 -vpre libx264-ipod320 -flags -global_header -map 0 -f segment
 -segment_time 10 -segment_list_size 10 -segment_list ${stream}_240p.m3u8
 -segment_list_type m3u8 -segment_format mpegts ${stream}_240p%05d.ts"
 }}}

 Right now, if using your patch, you end up with such :
 http://bit.ly/S9K36g < recorded, working on iOS.
 The action to produce such was the following: publish a stream on the rtmp
 server, start ffmpeg, unpublish the stream on the rtmp server.
 Your patch did was you expected from it:
 - invoke segment_list_open when starting to encode
 - receive video & audio stream >> transcode >> segment it
 - invoke segment_list_close when no more rtmp stream is detected
 (notice the valid duration on top of the iOS player)

 The problem is this typical behavior breaks LIVE streaming

 Here is why:
 http://bit.ly/MFQqhg < bugged live
 as stated, iOS devices require EXT-X-TARGETDURATION to be readable in the
 playlist.
 problem is right now:
 - invoke segment_list_open
 - receive video & audio streams >> transcode >> segment for an unknown
 duration, remember this is Live
 - invoke segment_list_close >> uh-oh we've reached the end of the show,
 previous segments were probably deleted, we broke HLS !!

 http://46.105.37.199/hls-bad/live_ok.m3u8 < working live
 Here, EXT-X-TARGETDURATION is at the beginning of the file, notice how the
 iOS player will not display time (it's because it is in live mode, not
 record mode), and HLS works fine.
 (notice the absence of duration, on top of the iOS player, this is live
 mode)

 Conclusion, EXT-X-TARGETDURATION should REALLY be created by
 segment_list_open, and NOT by segment_list_close, otherwise, we break HLS

 Remember their are several kinds of HLS, mainly record(also known as VOD
 mode) and live

 In record we know the duration of the stream, it' start & end
 In live we only know the start of the stream, no clue on its duration

 So please, move that simple line to segment_list_open ..

 Ps: not sure yet about EXTINF tags, I have to admit I'm unsure what to put
 there. It seems to work with and without this tag.

 PPs: other working HLS setups I've seen use fixed length EXTINF (as
 previously reported)

 PPPs: yes my encoding is really not good I just made a quick and dirty POC
 so you could see when it plays or not

 Best regards.

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


More information about the FFmpeg-trac mailing list