[FFmpeg-user] Generating HLS chunks on demand

Vincent Deconinck vdeconinck at gmail.com
Mon Jan 30 23:51:52 EET 2023

Hi all,

Re-reading this thread and German's first answer in particular, I realized
that there are two diffierent "segment" muxers: '-f segment' and '-f
ssegment' (with double 's', for 'stream-segment') and decided to try
playlists of ts files built by each of them, but none of them plays back OK.

Then I tried creating 5 individual chunks with -f hls, like so:
ffmpeg -ss 0 -i source.ts -c:v libx264 -b:v 1000k -c:a aac -b:a 128k
-x264opts "keyint=25:min-keyint=25:no-scenecut" -t 4 -f hls -hls_time 4
-hls_playlist_type vod hls_1_fixed0.m3u8
I then deleted the generated individual m3u8 playlists and consolidated all
segments in a single playlist, but the result cannot be played back either.
In other words, it's not only the use of "segment" or "ssegment" which
fails, even "hls" segments are incompatible when requested individually.

I compared the generated first segment with each scenario, and from a GOP
point of view, they are identical
But a size comparison of those first segments gives :
-f "full" hls:      567196 bytes
-f single hls:      567008 bytes
-f single mpegts:   592200 bytes
-f single segment:  597652 bytes
-f single ssegment: 592200 bytes

mpegts and ssegment are exactly the same files (bit-per-bit), but all
others are different, and the most surprising difference is between the
first two.

"The first 4-second hls segment from a video"
is not the same as
"The hls segment of the first 4-second of a video"

I also experimented with the "-flags +cgop" option. The generated files are
different again, but the net result is the same: only the playlist created
by HLS for the full file at once is readable, while the ones with
individually-created chunks is not.

Any other ideas to try ?



More information about the ffmpeg-user mailing list