Matroska Video
Convert MKV files to MP4, WebM, or MOV directly in your browser — no upload, no server, no quality loss on remux. FileDex uses FFmpeg WASM to remux or transcode Matroska containers locally, preserving video, audio, and subtitle tracks.
ملفاتك لا تغادر جهازك
أسئلة شائعة
How do I convert MKV to MP4 without losing quality?
Use stream copy (remux) when your MKV contains H.264 or H.265 video with AAC audio. FileDex performs this automatically — the data transfers between containers without re-encoding, so output is bit-identical to the source. If the MKV contains FLAC or DTS audio, only the audio track requires transcoding to AAC.
Why won't my MKV file play on iPhone or Apple TV?
Apple devices do not support the MKV container natively. Convert to MP4 using FileDex (stream copy if codecs are compatible) and the same video will play on iOS, iPadOS, and tvOS without quality loss.
What is the difference between MKV and MP4?
Both are containers that hold video, audio, and subtitle tracks. MKV supports virtually every codec (TrueHD, FLAC, DTS-HD, ASS subtitles) and is preferred for archival. MP4 has a restricted codec set but is accepted by all platforms, devices, and social media upload endpoints.
Can I keep subtitles when converting MKV to MP4?
Text-based subtitles (SRT) can be preserved as a separate track in MP4. ASS/SSA styled subtitles must be either burned into the video frame (hardcoded) or converted to SRT, losing formatting. FileDex can extract subtitle tracks as standalone SRT files.
Is MKV the same as WebM?
WebM is a restricted profile of the Matroska container. It uses the same EBML structure but limits codecs to VP8/VP9/AV1 video and Vorbis/Opus audio. An MKV file with VP9+Opus can be renamed to .webm and play in browsers.
ما يميز .MKV
Matroska is an open, royalty-free container format that can hold virtually any combination of video, audio, subtitle, and attachment streams in a single file. Named after the Russian matryoshka nesting dolls, the format launched in 2002 as a community-driven alternative to proprietary containers like AVI and ASF. It has since become the default output of tools like HandBrake, MKVToolNix, and most media ripping software.
اكتشف التفاصيل التقنية
EBML foundation
Matroska uses EBML (Extensible Binary Meta Language), a binary XML derivative where every element has a variable-length ID and size field — the same structural principle used by WebM, which is a restricted Matroska profile. EBML elements nest hierarchically. A Segment element contains Tracks, Clusters, Cues, Chapters, and Attachments as children. Each child has an ID encoded in 1–4 bytes (shorter IDs for common elements, longer for rare ones) and a size field using a variable-length integer scheme called VINT. This design keeps overhead low while supporting files of arbitrary length — the maximum theoretical size exceeds 16 exabytes.
The EBML header at byte zero declares the DocType (matroska or webm) and the EBML version, so parsers know immediately what they are dealing with.
Cluster-level resilience
MKV splits media data into Clusters, each starting with a timestamp. Inside each Cluster, SimpleBlock or BlockGroup elements hold individual frames with relative timestamps. Every Cluster is a self-contained parsing unit. If a Cluster is corrupted, the parser can skip to the next one by scanning for the Cluster element ID (0x1F43B675). This distributed structure means a recording interrupted by a crash typically loses only the final incomplete Cluster — seconds of footage, not the entire file.
The Cues element serves as the seek index, mapping timestamps to byte positions of Clusters. MKVToolNix writes Cues at the file's start by default, enabling instant seeking without downloading the entire file.
Track and codec flexibility
| Track Type | Common Codecs | Notes |
|---|---|---|
| Video | H.264, H.265, VP9, AV1 | Multiple video tracks supported (e.g., 3D) |
| Audio | AAC, FLAC, Opus, DTS, TrueHD | Unlimited tracks with language tags |
| Subtitles | SRT, SSA/ASS, PGS, VobSub | Styled subtitles with fonts embedded as attachments |
| Attachments | TTF/OTF fonts, cover art | Stored in the Attachments master element |
MKV carries codec-specific initialization data (CodecPrivate) that preserves decoder configuration. This matters for H.265, where the VPS/SPS/PPS parameter sets must reach the decoder before the first frame.
Chapters and editions
MKV supports a full chapter system with nested chapters, multiple named editions (e.g., theatrical cut vs. director's cut), and per-chapter language titles. An Ordered Edition can rearrange playback order, skipping or looping segments — a feature no other mainstream container offers.
File size and overhead
Container overhead for a typical 2-hour movie with one video, two audio, and three subtitle tracks is approximately 2–5 MB. The EBML encoding is compact: a Cluster header is 12 bytes, a SimpleBlock header is 4 bytes plus the frame data. For a 24 fps video, that is under 100 bytes/second of structural overhead.
When to choose MKV over MP4
Pick MKV when you need multiple audio tracks with different languages, styled ASS subtitles, embedded fonts, chapter markers, or lossless audio codecs like FLAC or TrueHD that MP4 does not officially support. For web delivery and mobile playback, MP4 remains more compatible — iOS Safari and many Android apps handle MP4 natively but need third-party players for MKV.
FileDex converts MKV to MP4, WebM, or other formats in your browser, remuxing when codecs are compatible to avoid re-encoding.
حوّل .MKV إلى...
المرجع التقني
- نوع MIME
video/x-matroska- Magic Bytes
1A 45 DF A3EBML header signature shared with WebM.- المطوّر
- Matroska.org
- سنة التقديم
- 2002
- معيار مفتوح
- نعم — عرض المواصفات
EBML header signature shared with WebM.
البنية الثنائية
MKV files use EBML (Extensible Binary Meta Language), a binary XML-like format. Each element has a variable-length ID (1-4 bytes), a variable-length size descriptor, and payload data. The file opens with an EBML Header element (ID 1A 45 DF A3) declaring the EBML version and DocType ('matroska' or 'webm'). The Segment element (ID 18 53 80 67) wraps all content and contains: SeekHead (element index for fast seeking), Info (duration, timecode scale, muxing app), Tracks (codec IDs, track types, default flags), Chapters, Tags, Attachments (fonts, cover art), Cues (keyframe index for seeking), and Clusters (actual audio/video frames). Clusters contain Blocks or SimpleBlocks with track number, timecode offset, and frame data. Unlike ISOBMFF, EBML elements can be written sequentially without knowing final size (using unknown-size elements), making MKV suitable for live streaming capture.
| Offset | Length | Field | Example | Description |
|---|---|---|---|---|
0x00 | 4 bytes | EBML Header ID | 1A 45 DF A3 | Magic bytes identifying an EBML document. Same for MKV and WebM. |
0x04 | 1-8 bytes | EBML Header Size | 01 00 00 00 00 00 00 23 | VINT (variable-length integer) encoding the size of the EBML header payload. |
variable | variable | EBMLVersion | 42 86 81 01 | EBML element declaring the EBML version used (typically 1). |
variable | variable | DocType | 42 82 88 6D 61 74 72 6F 73 6B 61 (matroska) | String declaring the document type. 'matroska' for MKV, 'webm' for WebM. |
variable | 4 bytes | Segment ID | 18 53 80 67 | Marks the start of the Segment element containing all media data and metadata. |
نقاط الضعف
- Malformed EBML element with oversized VINT length field causes unbounded memory allocation in parsers that trust the declared size before reading payload data
- Crafted Attachment element embedding executable content (e.g., .exe disguised as font file) — extracted by media servers that auto-extract attachments
- Circular SeekHead references causing infinite parser loop and denial-of-service in streaming applications
- Oversized Cues element with millions of index entries exhausting memory on devices with limited RAM (smart TVs, embedded players)
الحماية: FileDex processes MKV files entirely in-browser via FFmpeg WASM inside a Web Worker sandbox. No file data leaves the device. The WASM runtime operates within browser memory limits, preventing unbounded allocation from malformed EBML elements. Attachments are never extracted to disk.