Coming with question related to HLS segments (metadata?, some hidden data?).
Most common way to generate HLS segments and .m3u8's is using ffmpeg like:
ffmpeg -i Example.mp3 -f hls -master_pl_name replay.m3u8 -c:a aac -ab 192k -var_stream_map "a:0,agroup:aud v:0,agroup:aud" -hls_playlist_type vod -hls_list_size 0 -hls_time 10 vs%v/out.m3u8
This will produce v0 and v1 dirs with 10s~ HLS segments and proper m3u8 files ready to use.
Let's assume that I work with large audio files and want to watermark each HLS stream in different way (each client gets different watermark for his HLS stream of particular file). HLS segments cannot be stored (no needed and too much space) so created before and need to be created each time client requests. Normally it's not possible in reasonable time due to delay of obtaining file by server (from cloud in this case) -> creating (watermarked) segments - but I can do some special preparation for this.
My watermarking software allows to do some preparation before creating watermarked file copy so the process (when client requests) is faster - it means when I want to process Example.mp3 I can prepare Example.customextension file and then when I want to create individual watermarked copy only Example.customextension is needed - result is fast here. There is no chunks at this point only entire files.
Let's say I can modify watermarking software in some ways:
- Allow to prepare *.customextension chunks (with given size) for Example.mp3 file and watermark them one by one to get watermarked chunks as result (can be playable or not depending of setting) that can be assembled to full file. Full process of obtaining one final watermarked chunk is fast here (so chunk could potentially be used as HLS segment on client demand)
or
Allow to pass already created playable file chunks (let's say by ffmpeg HLS command on Example.mp3) to watermarking software and get *.customextension chunks based on them to use in same way as in 1)
any other?
As result I would have watermarked chunks (playable or not as I choose). Client can request for each chunk and obtain it relatively fast. I would like to use them as segments in HLS streaming.
My question is:
- Is this possible to use them in HLS streaming?
- Or rather what needs to be done (kept in mind during creation) to use them as HLS segments and create .m3u8 files manually to match chunks? Is it only about metadata duration start or other key/values (if chunks are playable)?
- Are there kind of 'magic' bytes that HLS segments contain that makes them usable?
Thanks for help.