// alternatives / mp4info
mp4info 替代方案
mp4info 是 Bento4 命令行套件里的一个工具,用来打印 MP4 里各条轨道与编解码参数; 同族的 mp4dump 会把整棵 atom/box 结构全部列出来。 它们是 Box 结构查看的事实标准,而且免费——所以这一页不是「我比它好」,而是「什么时候该用它、什么时候用浏览器更快」。
一、mp4info / mp4dump 是什么
Bento4 是 Axiomatic Systems 的 C++ SDK 与命令行工具集,用于读写 ISO-MP4 与 DASH/HLS/CMAF 相关格式。 它是跨平台的(Homebrew、MacPorts、Nix、Alpine、Scoop、winget 都有包),采用 GPLv2 与商业授权的双许可模式。 与 Box 结构相关的常用工具是:
| 工具 | 作用 |
|---|---|
| mp4info | 高层信息:轨道列表、编解码器、时长、码率等 |
| mp4dump | 完整 atom/box 结构,含各层的类型、大小与偏移 |
| mp4extract | 把某个 box 从文件里提取出来 |
| mp4edit | 增删改 box,用来做修复或裁剪 |
安装一行就够:
brew install bento4 # macOS / Linux scoop install main/bento4 # Windows winget install --id AxiomaticSystems.Bento4 -e
二、命令行真正赢的地方
- 可脚本化。mp4dump --format=json 的输出可以直接喂给 jq 或你的脚本,做批量核对、生成报表。
- 可进 CI。构建流水线里可以断言「每个交付文件的 moov 必须在 mdat 之前」之类规则,本工具做不了这件事。
- 精确偏移。输出的是文件里的真实字节偏移,拿去和其它十六进制工具交叉验证非常直接。
- 能改。mp4edit 与 mp4extract 不只读,还能写——浏览器出于安全边界不可能给你这个能力。
- 批量。一条 for 循环处理几百个文件,几秒跑完。
三、命令行的代价
- 要先装上。在自己机器上是一行命令;在客户机器、公司锁死的笔记本、平板上就不是了。
- 要记住参数。只是「看这个文件对不对」的时候,敲命令的成本高于点一下。
- 看不到画面。Box 结构对了不代表团数据没问题,命令行不会告诉你第 181 帧的 QP 分布如何。
- 没有交互。不能点开一个 box 看它的字段树与 Hex,只能读文本输出。
四、同样的文件,四种看法
mp4info video.mp4 # 轨道与编解码概览 mp4dump --verbosity 2 video.mp4 # 完整 box 树(含字段) mp4dump --format=json video.mp4 | jq . # 给脚本用 MP4Box -info video.mp4 # GPAC 的等价物
这四条命令覆盖的是「容器层」。而 本工具的 Box 树 提供的是同一份数据的可点击版本: 展开任意节点看字段树与二进制 Hex,省掉记参数这一步,代价是无法批处理。
五、对照表
| 能力 | mp4info / mp4dump | MP4 Analyzer |
|---|---|---|
| 完整 Box 树 | 有(文本 / JSON) | 有(交互树) |
| 字段树与逐字节 Hex | 部分(文本输出) | 有(点开即看) |
| 脚本 / CI / 批处理 | 有 | 不支持(尚未提供) |
| 修改文件(编辑 box) | 有(mp4edit) | 不做,也不会做 |
| 块级 QP / 运动矢量 | 无 | 有 |
| 是否需要安装 | 需要 | 不需要 |
| 文件是否离开本机 | 否 | 否(纯客户端) |
六、怎么选
| 你的任务 | 选 |
|---|---|
| 批量核对 / 生成报表 / 接进 CI | mp4dump --format=json |
| 修改或裁剪文件、提取某个 box | mp4edit / mp4extract |
| 修一个陌生的 MP4,想点着看结构 | 本工具 |
| 顺手确认容器对不对,同时还要看某一帧的块数据 | 本工具(一个窗口里两件事都做了) |
| 在不方便装软件的机器上 | 本工具 |
顺带一提:如果你要的是纯粹的图形化 Box 查看器,GPAC 的 MP4Box -info 与本工具是同一个问题的两种解法, 区别仍然在「装」与「不装」。更完整的横向对比见 同类工具对比。
// alternatives / mp4info
mp4info alternative
mp4info is one tool in Bento4's command-line suite: it prints the tracks and codec parameters inside an MP4. Its sibling mp4dump prints the entire atom/box structure. Between them they are the de facto reference for box inspection, and they are free — so this page is not "we are better", it is "here is when to use which".
1. What mp4info and mp4dump are
Bento4 is Axiomatic Systems' C++ SDK and tool suite for ISO-MP4 and DASH/HLS/CMAF workflows. It is cross-platform (packaged for Homebrew, MacPorts, Nix, Alpine, Scoop and winget) and dual-licensed under GPLv2 with a commercial option. The box-related tools you will actually use:
| Tool | What it does |
|---|---|
| mp4info | High-level info: track list, codecs, duration, bitrate |
| mp4dump | The full atom/box structure, with type, size and offset at every level |
| mp4extract | Pull a single box out of the file |
| mp4edit | Add, insert, remove or replace boxes — used for repair and trimming |
Installing is one line:
brew install bento4 # macOS / Linux scoop install main/bento4 # Windows winget install --id AxiomaticSystems.Bento4 -e
2. Where the command line genuinely wins
- Scriptable. mp4dump --format=json pipes straight into jq or your own tooling for batch checks and reports.
- CI-friendly. You can assert rules like "moov must precede mdat in every deliverable" in a build pipeline. This tool cannot do that.
- Exact offsets. The output is real byte offsets in the file, which makes cross-checking against other hex tools trivial.
- It can write. mp4edit and mp4extract modify files; a browser cannot offer that, for good security reasons.
- Batch. One shell loop handles hundreds of files in seconds.
3. What the command line costs you
- You have to install it. One line on your own machine; not an option on a client's machine, a locked-down laptop or a tablet.
- You have to remember flags. When the question is just "is this file sane", typing beats clicking only if you already know the command.
- No picture. A correct box structure does not mean the payload is fine. The CLI will not tell you the QP distribution of frame 181.
- No interactivity. You cannot click a box and see its field tree and hex together; you read text.
4. The same file, four ways
mp4info video.mp4 # tracks and codec overview mp4dump --verbosity 2 video.mp4 # full box tree, with fields mp4dump --format=json video.mp4 | jq . # for scripts MP4Box -info video.mp4 # GPAC's equivalent
All four cover the container layer. This tool's box tree offers the same data in a clickable form: expand any node to see its field tree and a byte-level hex dump, at the cost of no batch mode.
5. Side by side
| Capability | mp4info / mp4dump | MP4 Analyzer |
|---|---|---|
| Full box tree | Yes (text / JSON) | Yes (interactive tree) |
| Field tree and byte-level hex | Partly (text output) | Yes, one click |
| Scripting / CI / batch | Yes | Not supported (yet) |
| Modify the file (edit boxes) | Yes (mp4edit) | No, and it will not |
| Block-level QP / motion vectors | No | Yes |
| Requires installing anything | Yes | No |
| File leaves your machine | No | No (fully client-side) |
6. Which to pick
| Your task | Pick |
|---|---|
| Batch checks, reports, CI integration | mp4dump --format=json |
| Edit or trim a file, extract a box | mp4edit / mp4extract |
| Poking at an unfamiliar MP4 to see its structure | This tool |
| Check the container and a frame's block data in one go | This tool (both in one window) |
| A machine where you cannot install software | This tool |
One more note: if what you want is purely a graphical box viewer, GPAC's MP4Box -info and this tool are two answers to the same question, and the difference is still install versus no install. For the wider picture, see the full comparison.