Video Formats Is There a Best Video File Format? 10 Top Video Formats 5 Ways to Change Videos to Any Format Lossless Video Format: 7 Popular Formats and How to Choose All You Need To Know About MP4 To MOV Conversion Choosing Your Codec: AVC (H.264) vs. HEVC (H.265) Decoding the Future: x264 vs. x265 Mastering HEVC: The Future-Ready Video Compression Standard Pixel Perfect: H.264 VS H.265 Explained FFmpeg: Features, Use Cases, and Pros/Cons You Should Know VP9 vs. H.264 What Are Container File Formats (Media Containers)? VP8 vs VP9: 8 Key Differences and How to Choose What Is the M4A Format? | M4A vs. MP3 vs. WAV What Is MPEG-DASH? And MPEG-DASH vs. HLS What Are Video Subtitles? Common Formats and Best Practices H.264 Video Encoding: How It Works, Benefits, and 9 Best Practices QuickTime File Format (MOV): Apple’s MPEG-4 Predecessor MP4 Format (MPEG-4 Part 14): How It Works, Pros and Cons MKV Format: How It Works and How It Compares to MP4 AVI Format: Should You Still Use AVI? Windows Media Video (WMV) Format: What You Should Know HD Format: History of HD Video and 8 Formats You Should Know M4V Format: How It Works and MP4 vs. MPV FLV Format: Security Concerns and 5 Reasons to Switch to MP4 Top Six Web-Video Formats of 2024 What Is Video Transcoding? Video Frame Rates Explained Along With Tips for Picking the Right FPS A Primer on Video Codecs Open-Source and Royalty-Free AV1 Compresses Video Efficiently and Effectively Convert Video Formats: Six Essential Features of Video-Conversion Tools OGG Format: An In-Depth Look WebM Format: Basic Facts, Compatibility, and WebM vs. MP4

MKV Format: How It Works and How It Compares to MP4

mkv to mp4

What Is MKV Format (Matroska Video File)?

Matroska Multimedia Container is a free and open container video format that allows you to store an unlimited number of video, audio, image or subtitle tracks in a single file.

MKV is a universal format for storing multimedia content such as movies and TV shows. Although it is similar to other containers such as AVI, MP4, and Advanced Systems Format (ASF), its specifications are fully open and its implementation consists mostly of open source software.

MKV is supported by a non-profit organization called Association Loi 1901. It is a royalty-free standard provided under the GNU L-GPL license. MKV analysis and playback libraries are provided under the BSD license for commercial enterprise use.

The Matroska file extension is .mkv for video (which may also contain subtitles or audio), .mk3d for stereoscopic video, .mka for audio-only files, and .mka for subtitles only.

In this article:

MKV Format: History and Goals

Launched in December 2002, the Matroska project split from the Multimedia Container Format (MCF) after a disagreement between Steve Lhomme and Lasse Kärkkäinen, the lead developer of MCF, regarding the use of Extensible Binary Meta Language (EBML). Lhomme founded Matroska and many developers moved to the new project in response to the MCF lead developer’s break from coding.

The developers of Matroska emphasized the advantages of using EBML rather than a different binary format. These include making the format more future-proof and easier to extend to accommodate changing goals and new developments. The MKV format’s design considers extensibility and longevity, unlike other formats like AVI.

Matroska team members have openly discussed the project’s long-term goals on hydrogenaudio.org and doom9.org. The project aims to create a modern, extensible, flexible container format that works across multimedia platforms. It also seeks to provide strong streaming support, specialized file creation and editing tools, development support libraries to extend Matroska support to applications, and EBML-based menus.

The Matroska team collaborates with third-party hardware manufacturers to embed Matroska support in various multimedia devices. The project also encourages operating systems to offer native support for Matroska.

“Video

Why is MKV called Matroska?

MKV is called Matroska as an analogy to the traditional Russian matryoshka dolls. Similar to these dolls which contain smaller ones inside, a Matroska file can hold many different media types (like audio, video, and subtitles) within one file. Just as the nested doll opens to reveal multiple other dolls, the Matroska container can hold multiple media elements.

