#include<Array.au3>
#include <file.au3>
#include <GuiListView.au3>
Dim $Target="F:\家庭录象";要查看的媒体文件所在目录
Dim $FileList[1],$i,$Number=1
Dim $ListView1
$Form1_1 = GUICreate("显示同一文件夹下多个AVI的媒体信息", 787, 401, 210, 154)
$ListView1 = GUICtrlCreateListView("序号 |文件格式 |视频格式 |音频格式 |音频编码 |视频编码 |总码率 "& _
"|视频码率 |音频码率 |视频分辨率 |视频分辨率 ", 0, 32, 785, 241)
GUISetState(@SW_SHOW, $Form1_1)
$FileList=_FileListToArray($Target,'*.avi',1)
If IsArray($FileList)=0 Then
MsgBox(0,'','目标文件夹里没有文件')
Exit
Else
For $i=1 To $FileList[0] Step 1
$sRL=_GetInfoArray($Target&$Filelist[$i])
_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView1));设置$ListView之前,先清除它里面的所有项
GUICtrlCreateListViewItem($Number&"|" & $sRL[0]&"|"&$sRL[1]&"|"&$sRL[2]&"|"&$sRL[3]&"|"&$sRL[4]&"|"&$sRL[5]&"|"&$sRL[6]&"|"&$sRL[7]&"|"&$sRL[8]&"|"&$sRL[9],$ListView1)
$Number +=1
Sleep(5000)
;MsgBox(0,'',$sRL[0]&"|"&$sRL[1]&"|"&$sRL[2]&"|"&$sRL[3]&"|"&$sRL[4]&"|"&$sRL[5]&"|"&$sRL[6]&"|"&$sRL[7]&"|"&$sRL[8]&"|"&$sRL[9])
;_ArrayDisplay($sRL)
;MsgBox(0,'',$FileList[$i])
Next
EndIf
While 1
Sleep(100)
WEnd
Func _GetInfoArray($sMediaFile)
Local $sRL[1]
$sDLL = DllOpen("MediaInfo.dll")
$sHandle = DllCall($sDLL, "ptr", "MediaInfo_New")
$Open_Result = DllCall($sDLL, "int", "MediaInfo_Open", "ptr", $sHandle[0], "wstr", $sMediaFile)
;获取文件格式
DllCall($sDLL, "wstr", "MediaInfo_Option", "ptr", 0, "wstr", "Inform", "wstr", "General;%Format/String%")
$Inform = DllCall($sDLL, "wstr", "MediaInfo_Inform", "ptr", $sHandle[0], "int", 0)
$sRL[0] = $Inform[0]
;获取视频格式
DllCall($sDLL, "wstr", "MediaInfo_Option", "ptr", 0, "wstr", "Inform", "wstr", "General;%Video_Format_List%")
$Inform = DllCall($sDLL, "wstr", "MediaInfo_Inform", "ptr", $sHandle[0], "int", 0)
_ArrayAdd($sRL, $Inform[0])
;获取音频格式
DllCall($sDLL, "wstr", "MediaInfo_Option", "ptr", 0, "wstr", "Inform", "wstr", "General;%Audio_Format_List%")
$Inform = DllCall($sDLL, "wstr", "MediaInfo_Inform", "ptr", $sHandle[0], "int", 0)
_ArrayAdd($sRL, $Inform[0])
;获取音频编码
DllCall($sDLL, "wstr", "MediaInfo_Option", "ptr", 0, "wstr", "Inform", "wstr", "General;%Audio_Codec_List%")
$Inform = DllCall($sDLL, "wstr", "MediaInfo_Inform", "ptr", $sHandle[0], "int", 0)
_ArrayAdd($sRL, $Inform[0])
;获取视频编码
DllCall($sDLL, "wstr", "MediaInfo_Option", "ptr", 0, "wstr", "Inform", "wstr", "General;%Video_Codec_List%")
$Inform = DllCall($sDLL, "wstr", "MediaInfo_Inform", "ptr", $sHandle[0], "int", 0)
_ArrayAdd($sRL, $Inform[0])
;获取总码率
DllCall($sDLL, "wstr", "MediaInfo_Option", "ptr", 0, "wstr", "Inform", "wstr", "General;%BitRate/String%")
$Inform = DllCall($sDLL, "wstr", "MediaInfo_Inform", "ptr", $sHandle[0], "int", 0)
_ArrayAdd($sRL, $Inform[0])
;获取视频码率
DllCall($sDLL, "wstr", "MediaInfo_Option", "ptr", 0, "wstr", "Inform", "wstr", "Video;%BitRate/String%")
$Inform = DllCall($sDLL, "wstr", "MediaInfo_Inform", "ptr", $sHandle[0], "int", 0)
_ArrayAdd($sRL, $Inform[0])
;获取音频码率
DllCall($sDLL, "wstr", "MediaInfo_Option", "ptr", 0, "wstr", "Inform", "wstr", "Audio;%BitRate/String%")
$Inform = DllCall($sDLL, "wstr", "MediaInfo_Inform", "ptr", $sHandle[0], "int", 0)
_ArrayAdd($sRL, $Inform[0])
;获取视频分辨率
DllCall($sDLL, "wstr", "MediaInfo_Option", "ptr", 0, "wstr", "Inform", "wstr", "Video;%Width%")
$Inform = DllCall($sDLL, "wstr", "MediaInfo_Inform", "ptr", $sHandle[0], "int", 0)
$sWidth = $Inform[0]
DllCall($sDLL, "wstr", "MediaInfo_Option", "ptr", 0, "wstr", "Inform", "wstr", "Video;%Height%")
$Inform = DllCall($sDLL, "wstr", "MediaInfo_Inform", "ptr", $sHandle[0], "int", 0)
$sHigh = $Inform[0]
If $sHigh <> '' And $sWidth <> '' Then
_ArrayAdd($sRL, $sWidth & ' X ' & $sHigh)
Else
_ArrayAdd($sRL, '')
EndIf
;获取视频刷新率
DllCall($sDLL, "wstr", "MediaInfo_Option", "ptr", 0, "wstr", "Inform", "wstr", "Video;%FrameRate/String%")
$Inform = DllCall($sDLL, "wstr", "MediaInfo_Inform", "ptr", $sHandle[0], "int", 0)
_ArrayAdd($sRL, $Inform[0])
;删除Handle和DLL
$sHandle = DllCall($sDLL, "none", "MediaInfoList_Delete", "ptr", $sHandle[0])
DllClose($sDLL)
Return $sRL
EndFunc ;==>_GetInfoArray