[FFmpeg-devel] [PATCH] avformat/HLS: modified EXT-X-MEDIA-SEQUENCE header in order to follow the HLS standard

Willy Aubry waubry at viotech.net
Wed Feb 5 14:58:59 CET 2014

Hi everyone,

While working on HLS streaming using FFmpeg, I found out that the EXT-X-MEDIA-SEQUENCE is not set
properly while using the wrap option.

The EXT-X-MEDIA-SEQUENCE was set as the first media URI sequence number. As long as the media URI are not
reset that is fine.

However, when using the wrap option, specifying when the index of the media URI shall wrap,
the EXT-X-MEDIA-SEQUENCE follows the index and also wraps up. Players that supports HLS stop playing when
reaching this point. I found out that the EXT-X-MEDIA-SEQUENCE number must not decrease and that it must be incremented
by one for every media segment that is removed from the playlist.

This is what my patch tries to fix.

I created a new variable named segement_idx_wrap_nb that counts how many wraps have been done.
However, I didn't know where to initialize this variable and put it like other hls variable in the AVOption.
I am not sure it is the right thing to do.

Willy Aubry

More information about the ffmpeg-devel mailing list