Encode and mux media output.
Supports file-to-file transcoding and frame-by-frame streaming encoding.
File-to-file transcode
ExCubecl.Transcode.run("input.mp4", "output.mp4",
video: [codec: :h264, bitrate: "4M", fps: 30],
audio: [codec: :aac, bitrate: "192k", sample_rate: 48000]
)Frame-by-frame streaming transcode
{:ok, enc} = ExCubecl.Transcode.start("output.mp4",
video: [codec: :h265, width: 1280, height: 720],
audio: [codec: :aac]
)
ExCubecl.Transcode.write_frame(enc, processed_video_frame)
ExCubecl.Transcode.write_samples(enc, processed_audio_samples)
ExCubecl.Transcode.finish(enc)Supported codecs
Video: h264, h265, vp9, av1, prores Audio: aac, opus, mp3, flac, pcm
Supported containers
mp4, mkv, webm, mov, ts
Summary
Functions
Finalizes encoding and closes the output file.
Transcodes an input file to an output file with the specified options.
Starts a streaming transcoder for frame-by-frame encoding.
Writes a video frame to the encoder.
Writes audio samples to the encoder.
Types
@type encoder() :: reference()
Functions
Finalizes encoding and closes the output file.
Transcodes an input file to an output file with the specified options.
This is a convenience wrapper that opens the input, reads frames, applies encoding, and writes the output.
Options
:video— keyword list with:codec,:bitrate,:fps,:width,:height:audio— keyword list with:codec,:bitrate,:sample_rate
Starts a streaming transcoder for frame-by-frame encoding.
Returns an encoder reference to be used with write_frame/2, write_samples/2,
and finish/1.
Options
:video— keyword list with:codec,:width,:height,:bitrate,:fps:audio— keyword list with:codec,:bitrate,:sample_rate
@spec write_frame(encoder(), ExCubecl.VideoFrame.t()) :: :ok | {:error, term()}
Writes a video frame to the encoder.
@spec write_samples(encoder(), ExCubecl.AudioSamples.t()) :: :ok | {:error, term()}
Writes audio samples to the encoder.