惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
博客园_首页
W
WeLiveSecurity
S
Secure Thoughts
S
Security @ Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Hugging Face - Blog
Hugging Face - Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
H
Hacker News: Front Page
Project Zero
Project Zero
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
U
Unit 42
N
News and Events Feed by Topic
N
News and Events Feed by Topic
Hacker News - Newest:
Hacker News - Newest: "LLM"
Forbes - Security
Forbes - Security
T
Tor Project blog
I
Intezer
B
Blog
F
Full Disclosure
Security Archives - TechRepublic
Security Archives - TechRepublic
F
Fortinet All Blogs
Schneier on Security
Schneier on Security
T
Threat Research - Cisco Blogs
AI
AI
Google DeepMind News
Google DeepMind News
L
LINUX DO - 最新话题
Cloudbric
Cloudbric
L
Lohrmann on Cybersecurity
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
P
Privacy International News Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
PCI Perspectives
PCI Perspectives
Y
Y Combinator Blog
Spread Privacy
Spread Privacy
Simon Willison's Weblog
Simon Willison's Weblog
罗磊的独立博客
Vercel News
Vercel News
A
Arctic Wolf
The Register - Security
The Register - Security
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Microsoft Azure Blog
Microsoft Azure Blog
H
Heimdal Security Blog
Know Your Adversary
Know Your Adversary
P
Proofpoint News Feed
C
Cybersecurity and Infrastructure Security Agency CISA
P
Proofpoint News Feed

钧言极客

Alpine Linux 服务器配置指北 Visual Studio Code 安装开启 中文语言包插件 Hugo 实现的短标签 PVE存储合并实践:整合local-lvm到local 组网工具WireGuard入门指南 Debian 安装NVIDLA显卡驱动和CUDA工具包 Linux 管理 UFW 防火墙 Alpine VNC重置密码
Linux 安装 MediaInfo:轻松解析视频文件信息
JunYan · 2026-02-13 · via 钧言极客

最近在玩 PT 站时,发现发种页面需要用到 MediaInfo 提取的视频信息。为了避免每次都要下载视频文件并在本地查看,我决定将 MediaInfo 安装到服务器上,实现远程解析。

Mediainfo简介

MediaInfo 是一款开源、跨平台的多媒体信息提取工具,支持多种音视频格式。它可以快速获取媒体文件的详细技术参数,例如:

  • 编码格式(Codec)
  • 分辨率(Resolution)
  • 比特率(Bitrate)
  • 帧率(Frame Rate)
  • 音频通道数(Audio Channels)

这些信息对于影视爱好者、PT 站用户以及开发者都非常实用。

安装Mediainfo

MediaInfo 可以通过系统的包管理器一键安装,非常方便。以下是主流 Linux 发行版的安装命令:

# openEuler / EulerOS
sudo dnf install mediainfo

# Debian / Ubuntu
sudo apt install mediainfo

# alpine
sudo apk add mediainfo

# CentOS / RHEL
sudo yum install mediainfo

# Arch Linux
sudo pacman -S mediainfo

✅ 安装完成后,可通过 mediainfo --version 验证是否成功。

使用 MediaInfo 解析视频文件

安装完成后,即可通过命令行解析视频文件信息。以下是一些常用的使用示例:

  • 基础用法
  • 显示文件详细信息
mediainfo --full /video.mp4
  • 结构化输出(JSON/XML)

支持将结果导出为 JSONXML 格式,便于程序处理:

--Output= 参数:JSON/XML

# 输出为 JSON
mediainfo --Output=JSON /video.mp4 > video.json

# 输出为 XML
mediainfo --Output=XML /video.mp4 > video.xml
  • 生成文本文件

将信息保存为纯文本文件

mediainfo /video.mp4 > /video.mediainfo.txt
  • 获取特定信息

使用 --Inform 参数精准提取所需字段,减少输出冗余。

# 获取分辨率
mediainfo --Inform="Video;%Width%x%Height%" /video.mp4

总结

MediaInfo 是一个强大而轻量的工具,特别适合需要频繁分析媒体文件的场景。