Runs ffmpeg and follows it until it is done.
MuonTrap runs it, so it never outlives
the process that started it, even when the VM itself goes down, and
stopping it is ending that process: MuonTrap terminates ffmpeg, and
kills it if it does not exit.
ffmpeg is expected to report its progress on stdout, with
-progress pipe:1. While it does, it is working. When it says nothing
for timeout, it is taken as stuck and stopped. The export server
cancels a running export by sending {PhoenixReplay.Export, :cancel},
which stops it too.
Summary
Types
Why ffmpeg did not finish: its exit status, that it went quiet, or
that running it failed.
Called with how much of the video is encoded so far, in milliseconds.
Functions
Runs the ffmpeg at executable with args, calling progress as
it encodes. Returns once it exits, is cancelled, or goes quiet for
timeout milliseconds.
Types
@type error() :: {:ffmpeg, pos_integer() | :timeout | :crashed} | :cancelled
Why ffmpeg did not finish: its exit status, that it went quiet, or
that running it failed.
@type progress() :: (non_neg_integer() -> any())
Called with how much of the video is encoded so far, in milliseconds.
Functions
@spec run(Path.t(), [String.t()], progress(), pos_integer()) :: :ok | {:error, error()}
Runs the ffmpeg at executable with args, calling progress as
it encodes. Returns once it exits, is cancelled, or goes quiet for
timeout milliseconds.