MKV File Format Technical Deep Dive

Matroska introduces several constraints to the EBML header’s specification:

  • The document type (docType) must be Matroska.
  • The maximum ID length (EBMLMaxIDLength) is 4.
  • The maximum size (EBMLMaxSizeLength) must be from 1 to 8.

The top-level elements must all be coded in four octets, according to the following principles:

  • Language codes – versions 1-3 of Matroska use language codes with the three bibliographic ISO-639-2 form letters (i.e., “eng” for English) and an optional country code (i.e., “eng-ca” for Canadian English). From version 4 and up, Matroska supports both ISO 639-2 and BCP 47 MAY for language codes, although the latter is the recommended option.
  • Physical types – these mean different things for video and audio files. For instance, a ChapterPhysicalEquiv of 60 means DVD, VHS, and laserdisc for video. However, it means CD (12, 10, and 7 inches), tape, minidisc, and DAT for audio.
  • Block structure—the block header includes information about the type of lacing, timestamps, track number, etc.
  • Lacing – this mechanism saves space when storing the data for small data use cases like individual frames.
  • Simple block structure – based on the block structure, this structure adds “discardable” and “keyframe” flags.

Matroska documents must comprise at least one EBML document of the Matroska document type. Every EBML document starts with an EBML header, followed by an EBML root element defined as a segment – various top-level elements can occur within a segment.

EBML involves a system of “elements” for composing a document. Matroska defines the following as top-level elements in a Matroska file:

  • EBML document – the file’s wrapper.
  • EBML header – contains the file’s header information, such as the document type, etc.
  • Segment – the top element containing the rest of the top-level elements.
  • Seek head – defines the position of the segments of different top-level elements.
  • Info – provides general information about the segment.
  • Tracks – an information element describing various tracks.
  • Chapters – an element defining basic menu and partition information.
  • Cluster – contains the block structure.
  • Cues – an element containing all the segment’s local entries.
  • Attachments – an element containing any attached files.
  • Tags – an element containing metadata to describe tracks, editions, chapters, attachments, or the overall segment.

mkv to mp4

MKV vs. MP4: 4 Key Differences

What is MP4 Format

What is an MP4 video file? MP4 stands for MPEG-4 Video file. Developed by the Moving Pictures Experts Group (MPEG) and released in 2001, it’s a compressed file format that can contain video, audio, subtitles, and still images. MP4s are one of the most common video file formats used for downloading and streaming videos from the internet. They use the MPEG-4 encoding algorithm to store video and audio files and text, offering lower definition than some other formats.

MP4 in Everyday Use 

MP4 format video  is popular for storing videos on devices, including smartphones, tablets, and digital cameras. These devices are commonly used for recording and viewing MP4 files. MP4 files are typically encountered when downloading a video from the internet or using a DVD ripping program. You can determine if your video is in MP4 format video by right-clicking on the video on your computer and selecting ‘Properties’. The easiest way to play an MP4 file is to double-click on it.

1. Video Quality

Both MKV and MP4 container formats can provide high-quality video playback. The video quality itself is not determined by the container format but rather by the video codec used to compress the video data.

Both formats support a wide range of codecs, including popular ones like H.264 and H.265 (HEVC). Therefore, video quality is mostly dependent on the codec used and the compression settings, rather than the container format itself.

2. File Size

File size is also influenced by the codec used and the compression settings. However, MKV is known to support lossless video compression, which can result in larger file sizes but better video quality preservation.

MP4, on the other hand, is more commonly associated with efficient compression that leads to smaller file sizes, making it more suitable for streaming and sharing on the internet. In general, the file size will depend on the codec and compression settings chosen for a particular video, rather than the container format itself. MP4 files are typically less than 100 MB when using the h.264 codec, while MKV is known to support lossless video compression, which can result in larger file sizes but better video quality preservation.

