利用JNative调用MediaInfo.dll实现获取媒体信息
MediaInfo mi = new MediaInfo();
mi.Open(dir+filename);
String infor = mi.Inform();
int VideoLength =Integer.parseInt(mi.Get(MediaInfo.Stream_Video, 0, "Duration",MediaInfo.Info_Text, MediaInfo.Info_Name));
System.out.println(infor);
控制台输出:
General
Complete name : F:/movies/地铁惊魂.rmvb
Format : RealMedia
File size : 922 MiB
Duration : 1h 45mn
Overall bit rate : 1 192 Kbps
Performer : BT无极-www.btwuji.com
Video
ID : 1
Format : RealVideo 4
Codec ID : RV40
Codec ID/Info : Based on AVC (H.264), Real Player 9
Duration : 1h 45mn
Bit rate : 1 128 Kbps
Width : 1 024 pixels
Height : 568 pixels
Display aspect ratio : 16:9
Frame rate : 23.000 fps
Resolution : 12 bits
Bits/(Pixel*Frame) : 0.084
Stream size : 854 MiB (93%)
Audio
ID : 0
Format : Cooker
Codec ID : cook
Codec ID/Info : Based on G.722.1, Real Player 6
Duration : 1h 45mn
Bit rate : 64.1 Kbps
Channel(s) : 2 channels
Sampling rate : 44.1 KHz
Resolution : 16 bits
Stream size : 48.6 MiB (5%)