Jump to content

Recommended Posts

Posted

Hi everybody!

I'm a begginer at AutoIt and I have some questions :)

Well, I need to get techincal video information from a video formats files such as file duration, video/audio streams, frames per second, etc. Can AutoIt do this?

PS I used a search but I have not found any topic with the same problem.

[font="Tahoma"]Sorry for my bad English, Russian is my native language...[/font]
Posted (edited)

Hi everybody!

I'm a begginer at AutoIt and I have some questions :)

Well, I need to get techincal video information from a video formats files such as file duration, video/audio streams, frames per second, etc. Can AutoIt do this?

PS I used a search but I have not found any topic with the same problem.

Search on forum for MCI_Video.au3 Edited by Andreik
Posted

Search on forum for MCI_Video.au3

It returned just one link... And I don't see anything in that thread that can help me.
[font="Tahoma"]Sorry for my bad English, Russian is my native language...[/font]
Posted
Andreik, it will be cool if you will show me how to use this UDF :)
[font="Tahoma"]Sorry for my bad English, Russian is my native language...[/font]
Posted

UDF's contain the functions u need.. just include them in ur script, and call them from there.. like this

#include<Video.au3>
$sFile='D:\VIDEOS\friends.mpg';put ur file path here
$dimns=_Video_Dimension($sFile)
MsgBox(4096,"Video Dimensions","Width: "&$dimns[0] & @CRLF & "Height: "&$dimns[1])
[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Posted (edited)

oops forgot to mention.. copy the video.au3 in ur @script directory.. where ur script resides.. or put it in the Include folder in c:\Program Files\AutoIT\Include..

Cheers,

:)

Edited by Manjish
[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Posted

Manjish, thanks, it works!

But I don't understand how to get other info... I use this script:

#NoTrayIcon
#include <Video.au3>
$sFile = 'I:\dc.mpg'
$dimns=_Video_Dimension($sFile)
$getFrameRate=_Video_FrameRate($sFile)
$getLength=_Video_Length($sFile)

MsgBox(4096,"Video Dimensions","Width: "&$dimns[0] & @CRLF & "Height: "&$dimns[1])
MsgBox(64, "Frames Rate", $getFrameRate)
MsgBox(64, "Length", $getLength)

Your example works but other not. 'Frames rate' and 'Length' returns 0. Can you tell me why?

[font="Tahoma"]Sorry for my bad English, Russian is my native language...[/font]
Posted

Manjish, thanks, it works!

But I don't understand how to get other info... I use this script:

#NoTrayIcon
#include <Video.au3>
$sFile = 'I:\dc.mpg'
$dimns=_Video_Dimension($sFile)
$getFrameRate=_Video_FrameRate($sFile)
$getLength=_Video_Length($sFile)

MsgBox(4096,"Video Dimensions","Width: "&$dimns[0] & @CRLF & "Height: "&$dimns[1])
MsgBox(64, "Frames Rate", $getFrameRate)
MsgBox(64, "Length", $getLength)

Your example works but other not. 'Frames rate' and 'Length' returns 0. Can you tell me why?

_Video_FrameRate

; Description....: Close a video.

; Syntax.........: _Video_FrameRate($sAlias)

; Parameters ....: $sAlias - Alias name returned by _Video_Open.

; Return values .: Success - Returns the Frames Per Second of the video.

; Failure - Return 0 and @error 1

; @error 1 = Invalid Alias

; Author ........: smashly

; ====================================================================================================

=====

Func _Video_FrameRate($sAlias)

U'll first need to use _Video_Open.. and the use this handle in _Video_FrameRate
[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Posted

Manjish, yes, i've used this but nothing change. it's still returns "0".

Examples:

1st script:

#NoTrayIcon
#include <Video.au3>
$sFile = 'D:\Video\!NEW_VIDEO\AmytivilleHorror.avi'
$hWnd="1280"
$hWnd = "1"
$iX="1"
$iY="1"
$iW="1280"
$iH="720"
$open = _Video_Open($sFile, $hWnd, $iX, $iY, $iW, $iH)
$dimns=_Video_Dimension($sFile)
$getFrameRate=_Video_FrameRate($sFile)
$getLength=_Video_Length($sFile, 0)
MsgBox(4096,"Video Dimensions","Width: "&$dimns[0] & @CRLF & "Height: "&$dimns[1])
MsgBox(4096, "Frames Rate", $getFrameRate)
MsgBox(4096, "Length", $getLength)

and second:

#NoTrayIcon
#include <Video.au3>
$sFile = 'D:\Video\!NEW_VIDEO\AmytivilleHorror.avi'
$hWnd="1280"
$hWnd = "1"
$iX="1"
$iY="1"
$iW="1280"
$iH="720"
$open = _Video_Open($sFile, $hWnd, $iX, $iY, $iW, $iH)
$dimns=_Video_Dimension($sFile)
$getFrameRate=_Video_FrameRate($open)
$getLength=_Video_Length($sFile, 0)
MsgBox(4096,"Video Dimensions","Width: "&$dimns[0] & @CRLF & "Height: "&$dimns[1])
MsgBox(4096, "Frames Rate", $getFrameRate)
MsgBox(4096, "Length", $getLength)

May be you will show me really stable script? ;-)

[font="Tahoma"]Sorry for my bad English, Russian is my native language...[/font]
Posted

1) keep ur video file open..

