ffmpeghttp-live-streaming

What is the recommended extension for HLS chunks / segments? Are there recognised alternatives?


I'm using ffmpeg to create HLS chunks AKA segments. I'm trying to find recognised extensions for HLS chunks.

All the documentation I've seen only ever uses a .ts extension when using ffmpeg ... something like this:

-hls_segment_filename "${outPath}/v%v/chunk%d.ts"

Is there an alternative recognised extension, since I'm working within a TypeScript project and TypeScript files also use a .ts extension and this is causing a conflict with various tools.

I don't want to use a non-standard extension for HLS chunks if I can help it. Are there any other known extensions for HLS chunks?

Any pointers to documentation would be most welcome.


Solution

  • As @Gyan said in the comments there are 2 extensions available for HLS namely .ts or .m4s

    This is confirmed here by Apple

    Apple explain that .ts files are MPEG transport stream video files and .m4s files are Fragmented MP4 video or audio files.

    You can't just change the extension willy nilly though. You need to generate the files using certain ffmpeg flags.

    To generate .ts files use this flag (along with your other ffmpeg hls options):

    -hls_segment_filename "${outPath}/v%v/chunk%d.ts"
    

    To generate .m4s files use these flags:

    -hls_segment_type fmp4
    -hls_segment_filename "${outPath}/v%v/chunk%d.m4s"
    

    Nice post on Fragmented Video here

    In performance testing I found .m4s to perform worse than .ts (in terms of seek speeds)