Code: Select all
#Persistent
#SingleInstance, force
global aviArray := Array()
Gui, New
Gui, Add, Text, w60, File path
Gui, Add, Button, x+5 Default, Select_File
Gui, Add, Edit, x5 w500 +ReadOnly vFilePath
Gui, Add, Text, y+5 w100, Number of frames
Gui, Add, Edit, y+5 w100 +ReadOnly vFrames
Gui, Add, Text, y+5 w100, Width (pixels)
Gui, Add, Edit, y+5 w100 +ReadOnly vWidth
Gui, Add, Text, y+5 w100, Height (pixels)
Gui, Add, Edit, y+5 w100 +ReadOnly vHeight
Gui, Add, Text, y+5 w100, Data Streams (1 or 2)
Gui, Add, Edit, y+5 w100 +ReadOnly vDataStreams
Gui, Add, Text, y+5 w100, Bitrate (kb/s)
Gui, Add, Edit, y+5 w100 +ReadOnly vBitRate
Gui, Show
return
Escape::
GuiClose:
ExitApp
ButtonSelect_File:
FileSelectFile, Path, , , Select an AVI vile, Video (*.avi)
GetAviInfo(Path, aviArray)
GuiControl, , FilePath, %Path%
GuiControl, , Frames, % aviArray.Pop()
GuiControl, , Width, % aviArray.Pop()
GuiControl, , Height, % aviArray.Pop()
GuiControl, , DataStreams, % aviArray.Pop()
GuiControl, , BitRate, % aviArray.Pop()
return
getAviInfo(avifullpath, fnArray)
{ fileObj := FileOpen(avifullpath,"r") ; Open file for read
if (fileObj = 0)
Return 0
fileObj.Seek(48,0) ; set filepointer to position 48
fileObj.RawRead(x, 4) ; read 4 Bytes from position 48 into variable x. This is the number of frames
frames := NumGet(x,0,"UInt") ; convert x (DWord=UInt) into a decimal
fileObj.Seek(68,0) ; set filepointer to position 68
fileObj.RawRead(x, 4) ; read 4 Bytes from position 44 into variable x. This is the height
height := NumGet(x,0,"UInt") ; convert x (DWord=UInt) into a decimal
fileObj.Seek(64,0) ; set filepointer to position 64
fileObj.RawRead(x, 4) ; read 4 Bytes from position 64 into variable x. This is the width
width := NumGet(x,0,"UInt") ; convert x (DWord=UInt) into a decimal
fileObj.Seek(56,0) ; set filepointer to position 56
fileObj.RawRead(x, 4) ; read 4 Bytes from position 56 into variable x. # data streams, 1 or 2
datastreams := NumGet(x,0,"UInt") ; convert x (DWord=UInt) into a decimal
fileObj.Seek(36,0) ; set filepointer to position 36
fileObj.RawRead(x, 4) ; read 4 Bytes from position 36 into variable x. bitrate
datarate := NumGet(x,0,"UInt") ; convert x (DWord=UInt) into a decimal and /1024
fileObj.Close()
bitrate := datarate/1024
fnArray.Push(bitrate)
fnArray.Push(datastreams)
fnArray.Push(height)
fnArray.Push(width)
fnArray.Push(frames)
Return array
}