An MKV file is a video in the Matroska container, a free, open format that can hold almost any kind of video, sound and subtitles in one file. OBS users often record to it because it survives crashes, and many downloaded films and TV episodes come as MKV. VLC plays it on any device, and when you need an MP4 instead, you can usually remux it in seconds with no loss of quality.
What's inside an MKV file
Matroska started in 2002 as an open-source project, and takes its name from Russian nesting dolls (matryoshka). Video files use .mkv; you may also see .mka for audio-only files and .mks for subtitles. WebM, the format browsers use, is a cut-down version of Matroska: see what is WebM.
MKV is only the box. It has no codec of its own, and it's very relaxed about what you put in it:
- Video: most often H.264 or HEVC, but also VP9, AV1 and older codecs.
- Sound: AAC, Dolby Digital (AC-3), DTS, FLAC, Opus and more.
- Several audio tracks, for example different languages, a commentary, or the separate microphone and game sound that OBS can record.
- Subtitle tracks you can switch on and off, plus chapters and attachments such as the fonts used by styled subtitles.
That flexibility is why MKV is popular for films and recordings, and also why it's less widely supported than MP4. Codecs and containers explained covers the difference between the box and what's in it.
Why OBS records to MKV
An MP4 file only becomes playable when the recording stops properly, because that's when the index describing the whole file is written. If OBS crashes, the computer loses power, or the drive fills up first, the MP4 may not open at all. An MKV is written so that everything recorded up to that moment still plays.
That's why OBS warns you about MP4 and recommends recording to MKV, then converting afterwards. You'll find the setting under Settings › Output, in the Recording section, as Recording Format. Newer versions of OBS also offer MP4 variants designed to survive a crash; check that list in your version.
How to play an MKV file
| Device | What to use |
|---|---|
| Windows 10 and 11 | The built-in Media Player plays most MKV files; VLC plays the rest |
| Mac | VLC or IINA, both free. QuickTime Player and iMovie don't open MKV |
| iPhone and iPad | VLC, free in the App Store. The Files and Photos apps won't play MKV |
| Android | VLC, or the phone's own video player, which often handles MKV |
| Smart TVs | Many play MKV from a USB stick, though DTS sound or some subtitles may not work |
If an MKV plays but has no sound, its audio is probably in a format your player can't decode, such as DTS, or the player picked the wrong track. In VLC, try Audio › Audio Track. Video plays but has no sound covers the fixes.
Convert MKV to MP4 without losing quality
Most MKV files hold H.264 or HEVC video with AAC sound, which MP4 supports too. So you can remux: copy the video and sound into an MP4 container without re-encoding. It takes seconds, even for a long recording, and the quality is identical.
In OBS
- Choose File › Remux Recordings.
- Click the … button in the OBS Recording column and pick your MKV. You can also drag several files into the list.
- The Target File fills in automatically, ending in .mp4.
- Press Remux.
To have OBS do this every time you stop recording, go to Settings › Advanced and, under Recording, tick Automatically remux to mp4 (the exact wording varies a little between versions).
With FFmpeg
ffmpeg -i input.mkv -c copy output.mp4
By default, FFmpeg copies the video and one audio track, and leaves subtitles out. For an OBS recording with several audio tracks, add -map 0 to keep them all:
ffmpeg -i input.mkv -map 0 -c copy output.mp4
Be aware that many editors and upload sites only use the first audio track of an MP4.
To convert a whole folder at once on a Mac or Linux:
for f in *.mkv; do ffmpeg -i "$f" -c copy "${f%.mkv}.mp4"; done
And in Windows Command Prompt:
for %f in (*.mkv) do ffmpeg -i "%f" -c copy "%~nf.mp4"
(In a .bat file, write %%f instead of %f.)
With an app
LosslessCut, a free app for Windows, Mac and Linux, can remux without the command line: open the MKV, choose MP4 as the output format, and export. HandBrake can also turn MKV into MP4, but it always re-encodes the video, so it's slower and only worth it when you need a different codec.
When remuxing to MP4 fails
"Could not find tag for codec subrip… codec not currently supported in container"
The MKV has text subtitles (here, SRT) that MP4 can't hold as they are. Convert them to MP4's own subtitle format:
ffmpeg -i input.mkv -map 0 -c copy -c:s mov_text output.mp4
Or leave them out with -sn instead of -c:s mov_text. Picture-based subtitles from Blu-ray discs (PGS) can't be converted this way; leave them out, or keep the MKV.
"Could not find tag for codec ttf…"
The file has fonts attached, which MP4 can't store. Add -map -0:t after -map 0 to drop the attachments:
ffmpeg -i input.mkv -map 0 -map -0:t -c copy -c:s mov_text output.mp4
The MP4 is made, but has no sound on some devices
The audio is probably DTS, Dolby Digital, FLAC, Opus or Vorbis. Recent versions of FFmpeg will copy all of these into an MP4, but many players can't play them there. Copy the video and convert just the sound to AAC:
ffmpeg -i input.mkv -c:v copy -c:a aac -b:a 192k output.mp4
The MP4 won't play on a Mac or iPhone
If the video is HEVC, add -tag:v hvc1 to the remux command. MKV doesn't store the label Apple's players look for, so FFmpeg uses a different one by default, and QuickTime and iPhones may refuse the file. If the video is something Apple devices don't play well, such as VP9 or an older codec, re-encode it to H.264:
ffmpeg -i input.mkv -c:v libx264 -crf 20 -preset medium -c:a aac -b:a 192k output.mp4
Should you keep MKV or convert?
Keep MKV for archiving recordings and films, especially with several audio tracks or subtitles, and for anything you watch in VLC or another player that handles it.
Convert to MP4 when you need to edit the video in an app that doesn't import MKV (iMovie, for one), upload it somewhere that asks for MP4, or play it on an iPhone, iPad or older TV.
If you've recorded a tutorial or demo as several MKV takes and want them as one video, you don't have to remux first: ClipMerge reads MKV files directly and saves the joined takes as one MP4. For joining takes losslessly with FFmpeg, see how to merge videos with FFmpeg.