[FFmpeg-devel] HLS Segmenting/Fragmentation Questions

Ronak ronak2121 at yahoo.com
Thu Apr 19 23:50:12 EEST 2018


Hi,

I've been testing FFMPEG's HLS fragmented MP4 options with some M4A audio files.

I've noticed that if I ask ffmpeg to fragment an 11 minute file vs a 10 hour file, the byte ranges are different, even if the channel count/sampling rate/bit rate and codec are the same.

Here's an example of what I'm talking about:

#EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-MAP:URI="someAudio.m4s",BYTERANGE="738 at 0"
#EXTINF:9.798821,
#EXT-X-BYTERANGE:38977 at 738
someAudio.m4s
#EXTINF:9.798821,
#EXT-X-BYTERANGE:38735 at 39715
someAudio.m4s
#EXTINF:9.798821,
#EXT-X-BYTERANGE:38650 at 78450
someAudio.m4s
#EXTINF:9.798821,
#EXT-X-BYTERANGE:38688 at 117100
someAudio.m4s
#EXTINF:9.798821,
#EXT-X-BYTERANGE:38820 at 155788
someAudio.m4s

And 

#EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-MAP:URI="someOtherAudio.m4s",BYTERANGE="738 at 0"
#EXTINF:9.798821,
#EXT-X-BYTERANGE:38724 at 738
someOtherAudio.m4s
#EXTINF:9.798821,
#EXT-X-BYTERANGE:38812 at 39462
someOtherAudio.m4s
#EXTINF:9.798821,
#EXT-X-BYTERANGE:38632 at 78274
someOtherAudio.m4s
#EXTINF:9.798821,
#EXT-X-BYTERANGE:38804 at 116906
someOtherAudio.m4s
#EXTINF:9.798821,
#EXT-X-BYTERANGE:38720 at 155710
someOtherAudio.m4s

Why would these byte ranges be different? I've been trying to look through the libavformat source code (https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/hlsenc.c <https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/hlsenc.c>) but it looks like this determination is done in whoever calls hls_write_packet.

Thanks,

Ronak



More information about the ffmpeg-devel mailing list