Endgame Posted October 11, 2005 Share Posted October 11, 2005 Here is a quick script to demonstrate how to get the framerate of an AVI file.$filename = "PutYourFileNameHere.avi" $framerateHex = DllCall(@ScriptDir & "\binary.dll", "int", "FileReadBinary", "str", $filename, "int", 32, "int", 3, "str", "") $framerate = 1/(Dec(StringRight($framerateHex[4],2) & StringMid($framerateHex[4],3,2) & StringLeft($framerateHex[4],2))/1000000) MsgBox (0, "Framerate", $framerate)This script requires the binary.dll from LazyCat (http://www.autoitscript.com/fileman/users/Lazycat/). This script is pretty useless on its own but it could be the start of something useful. EndgameMy UDFsFile Size ConvertMacros in INI UDF Link to comment Share on other sites More sharing options...
Guest Darksoul71 Posted October 13, 2005 Share Posted October 13, 2005 @endgame:Quite a nice idea to read the fps value straight from the avi header. For one of the upcoming versions of AutoIt (currently beta) I would suggest to use the "DllCall" function in combination with "avifil32.dll" and AVIStreamInfo. Unfortunately I haven´t had the time in the last days. For my tool "Komprezz2MPEG2" (see a few postings below) I´ve choosen a different approach: As I use AVISynth anyhow to do resizing, denoising, etc., I came up with the idea letting AVISynth "dropping" the info in a simple textfile. This little function adds a few lines to a AVISynth file in order to achieve this. expandcollapse popupFunc AVSInfo ($AVSFile, ByRef $Width, ByRef $Height, ByRef $Frames, ByRef $FPS, ByRef $AudioChannels, ByRef $AudioRate) $AVSInfo = $TempPath & "\movie_info.txt" $InfoAVS = $TempPath & "\movie_info.avs" ; Delete files from previous path if existing If FileExists ($AVSInfo) Then FileDelete($AVSInfo) If FileExists ($InfoAVS) Then FileDelete($InfoAVS) ; Pepare AVISynth script for AVI dump FileCopy ($AVSFile, $InfoAVS) AddLine ($InfoAVS, "filename =" & Chr(34) & $AVSInfo & Chr(34)) AddLine ($InfoAVS, "WriteFileIf(filename, " & Chr(34) & "current_frame == 0" & Chr(34) & "," & Chr(34) & "Width" & Chr(34) & ")" ) AddLine ($InfoAVS, "WriteFileIf(filename, " & Chr(34) & "current_frame == 0" & Chr(34) & "," & Chr(34) & "Height" & Chr(34) & ")" ) AddLine ($InfoAVS, "WriteFileIf(filename, " & Chr(34) & "current_frame == 0" & Chr(34) & "," & Chr(34) & "Framerate" & Chr(34) & ")" ) AddLine ($InfoAVS, "WriteFileIf(filename, " & Chr(34) & "current_frame == 0" & Chr(34) & "," & Chr(34) & "Framecount" & Chr(34) & ")" ) AddLine ($InfoAVS, "WriteFileIf(filename, " & Chr(34) & "current_frame == 0" & Chr(34) & "," & Chr(34) & "Audiochannels" & Chr(34) & ")" ) AddLine ($InfoAVS, "WriteFileIf(filename, " & Chr(34) & "current_frame == 0" & Chr(34) & "," & Chr(34) & "Audiorate" & Chr(34) & ")" ) ; Opens the AVISynth file in VirtualDub mod to enforce "info drop" TouchAVS ($InfoAVS) ; Open infofile generated by AVISynth script $file = FileOpen($AVSInfo, 0) $Width = FileReadLine($file) $Height = FileReadLine($file) $FPS = FileReadLine($file) $Frames = FileReadLine($file) $AudioChannels = FileReadLine($file) $AudioRate = FileReadLine($file) FileClose($file) FileDelete($AVSInfo) FileDelete($InfoAVS) EndFuncAVISynth provides a variety of infos on a movie. Refer to the AVISynth clip reference:http://www.avisynth.org/ClipPropertiesYou can find out pretty much anything about the video you like I´ve combined this with a small AutoIt function which uses VirtualDubMod to "touch" the AVISynth file (which results in writing the informations into a text file). I was really amazed how easy you can develop your own AV processing application with AutoIt and a little bit of freeware. I´ve planed several tools in future. Esp. a MP3 processor that is really able to cut MP3 files without having anoying "clicks" in between. I´ve done a tool using BeSplit for this but many of my audiobooks / audioplays have either gaps in between or those clicks making it a PITA to listen to them.Sorry for my lengthy posting,D$ Link to comment Share on other sites More sharing options...
w0uter Posted October 13, 2005 Share Posted October 13, 2005 instead of all those byref's maby it would be a better idee to make it return an array. My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
Guest Darksoul71 Posted October 14, 2005 Share Posted October 14, 2005 @w0uter: I dislike using an array to "package" variable of different "types" In a "normal" programing language I would use a struct / record for this. -D$ Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now