2) use wingethandle to get the handle of the open video file..

3) use it in _Video_Open..

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Posted

1) keep ur video file open..

2) use wingethandle to get the handle of the open video file..

3) use it in _Video_Open..

Ok, please look this script:

#NoTrayIcon
#include <Video.au3>
$iX = "1"
$iY = "1"
$iW = "1280"
$iH = "720"
$video = 'I:\dc.mpg'
$hWnd= WinGetHandle("dc.mpg - GOM Player")
_Video_Open($video, $hWnd, $iX, $iY, $iW, $iH)
$dimns = _Video_Dimension($video)
$getFrameRate = _Video_FrameRate($video)
$getLength = _Video_Length($video, 0)
MsgBox(4096, "Video Dimensions", "Width: " & $dimns[0] & @CRLF & "Height: " & $dimns[1])
MsgBox(4096, "Frames Rate", $getFrameRate)
MsgBox(4096, "Length", $getLength)

File is still open, title of window is correct but it STILL returns zeros. Where's my mistake?

[font="Tahoma"]Sorry for my bad English, Russian is my native language...[/font]
Posted

Here's where ur mistake is.. please read the comments in the video.au3 file..

_Video_Open($video, $hWnd, $iX, $iY, $iW, $iH)

C'mon try.. I have pushed u in the right direction.. now find the solution..

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Posted

Oh my God I'm not so stupid, it works!! :):)

Manjish, thank you very much!!!

So, really stable code:

#NoTrayIcon
#include <Video.au3>
$iX = "1"
$iY = "1"
$iW = "1280"
$iH = "720"
$video = 'I:\Video\DM.avi'
$hWnd= WinGetHandle("DM.avi - GOM Player")
$sDevice = "AVIVideo"
$file = _Video_Open($video, $hWnd, $iX, $iY, $iW, $iH, $sDevice)
$dimns = _Video_Dimension($video)
$getFrameRate = _Video_FrameRate($file)
$getLength = _Video_Length($file, 0)
MsgBox(4096, "Video Dimensions", "Width: " & $dimns[0] & @CRLF & "Height: " & $dimns[1])
MsgBox(4096, "Frames Rate", $getFrameRate)
MsgBox(4096, "Length", $getLength)

So, I have just one question: is it possible to get information about audio and video codecs of file? In comments of Video.au3 I haven't found any solution...

[font="Tahoma"]Sorry for my bad English, Russian is my native language...[/font]
Posted

i don't know of a way to do it in autoit (there maybe.. but haven't found.. so if any1 knows please share).. n i don't have time to find out how it can be done.. try using this.

[font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
  • 3 years later...
Posted

@ Andreik, your UDF ran videos MKV, MPG, MP4, AVI and reornou the duration of them perfectly, congratulations on the excellent work

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
  • Recently Browsing   0 members

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