# FFmpeg

Settings for the FFmpeg binary.

## Configuration

{% tabs %}
{% tab title="JSON" %}

```
{
   "ffmpeg": {
      "binary": "ffmpeg",
      "max_processes": 0,
      "access": {
         "input": {
            "allow": [],
            "block": []
         },
         "output": {
            "allow": [],
            "block": []
         }
      },
      "log": {
         "max_lines": 50,
         "max_history": 3
      }
   }
}
```

{% endtab %}

{% tab title="ENV" %}

```
CORE_FFMPEG_BINARY="ffmpeg"
CORE_FFMPEG_MAX_PROCESSES=0
CORE_FFMPEG_ACCESS_INPUT_ALLOW=a,b,c
CORE_FFMPEG_ACCESS_INPUT_BLOCK=a,b,c
CORE_FFMPEG_ACCESS_OUTPUT_ALLOW=a,b,c
CORE_FFMPEG_ACCESS_OUTPUT_BLOCK=a,b,c
```

{% endtab %}
{% endtabs %}

### binary (string)

Path to the `ffmpeg` binary. The system's %PATH will be searched for the ffmpeg binary. You can also provide an absolute or relative path to the binary.

By default this value is set to `ffmpeg`.

### max\_processes (integer)

The maximum number of simultaneously running `ffmpeg` instances. Set this value to `0` in order to not impose any limit.

By default this value is set to `0`.

### access.\*

To control where FFmpeg can read from and where FFmpeg can write from, you can define patterns that matches the input addresses or the output addresses. These patterns are regular expressions that can be provided here. For the respective environment variables the expressions need to be space-separated, e.g. `https?:// rtsp:// rtmp://`.

Independently of the values of `access.output` there's a check that verifies that output can only be written to the directory specified in [storage.disk.dir](https://docs.datarhei.com/core/storage/disk#dir-string) and works as follows: if the address has a protocol specifier other than `file:`, then no further checks will be applied. If the protocol is `file:` or no protocol specifier is given, the address is assumed to be a path that is checked to be inside of `storage.disk.dir`.

It will be rejected if the address is outside the `storage.disk.dir` directory. Otherwise, the protocol `file:` will be prepended. If you want to explicitely allow or block access to the filesystem, use `file:` as pattern in the respective list.

Special cases are the output addresses `-` (which will be rewritten to `pipe:`), and `/dev/null`, which will be allowed even though it's outside of `storage.disk.dir`.

### access.input.allow (array)

List of patterns for allowed inputs.

By default this list is empty, i.e. all inputs are allowed.

### access.input.block (array)

List of patterns for disallowed inputs.

By default this list is empty, i.e. no inputs are blocked.

### access.output.allow (array)

List of patterns for allowed outputs.

By default this list is empty, i.e. all outputs are allowed.

### access.output.block (array)

List of patterns for disallowed outputs.

By default this list is empty, i.e. no outputs are blocked.

### log.max\_lines (integer)

The number of latest FFmpeg log lines for each process to keep.

By default this value is set to `50` lines.

### log.max\_history (integer)

The number of historic logs for each process to keep.

By default this value is set to `3`.
