---
title: FFmpeg and video
order: 8
summary: Find or download FFmpeg, read video, put sound on a video, write markers.
---

<!-- Generated by tools/generate-docs.bxs from the BIF classes. Do not edit; change the Javadoc and run it again. -->

Find or download FFmpeg, read video, put sound on a video, write markers.

## audioFfmpeg

Find FFmpeg on this computer and say what it can do: OGG, Opus, AAC and video files need it

```js
audioFfmpeg()
```

**Returns** A struct with available, source (configured, installed or system), path, probePath, version, encoders (libvorbis, libopus, aac, libmp3lame, flac that it has), platform, installable (is there a download for this computer), autoInstall (may the module download it by itself), downloadSizeMB and installDir. When the ffmpeg setting points at something that does not run, available is false and problem says why.

## audioFfmpegInstall

Download FFmpeg for this computer into the bx-audio home, checked against a pinned checksum

```js
audioFfmpegInstall( onProgress )
```

| Argument | Type | Default | |
|---|---|---|---|
| `onProgress` | function | optional | A function called as ( name, bytesDone, bytesTotal ) while files download. |

**Returns** A struct with installed, version, path and probePath.

## videoInfo

Describe any audio or video file with FFprobe: length, size, and the video and audio streams

```js
videoInfo( path )
```

| Argument | Type | Default | |
|---|---|---|---|
| `path` | string | required | The media file. |

**Returns** A struct with path, format, seconds, bitrate, sizeBytes, video (codec, width, height, fps; null when there is none), audio (codec, channels, sampleRate; null when none) and streams, the raw stream list.

## audioMux

Put audio on a video file, copying the picture without re-encoding it

```js
audioMux( video, audio, output, keepOriginal=false, originalDb=-12, offset=0, bitrate=0 )
```

| Argument | Type | Default | |
|---|---|---|---|
| `video` | string | required | The video file. |
| `audio` | any | required | The audio buffer. |
| `output` | string | required | Where to write the result. The extension picks the container: mp4, mov, mkv or webm. |
| `keepOriginal` | boolean | `false` | True to keep the video's own audio underneath the new audio. Defaults to false, which replaces it. |
| `originalDb` | double | `-12` | Gain of the original audio when it is kept, in dB. Defaults to -12. |
| `offset` | double | `0` | Seconds to delay the new audio. Defaults to 0. |
| `bitrate` | integer | `0` | AAC (or Opus for webm) bitrate in kbps. 0 means 192. |

**Returns** The absolute path of the written file. The result is never longer than the video.

## audioMarkers

Write markers (points in time with labels) as JSON, CSV, a Resolve EDL, SRT, WebVTT, FFmpeg chapters or a YouTube chapter list

```js
audioMarkers( markers, format="json", path="", fps=30, total=0 )
```

| Argument | Type | Default | |
|---|---|---|---|
| `markers` | array | required | An array of structs with time (seconds), label and optionally duration (seconds; 0 lasts until the next marker). |
| `format` | string | `"json"` | json, csv, edl, srt, vtt, ffmetadata or youtube. Defaults to json. |
| `path` | string | `""` | A file to write the result to as well. Empty to only return the text. |
| `fps` | integer | `30` | Frame rate for EDL timecodes. Defaults to 30. |
| `total` | double | `0` | Length of the whole program in seconds, which ends the last marker. Defaults to 2 seconds after it. |

**Returns** The text of the markers in that format.

