Ffmpeg - Output Format - Matroska

From PiRho Knowledgebase
Revision as of 15:53, 14 March 2026 by Dex (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The Matroska container format (`.mkv`) is one of the most flexible and widely‑supported multimedia containers available. Ffmpeg fully supports reading and writing Matroska files — but users frequently encounter the error:

> "'.mkv' is not a suitable output format"

This error is rarely caused by Matroska itself. Instead, it almost always indicates a mismatch between the output container, the selected codecs, and Ffmpeg’s muxer capabilities.

Overview

Matroska (MKV) can hold video, audio, subtitles, chapter data, and attachments.

Why the Error Appears

  • Incorrect output arguments
  • Codec and container mismatch
  • Incorrect parameter ordering

Correct Usage Examples

``` ffmpeg -i input.mp4 -c:v libx264 -c:a aac output.mkv ffmpeg -i input -c copy output.mkv ffmpeg -i input -f matroska -c copy output.mkv ```

Troubleshooting

  • Force muxer: `-f matroska`
  • Re-encode to compatible codecs
  • Remove unsupported streams
  • Fix timestamps: `-fflags +genpts`

References