Skip to content

Codec\AudioCodec

A string-backed enum naming the audio encoder for MediaEncoder::addAudio(). The backing value is the FFmpeg encoder name (or "copy"), so the choice is an output decision that lives on the addAudio() call — not on the stream.

CaseBacking valueNotes
AACaacFFmpeg’s native AAC encoder (always available).
MP3libmp3lameRequires FFmpeg built --enable-libmp3lame.
OpuslibopusRequires --enable-libopus.
FLACflacLossless; native encoder.
CopycopyStream-copy / remux — no re-encode.

If the chosen encoder isn’t built into the running FFmpeg, save() throws EncoderNotFoundException.

use FFmpeg\Codec\AudioCodec;
AudioCodec::AAC->value; // "aac"
$encoder->addAudio($stream, AudioCodec::Copy); // remux, no re-encode

MediaEncoder · VideoCodec

An Artisan Build project.

Built on FFmpeg — an independent binding, not affiliated with or endorsed by the FFmpeg project.

Proudly sponsored by Tighten.