// about
关于 MP4 Analyzer
MP4 Analyzer 是一个完全在浏览器里运行的多媒体容器与码流分析工具:拆 ISOBMFF box 树、看编码单元 QP 热力图、叠运动矢量。不用装软件,文件也不会上传。
一、这个工具做什么
它把一段视频从「容器」一路拆到「编码单元」,让你能看见平时被播放器藏起来的东西:
- 容器层:完整的 ISOBMFF box 树,每个字段带类型、大小与含义, 可直接跳到该 box 的十六进制视图;
- 帧层:按解码顺序列出每一帧的样本偏移、大小、帧类型(I / P / B)、 POC 与参考关系,支持搜索与排序;
- 编码单元层:H.264 / H.265 的 CU 划分、每个块的 QP 热力图与 预测模式,叠加在解出来的画面上;
- 运动矢量层:每个块的 MV 箭头、参考帧索引与列表方向(L0 / L1)。
典型用途是排查画质问题:某一段码率正常但画面发糊,是 QP 给高了、还是预测模式退化成 Intra、还是参考帧选错了 —— 这些在播放器里看不出来,在这里是热力图上的几块颜色。
二、为什么要做它
这套分析能力最早是一个原生 macOS 应用:用 VideoToolbox 做硬件解码,把每帧的编码单元 信息导出来可视化。它跑得很快,但有个绕不过去的限制 —— 只能在装了它的那台 Mac 上用。想给同事看一眼那段异常 GOP,对方得先装 Xcode、编译、再拿到同样的素材。
浏览器的好处正好在这里:把地址发给对方,他打开就看到了。不需要安装、不需要同型号机器、 不需要把素材上传到某个地方。代价是要把整套解析与解码搬到 WebAssembly 上重做一遍 —— 这正是这个项目在做的事。
三、技术上是怎么做到的
三层拼起来:
- 容器解析:一个独立的 MP4 解析器编译成 WebAssembly,负责 ISOBMFF box 树的展开与字段解码;
- 码流解析:FFmpeg 编译成 WebAssembly,负责 H.264 / H.265 的 slice 解析、编码单元划分、QP 提取与运动矢量导出;
- 像素解码:优先走浏览器原生的 WebCodecs 接口(有硬件解码时非常快)。 当浏览器拒绝某条码流时,会自动回落到内置的 FFmpeg 软解把这一帧画出来, 保证「FFmpeg 能解的流就一定能看到画面」。
所有计算都在你的设备上完成,处理过程跑在 Web Worker 里,界面不会被卡住;大文件走 「只装载目标 GOP 所需字节窗口」的路径,而不是把整个文件读进内存。更细的说明见 技术原理。
四、你的文件去了哪里
哪里都没去。本站没有任何文件上传接口,服务器不接收、不存储也不处理 你的视频。你可以把网络断开之后再打开文件,功能完全不受影响 —— 这一点你随时可以自己验证。 细节写在隐私政策里。
五、我们怎么确认结果是对的
分析工具最怕的是「看起来有结果,其实是错的」。所以这个项目里每一个数值导出路径, 都要拿原生 FFmpeg 建一份真值来对拍:
-
导出的像素平面与
ffmpeg解出的yuv420p逐字节比对, 而不只是比最终画面(画面里混进了色度上采样策略这一层变量,会掩盖真实差异); -
运动矢量用
ffprobe -export_side_data mvs -show_frames导出的原生结果对照, 包括「某帧本来就没有 MV」这类边界情况; - 大文件走的两条路径(GOP 字节窗口装载 vs 整文件装载)互为对照, 要求输出完全一致;
- 块级统计在 H.264 与 H.265 素材上各跑一轮回归,数值不允许漂移。
已知边界
写出来,是因为知道边界比假装没有边界更有用:
- 只处理 H.264 / H.265 的块级信息。AV1、VP9 目前只能看容器结构, 没有 QP 与 MV;
- 受浏览器内存上限约束,超过约 1 GB 的文件在手机上跑不动, 桌面端可以但会更慢;
- 帧预览需要从最近的 I 帧逐帧解到目标帧,所以越靠后的帧等待越久(最坏几秒), 页面上有进度提示也可以随时取消;
- 少数编码器产出的码流会被浏览器的解码器整片拒收,此时会回落到内置软解 —— 画面能出来, 但速度明显慢于硬件解码。
六、谁在做这件事
这个工具由 Liu Hang 设计、开发并维护,来自一个很具体的需求: 平时要做码流排查,但手上没有一台随时能装的机器,同事也不一定有同样的环境。 MediaOnDeck 是承载这类「浏览器内媒体工具」的名字,MP4 Analyzer 是第一个。
所有解析逻辑、可视化界面与验证流程都由作者本人实现;技术选型与取舍写在 技术原理页。有任何问题、纠错或功能建议, 欢迎通过联系我们。
七、开源与许可
分析能力基于 FFmpeg(LGPLv3) 构建。依许可要求,本项目使用的 FFmpeg 相关源码与许可证全文已公开: 源码与许可说明。
八、反馈与更正
如果你发现某处结果与原生工具对不上,或者某个文件在本站报错、在别的工具里正常, 这通常意味着我们漏掉了一个边界情况。请把浏览器版本、文件的大致规格(容器 / 编解码器 / 分辨率 / 时长)和看到的报错文案发到 liuhang887654@gmail.com, 我们会核对并更正。我们也会把确认过的问题写进 常见问题,而不只是在邮件里回一句「已修复」。
最后更新:2026 年 10 月 10 日
// about
About MP4 Analyzer
MP4 Analyzer is a media container and bitstream inspector that runs entirely in your browser: an ISOBMFF box tree, per-coding-unit QP heatmaps and motion vector overlays. No install, and your files are never uploaded.
1. What it does
It unpacks a video from the container all the way down to individual coding units:
- Container level — a full ISOBMFF box tree, with every field's type, size and meaning, and a jump straight into the hex view of any box;
- Frame level — sample offset, size, frame type (I / P / B), POC and reference relationships in decode order, with search and sorting;
- Coding-unit level — H.264 / H.265 CU partitioning, a QP heatmap and intra/inter prediction mode per block, drawn over the decoded picture;
- Motion vector level — the MV of every block, its reference frame index and list direction (L0 / L1).
The typical job is diagnosing picture quality. If a section has a normal bitrate but looks soft, is it high QP, a partition that fell back to intra, or a wrong reference choice? None of that is visible in a player — here it is a few coloured blocks on a heatmap.
2. Why it exists
This analysis originally lived in a native macOS app: hardware decoding through VideoToolbox, with per-frame coding-unit data exported for visualisation. It was fast, but it had one hard limitation — it only worked on the Mac it was installed on. Showing a colleague one anomalous GOP meant asking them to install Xcode, build it, and find the same source clip.
A browser fixes exactly that: send a link, and the other person just opens it. No install, no matching hardware, no need to upload the footage anywhere. The price is rebuilding the whole parsing and decoding stack on top of WebAssembly — which is what this project does.
3. How it works
Three layers, stacked:
- Container parsing — a standalone MP4 parser compiled to WebAssembly expands the ISOBMFF box tree and decodes its fields;
- Bitstream parsing — FFmpeg compiled to WebAssembly performs H.264 / H.265 slice parsing, coding-unit partitioning, QP extraction and motion vector export;
- Pixel decoding — the browser's native WebCodecs interface is used first (hardware decoding is very fast). When the browser refuses a bitstream, the tool falls back to the bundled FFmpeg software decoder so that any stream FFmpeg can decode can still be shown.
Everything is computed on your device, the analysis runs in a Web Worker so the interface stays responsive, and large files are handled by loading only the byte window covering the target GOP rather than reading the file into memory. More detail is in How it works.
4. Where your files go
Nowhere. This site has no upload endpoint; the server never receives, stores or processes your video. You can disconnect the network and open a file afterwards — everything still works, and you are welcome to verify that yourself. The details are in the privacy policy.
5. How we verify the numbers
The worst failure mode for an analysis tool is producing plausible-looking output that is wrong. So every numeric export path in this project is cross-checked against ground truth produced by native FFmpeg:
-
Exported pixel planes are compared byte for byte against
ffmpeg'syuv420poutput — not just the final picture, because comparing pictures mixes in the chroma upsampling strategy and hides real differences; -
Motion vectors are checked against native output from
ffprobe -export_side_data mvs -show_frames, including edge cases such as frames that legitimately have no MVs at all; - The two code paths used for large files (GOP byte-window loading vs whole-file loading) are cross-checked against each other and must produce identical output;
- Block-level statistics are regression-tested on both H.264 and H.265 footage, and the numbers are not allowed to drift.
Known limits
These are written down because knowing the limits is more useful than pretending there are none:
- Block-level information is available for H.264 / H.265 only. AV1 and VP9 currently expose container structure but no QP or MVs;
- Because of browser memory limits, files larger than roughly 1 GB will not run on a phone; on desktop they work, but more slowly;
- Frame preview has to decode forward from the nearest I frame, so later frames take longer (a few seconds at worst). There is a progress indicator and you can cancel at any time;
- A few encoder outputs are rejected outright by the browser's decoder. Those fall back to the bundled software decoder — you still get a picture, but noticeably slower than hardware decoding.
6. Who builds it
The tool is designed, built and maintained by Liu Hang, out of a very concrete need: doing bitstream triage regularly, without a machine that is always set up for it and without assuming colleagues have the same environment. MediaOnDeck is the name for this family of in-browser media tools; MP4 Analyzer is the first.
All of the parsing logic, the visualisation UI and the verification workflow are implemented by the author. The technical choices and their trade-offs are documented in How it works. For questions, corrections or feature requests, please get in touch.
7. Open source and licensing
Analysis is built on FFmpeg (LGPLv3). As the license requires, the FFmpeg sources used by this project and the full license are published here.
8. Feedback and corrections
If a number here disagrees with a native tool, or a file fails on this site while working elsewhere, that usually means we missed an edge case. Send your browser version, the rough specs of the file (container / codec / resolution / duration) and the error text you saw to liuhang887654@gmail.com and we will check it. Confirmed issues get written into the FAQ rather than just being answered once by email.
Last updated: October 10, 2026