环境:windows10 VS2015
第一步:下载代码并编译
选择最后的一个标签。点击下载
下载后解压,选择
libmediainfo_AllInclusive\MediaInfoLib\Project\MSVC2015\MediaInfoLib.sln
打开项目
直接生成解决方案,在
libmediainfo_AllInclusive\MediaInfoLib\Project\MSVC2015\x64\Release
目录下生成dll和lib 我这里是64位release版本。
2、开发测试
新建任意C++控制太程序。
添加dll和lib的环境。
在
libmediainfo_AllInclusive\MediaInfoLib\Source\MediaInfoDLL\MediaInfoDLL.h
复制头文件到工程目录。
添加代码
#include "MediaInfoDLL.h" //Dynamicly-loaded library (.dll or .so)
using namespace MediaInfoDLL;
int main()
{
MediaInfo MI;
String s1, s2,s3;
MI.Open(L"tt.mp4");
s1 = MI.Get(Stream_Video, 0, __T("Width"), Info_Text, Info_Name);
MI.Close();
return 0;
}
点击运行测试。
视频的所有信息
General
Complete name : videoTest.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/avc1/mp41)
File size : 908 KiB
Duration : 10 s 0 ms
Overall bit rate mode : Variable
Overall bit rate : 744 kb/s
Encoded date : UTC 1970-01-01 00:00:00
Tagged date : UTC 1970-01-01 00:00:00
Writing application : Lavf52.64.2
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Baseline@L3
Format settings, CABAC : No
Format settings, ReFrames : 3 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 10 s 0 ms
Bit rate : 607 kb/s
Nominal bit rate : 1 024 kb/s
Width : 480 pixels
Height : 360 pixels
Display aspect ratio : 4:3
Frame rate mode : Variable
Frame rate : 24.000 FPS
Minimum frame rate : 15.000 FPS
Maximum frame rate : 30.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.146
Stream size : 741 KiB (82%)
Writing library : x264 core 85 Ubuntu_2:0.85.1448+git1a6d32-4
Encoding settings : cabac=0 / ref=3 / deblock=1:0:0 / analyse=0x1:0x111 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=4 / sliced_threads=0 / nr=0 / decimate=1 / mbaff=0 / constrained_intra=0 / bframes=0 / wpredp=0 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=abr / mbtree=1 / bitrate=1024 / ratetol=3.9 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / ip_ratio=1.41 / aq=1:1.00
Encoded date : UTC 1970-01-01 00:00:00
Tagged date : UTC 1970-01-01 00:00:00
Audio
ID : 2
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 9 s 915 ms
Bit rate mode : Variable
Bit rate : 132 kb/s
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 44.1 kHz
Frame rate : 43.066 FPS (1024 spf)
Compression mode : Lossy
Stream size : 160 KiB (18%)
Encoded date : UTC 1970-01-01 00:00:00
Tagged date : UTC 1970-01-01 00:00:00
完毕
感谢雷神
https://blog.youkuaiyun.com/leixiaohua1020/article/details/11902195
和
https://blog.youkuaiyun.com/danjuan123/article/details/65444009
代码示例请自取
https://github.com/chenyuProject/MediaInfodemo