# `PhoenixReplay.Export.Encoder`
[🔗](https://github.com/elixir-vibe/phoenix_replay/blob/v0.6.2/lib/phoenix_replay/export/encoder.ex#L1)

Encodes captured screenshots into an H.264 MP4 with `ffmpeg`, which
`PhoenixReplay.Export.FFmpeg` runs.

The screenshots go in through ffmpeg's concat demuxer, each with the
time it lasts, and come out at the schedule's constant frame rate, so a
picture that does not change is captured once and still fills its
frames. The size is rounded down to even pixels, as H.264 needs, and
the index is moved to the front so the video plays while it downloads.

# `progress`

```elixir
@type progress() :: (float() -&gt; any())
```

Called with the share of the video encoded so far, from 0 to 1.

# `shots`

```elixir
@type shots() :: [{Path.t(), pos_integer()}]
```

Each screenshot's path and the frames it lasts, in order. The
screenshots share a directory and have plain names, such as `0.png`,
so the concat list can name them as they are.

# `run`

```elixir
@spec run(shots(), PhoenixReplay.Export.Schedule.t(), Path.t(), map(), progress()) ::
  :ok | {:error, PhoenixReplay.Export.FFmpeg.error()}
```

Encodes `shots` into `path`, reporting progress.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