When thinking “what is mp4 video”, it’s important to note that MP4 files, due to their high compression, typically result in smaller file sizes compared to MKV. This makes MP4 particularly suitable for streaming and sharing on the internet. The high compression also contributes to MP4’s popularity as a standard video format on the web.

3. Video and Audio Codecs Supported

MKV is an open standard format, which means it supports a wide variety of video and audio codecs, including popular ones like H.264, H.265, VP9, and AV1 for video, and MP3, AAC, AC3, DTS, and FLAC for audio. The flexibility of MKV allows it to store multiple video, audio, and subtitle tracks in a single file, making it a popular choice for high-quality video playback and media storage.

MP4 is based on the MPEG-4 standard and supports a more limited set of video and audio codecs compared to MKV. For video, it primarily supports codecs like H.264, H.265, and MPEG-4 Part 2. For audio, it supports codecs such as AAC, MP3, and Apple Lossless Audio Codec (ALAC). While MP4’s codec support is more limited than MKV’s, it still covers the most commonly used codecs, making it a practical choice for most users.

4. Compatibility

MP4 enjoys more extensive compatibility across various devices and platforms, such as smartphones, tablets, gaming consoles, and smart TVs. Additionally, MP4 format videos can store extensive metadata, such as title, author, and copyright information, which aids in organizing and categorizing content. Its wide acceptance is due to its efficient compression and the fact that it is an international standard. MP4 is also the preferred format for video sharing platforms like YouTube and Vimeo, as well as for streaming services.

MKV, while being an open standard and supporting more codecs, has slightly less compatibility with devices and platforms compared to MP4. Although many media players and software support MKV playback, there may still be instances where compatibility issues arise, especially with older devices or systems. However, the gap in compatibility is continually narrowing as more devices and platforms adopt support for the MKV format.

Pros and Cons of MKV and MP4

MKV Pros and Cons

Pros of MKV:

  • Versatility: MKV supports a wide range of codecs, making it compatible with various media players and devices.
  • Multiple streams: It can contain multiple video, audio, and subtitle tracks in a single file, making it convenient for users who prefer different languages or subtitle options.
  • Chapter support: The format supports chapter points, allowing users to easily navigate through the video file.
  • Open-source: MKV is an open-source project, which means its development is driven by the community, ensuring continuous improvements and updates.
  • Error recovery: The format is more resistant to corruption, and in case of file errors, it is usually easier to recover the playable content.

Cons of MKV:

  • Compatibility: Despite its versatility, MKV is not universally supported by all devices and media players, which can sometimes require additional software or conversion.
  • File size: High-quality video and audio in MKV files can result in larger file sizes compared to other formats like MP4 or AVI.
  • Limited metadata support: MKV does not support extensive metadata as some other formats, which can make it less desirable for certain applications.
  • Encoding and decoding: Some video editing software may not support MKV, requiring conversion before editing. Additionally, hardware acceleration for encoding and decoding MKV files may not be as widely supported as other formats.
  • Lack of DRM support: MKV does not support digital rights management (DRM) natively, which may limit its use for distributing copyrighted or protected content.

MP4 Pros and Cons

Pros of MP4:

  • Compatibility: MP4 is widely supported by various devices, operating systems, and media players, making it a popular choice for video sharing and streaming.
  • Compression: The format uses advanced video and audio codecs, such as H.264 and AAC, which provide good quality at relatively smaller file sizes.
  • Streaming: MP4 supports progressive playback and adaptive streaming, allowing users to watch videos while they’re being downloaded or adapt to different bandwidths in real-time.
  • Metadata support: MP4 files can store extensive metadata, including title, author, and copyright information, which can be useful for organizing and categorizing content.
  • DRM support: MP4 natively supports digital rights management (DRM), making it suitable for distributing copyrighted or protected content.

