[FFmpeg-user] Generating HLS chunks on demand

German Geraskin german.geraskin at gmail.com
Wed Jan 25 12:23:09 EET 2023


Hi Vincent,

I have read your very first message and realized what you are going to
achieve as a final result.

So, my advice is the following:
1. Produce a full set of HLS segments for your source file and save
them in some folder that is not accessible to your users (archive).
2. When the user requests the stream, let say, from 100 second from
the beginning, your app copies a short set of segments starting from
the 25-th chunk to the shared folder and uploads the modified
chunklist.m3u8 there.
 Example:
You have an archive folder with all chunks. Each chunk is 4 second long.
media_0000.ts
media_0001.ts
...
media_0199.ts
media_0200.ts

The user requests the stream starting from the 100-th second that
lasts 20 second.

Your app copies chunks from 25-th to 29-th ones to the shared folder
and places the modified chunklist there.
media_0025.ts
media_0026.ts
media_0027.ts
media_0028.ts
media_0029.ts
chunklist.m3u8

--- chunklist.m3u8 ---
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:25
#EXT-X-ALLOW-CACHE:YES
#EXT-X-TARGETDURATION:4
#EXTINF:4.00,
media_0025.ts
#EXTINF:4.00,
media_0026.ts
#EXTINF:4.00,
media_0027.ts
#EXTINF:4.00,
media_0028.ts
#EXTINF:4.00,
media_0029.ts
#EXT-X-ENDLIST
--------------------

That is it.

German


More information about the ffmpeg-user mailing list