Jump to content

Video Length


Recommended Posts

  • 1 month later...
  • Moderators

See if this works for you (You could use StringFormat() to do the time properly):

$File = "C:\Documents and Settings\Ron\My Documents\beta\Examples\GUI\sampleAVI.avi"
_GetMediaLen('Open ' & FileGetShortName($File) & ' alias MediaFile')
_GetMediaLen('Set MediaFile time format milliseconds')
$iTime = _GetMediaLen('Status MediaFile length')
_GetMediaLen('Close MediaFile')
MsgBox(0, '', $iTime / 1000 & ' seconds')

Func _GetMediaLen($sString)
   Local $aDLL
   $aDLL = DllCall('winmm.dll','int', 'mciSendString', 'str', $sString, 'str', '', 'int', 65534, 'hwnd', 0)
   If Not @error Then Return $aDLL[2]
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

See if this works for you (You could use StringFormat() to do the time properly):

$File = "C:\Documents and Settings\Ron\My Documents\beta\Examples\GUI\sampleAVI.avi"
_GetMediaLen('Open ' & FileGetShortName($File) & ' alias MediaFile')
_GetMediaLen('Set MediaFile time format milliseconds')
$iTime = _GetMediaLen('Status MediaFile length')
_GetMediaLen('Close MediaFile')
MsgBox(0, '', $iTime / 1000 & ' seconds')

Func _GetMediaLen($sString)
   Local $aDLL
   $aDLL = DllCall('winmm.dll','int', 'mciSendString', 'str', $sString, 'str', '', 'int', 65534, 'hwnd', 0)
   If Not @error Then Return $aDLL[2]
EndFunc
It works for AVI files, but not mpg files.

Talking Clockhttp://www.autoitscript.com/forum/index.php?showtopic=20751Talking Headlineshttp://www.autoitscript.com/forum/index.php?showtopic=20655Sometimes, I sits and thinkssometimes, I just sits

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...