I'm totally new to ffmpeg and use it on windows. I want to encode the audio from a mkv video to opus, using

ffmpeg -i abc.mkv -map 0:v -c copy -map 0:a -c libopus -b:a 128000 xyz.mkv

but I get the error:

invalid encoder type "libopus". 

What am I doing wrong?

1 Answer 1


Just -c on its own will set the encoder for all types of streams: video, audio..etc. libopus can't encode video, obviously. You need to attach a stream specifier to limit it to audio, so

ffmpeg -i abc.mkv -map 0:v -c copy -map 0:a -c:a libopus -b:a 128k xyz.mkv

See the section on stream specifiers and also this answer on how multiple codec settings in a command works.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.