C++中使用MediaInfo库获取视频信息
2014-08-27 21:48
393 查看
MediaInfo 用来分析视频和音频文件的编码和内容信息,是一款是自由软件 (免费使用、免费获得源代码)。
我在项目软件中集成了它的DLL,发现真的是非常好用!
下面简单记录一下它的使用方法。
1.将下载下来的MediaInfo.dll拷贝到项目里面
2.拷贝MediaInfoDLL.h到项目目录
3.CPP文件中添加头文件和命名空间
[cpp] view
plaincopy
#include "MediaInfoDLL.h" //Dynamicly-loaded library (.dll or .so)
using namespace MediaInfoDLL;
4.使用的时候声明一个MediaInfo对象就可以了
例如,获得视频的宽和高,用Get():
[cpp] view
plaincopy
MediaInfo MI;
CString width,height;
MI.Open("test.flv");
width = MI.Get(stream_t::Stream_Video,0,"Width").c_str();
height = MI.Get(stream_t::Stream_Video,0,"Height").c_str();
MI.Close();
这里需要注意的是:width,height都是字符串,使用的时候需要转换
获得视频的完整信息,用Inform():
[cpp] view
plaincopy
MediaInfo MI;
CString all;
MI.Open("test.flv");
MI.Option("Complete");
all= MI.Inform().c_str();
MI.Close();
下载地址:http://download.csdn.net/detail/leixiaohua1020/6371889
General
Complete name (CompleteName) : cuc_ieschool.flv
Format : Flash Video
File size : 912 KiB
Duration : 34s 133ms
Overall bit rate : 219 Kbps
Tagging application : iku
Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Main@L3.1
Format settings, CABAC : Yes
Format settings, ReFrames : 3 frames
Codec ID : 7
Duration : 34s 0ms
Bit rate : 179 Kbps
Nominal bit rate : 208 Kbps
Width : 512 pixels
Height : 288 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate :15.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.081
Stream size : 769 KiB (84%)
Writing library : x264 core 54
Encoding settings : cabac=1 / ref=2 / deblock=1:0:0 / ana
lyse=0x1:0x131 / me=hex / subme=6 / brdo=0 / mixed_ref=1 / me_range=16 / chroma_
me=1 / trellis=1 / 8x8dct=0 / cqm=0 / deadzone=21,11 / chroma_qp_offset=0 / slic
es=4 / nr=0 / decimate=1 / mbaff=0 / bframes=3 / b_pyramid=0 / b_adapt=1 / b_bia
s=0 / direct=1 / wpredb=1 / bime=0 / keyint=90 / keyint_min=25 / scenecut=40 / r
c=abr / bitrate=208 / ratetol=0.1 / rceq='blurCplx^(1-qComp)' / qcomp=0.60 / qpm
in=10 / qpmax=51 / qpstep=4 / ip_ratio=1.40 / pb_ratio=1.30
Audio
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : HE-AAC / LC
Codec ID : 10
Duration : 34s 133ms
Bit rate : 30.2 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 44.1 KHz / 22.05 KHz
Compression mode : Lossy
Stream size : 137 KiB (15%)
如果字段是多个单词的例如 Complete name应该改成(CompleteName)---中间没有空格,单词首字母是大写
MI.Get(stream_t::Stream_Video,0,"Width").c_str();
我在项目软件中集成了它的DLL,发现真的是非常好用!
下面简单记录一下它的使用方法。
1.将下载下来的MediaInfo.dll拷贝到项目里面
2.拷贝MediaInfoDLL.h到项目目录
3.CPP文件中添加头文件和命名空间
[cpp] view
plaincopy
#include "MediaInfoDLL.h" //Dynamicly-loaded library (.dll or .so)
using namespace MediaInfoDLL;
4.使用的时候声明一个MediaInfo对象就可以了
例如,获得视频的宽和高,用Get():
[cpp] view
plaincopy
MediaInfo MI;
CString width,height;
MI.Open("test.flv");
width = MI.Get(stream_t::Stream_Video,0,"Width").c_str();
height = MI.Get(stream_t::Stream_Video,0,"Height").c_str();
MI.Close();
这里需要注意的是:width,height都是字符串,使用的时候需要转换
获得视频的完整信息,用Inform():
[cpp] view
plaincopy
MediaInfo MI;
CString all;
MI.Open("test.flv");
MI.Option("Complete");
all= MI.Inform().c_str();
MI.Close();
下载地址:http://download.csdn.net/detail/leixiaohua1020/6371889
General
Complete name (CompleteName) : cuc_ieschool.flv
Format : Flash Video
File size : 912 KiB
Duration : 34s 133ms
Overall bit rate : 219 Kbps
Tagging application : iku
Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Main@L3.1
Format settings, CABAC : Yes
Format settings, ReFrames : 3 frames
Codec ID : 7
Duration : 34s 0ms
Bit rate : 179 Kbps
Nominal bit rate : 208 Kbps
Width : 512 pixels
Height : 288 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate :15.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.081
Stream size : 769 KiB (84%)
Writing library : x264 core 54
Encoding settings : cabac=1 / ref=2 / deblock=1:0:0 / ana
lyse=0x1:0x131 / me=hex / subme=6 / brdo=0 / mixed_ref=1 / me_range=16 / chroma_
me=1 / trellis=1 / 8x8dct=0 / cqm=0 / deadzone=21,11 / chroma_qp_offset=0 / slic
es=4 / nr=0 / decimate=1 / mbaff=0 / bframes=3 / b_pyramid=0 / b_adapt=1 / b_bia
s=0 / direct=1 / wpredb=1 / bime=0 / keyint=90 / keyint_min=25 / scenecut=40 / r
c=abr / bitrate=208 / ratetol=0.1 / rceq='blurCplx^(1-qComp)' / qcomp=0.60 / qpm
in=10 / qpmax=51 / qpstep=4 / ip_ratio=1.40 / pb_ratio=1.30
Audio
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : HE-AAC / LC
Codec ID : 10
Duration : 34s 133ms
Bit rate : 30.2 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 44.1 KHz / 22.05 KHz
Compression mode : Lossy
Stream size : 137 KiB (15%)
如果字段是多个单词的例如 Complete name应该改成(CompleteName)---中间没有空格,单词首字母是大写
MI.Get(stream_t::Stream_Video,0,"Width").c_str();
相关文章推荐
- C++中使用MediaInfo库获取视频信息
- C++中使用MediaInfo库获取视频信息
- C++中使用MediaInfo库获取视频信息
- J2EE中使用MediaInfo库获取视频信息
- J2EE中使用MediaInfo库获取视频信息
- J2EE中使用MediaInfo库获取视频信息
- c++获取文件信息——_stat函数的使用
- c++ 使用wmi 获取系统相关信息
- Windows使用C++获取网卡信息
- 使用libcurl库获取网页信息(C++ php)
- 使用FFmpeg接口获取视频信息
- PHP使用FFmpeg获取视频播放总时长与码率等信息
- 【转】windows c++获取文件信息——_stat函数的使用
- PHP使用FFmpeg获取视频信息
- 在C++中使用CPUID指令获取CPU信息
- php使用ffmpeg获取视频信息并截图的实现方法
- MediaInfo库获取视频信息
- asp.net 使用ffmpeg.exe获取视频信息并截图方法类
- PHP使用FFmpeg获取视频播放总时长与码率等信息
- C++使用汇编获取CPU信息,学到的是思路