Cons of MP4:

  • Limited codec support: MP4 supports a more limited range of codecs compared to other container formats like MKV, which can restrict its use in certain scenarios.
  • Single subtitle track: MP4 typically supports only one embedded subtitle track, which might be inconvenient for users who prefer multiple language options.
  • Less error recovery: MP4 files are more prone to corruption compared to formats like MKV, and recovery of corrupted files can be more challenging.
  • Lossy compression: Although MP4 offers good quality at smaller file sizes, its compression is lossy, which means some data is discarded during encoding, potentially resulting in lower quality compared to lossless formats.

Pros of MP4 include its high compression and quality, making it flexible for various uses. However, a notable disadvantage is the intensive ability required for encoding and decoding, which might be a consideration for users with limited processing power.

Automated Video Format Conversion With Cloudinary

Cloudinary offers a versatile, effective, and efficient solution for managing media, replete with dynamic, automated optimization and delivery features. For example, setting the fetch_format parameter to auto (f_auto in URLs) causes Cloudinary to automatically select the format and codec based on the requesting browser. Chrome users would most likely receive a VP9-encoded WebM file; Safari users, an HEVC-encoded MP4 file. If a browser does not support either of those formats, Cloudinary delivers the video as an H.264-encoded MP4 file, which works in almost all browsers.

Interested? Have a try for free by first signing up for a free Cloudinary account.

QUICK TIPS
Kimberly Matenchuk
Cloudinary Logo Kimberly Matenchuk

In my experience, here are tips that can help you better understand and leverage the MKV format, especially in comparison to MP4:

  1. Choose MKV for complex multimedia projects
    MKV’s ability to store multiple audio, video, and subtitle tracks in a single file makes it ideal for projects requiring multilingual support or multiple subtitle options, such as DVD or Blu-ray rips. Use MKV when you need a versatile container for these advanced features.
  2. Use MP4 for maximum device compatibility
    MP4 is universally supported across a wide range of devices and platforms. If you need to ensure that your video will play on virtually any device, such as smartphones, tablets, or gaming consoles, MP4 is your best choice.
  3. Take advantage of MKV’s chapter support
    If your video requires detailed navigation, such as educational videos, tutorials, or long-form content like movies, MKV’s chapter support can enhance the user experience by allowing easy access to specific sections of the video.
  4. Optimize for streaming with MP4
    MP4’s efficient compression makes it ideal for streaming over the web. Its support for adaptive bitrate streaming ensures smooth playback across different network conditions, making it the preferred format for platforms like YouTube and Vimeo.
  5. Consider file size and quality trade-offs
    While MKV can handle lossless video, resulting in larger file sizes, MP4 is better suited for scenarios where file size and bandwidth are concerns. Use MP4 for smaller files without sacrificing too much quality, which is especially important for mobile or low-bandwidth users.
  6. Use MKV for archival and backup
    The MKV format’s robustness and error recovery capabilities make it an excellent choice for archiving and backing up video content. If maintaining the highest possible video quality is your priority, MKV’s support for lossless codecs is advantageous.
  7. Be aware of software compatibility
    Not all video editing software fully supports MKV. If you plan to edit your videos, ensure your software can handle MKV files, or consider converting them to MP4 beforehand to avoid workflow interruptions.
  8. Leverage Cloudinary for format conversion
    Use Cloudinary’s automated format conversion tools to seamlessly convert between MKV and MP4. This is especially useful when you need to optimize videos for different devices or platforms without manually handling multiple file versions.
  9. Embed metadata in MP4 for better content organization
    MP4’s extensive metadata support allows you to embed information like titles, descriptions, and tags directly into the file. This is beneficial for organizing and categorizing large video libraries, especially in content management systems.
  10. Experiment with different codecs for specific use cases
    While MKV supports a broader range of codecs, MP4’s focus on widely accepted codecs like H.264 and H.265 can make your content more accessible. Test different codecs within these containers to find the best balance of quality, compatibility, and file size for your specific needs.

These tips should help you make informed decisions when choosing between MKV and MP4, ensuring your video content is optimized for both quality and compatibility across different platforms and devices.

Last updated: Aug 31, 2024