> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# coreav hls

> Serve an MP4 or MOV file as HLS with fragmented MP4 (CMAF) segments, without re-encoding.

`coreav hls` serves an MP4 or MOV file as HLS, with fragmented MP4 (CMAF) segments, without packaging the file first. It has three subcommands:

* `coreav hls index` lists the source once and writes a small index. Its summary is [`coreav.hls-index/2`](https://github.com/coreav-dev/coreav/blob/main/docs/schema/hls-index-v2.md).
* `coreav hls get` writes one resource (a playlist, an init segment or a media segment) from the index and the source, on request.
* `coreav hls package` builds the index and writes every resource into a directory.

## Examples

```sh theme={null}
coreav hls index input.mp4 input.cavhls
coreav hls get input.cavhls input.mp4 master.m3u8 -
coreav hls package input.mp4 out/
```

[The HLS design note](https://github.com/coreav-dev/coreav/blob/main/docs/design/hls.md) covers segment boundaries, timing and the index.

## Options

```text theme={null}
Serve an MP4/MOV file as HLS with fragmented MP4 (CMAF) segments, without re-encoding

Usage: coreav hls <COMMAND>

Commands:
  index    Build the index that playlists and segments are cut from
  get      Write one resource (`master.m3u8`, `video.m3u8`, `video-init.mp4`, `video-0.m4s`, ...) from an index and its source
  package  Build the index and write every resource into a directory
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help  Print help
```

### coreav hls index

```text theme={null}
Build the index that playlists and segments are cut from

Usage: coreav hls index [OPTIONS] <INPUT> <INDEX>

Arguments:
  <INPUT>  The file to index
  <INDEX>  Where to write the index: a new file, or `-` for standard output

Options:
      --segment-duration <TIME>  Target segment duration in seconds [default: 6]
      --video <STREAM|none>      The video stream index, or `none` for audio alone (default: the first video stream)
      --audio <STREAM|none>      The audio stream index, or `none` (default: the first audio stream)
      --allow <CODEC>            Codecs to accept, comma separated, as for `coreav probe`
      --strict                   Reject the whole file when a stream's codec is not allowed
      --tag <TEXT>               Text stored in the index to identify the source version (for example its entity tag), at most 255 bytes [default: ""]
      --force                    Overwrite INDEX if it exists (a symbolic link is replaced, not written through; the new file keeps the old one's permissions)
  -h, --help                     Print help
```

### coreav hls get

```text theme={null}
Write one resource (`master.m3u8`, `video.m3u8`, `video-init.mp4`, `video-0.m4s`, ...) from an index and its source

Usage: coreav hls get [OPTIONS] <INDEX> <INPUT> <NAME> <OUTPUT>

Arguments:
  <INDEX>   The index built by `coreav hls index`
  <INPUT>   The file the index was built from
  <NAME>    The resource name
  <OUTPUT>  Where to write it: a new file, or `-` for standard output

Options:
      --force  Overwrite OUTPUT if it exists (a symbolic link is replaced, not written through; the new file keeps the old one's permissions)
  -h, --help   Print help
```

### coreav hls package

```text theme={null}
Build the index and write every resource into a directory

Usage: coreav hls package [OPTIONS] <INPUT> <DIR>

Arguments:
  <INPUT>  The file to package
  <DIR>    A new or empty directory for the index and the resources (not `-`: a package is several files; `./-` names a directory called `-`)

Options:
      --segment-duration <TIME>  Target segment duration in seconds [default: 6]
      --video <STREAM|none>      The video stream index, or `none` for audio alone (default: the first video stream)
      --audio <STREAM|none>      The audio stream index, or `none` (default: the first audio stream)
      --allow <CODEC>            Codecs to accept, comma separated, as for `coreav probe`
      --strict                   Reject the whole file when a stream's codec is not allowed
      --tag <TEXT>               Text stored in the index to identify the source version (for example its entity tag), at most 255 bytes [default: ""]
  -h, --help                     Print help
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.