Jump to content



Photo

Get technical video information


  • Please log in to reply
17 replies to this topic

#1 Shady

Shady

    Seeker

  • Active Members
  • 10 posts

Posted 13 February 2009 - 06:46 PM

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.
Sorry for my bad English, Russian is my native language...





#2 Andreik

Andreik

    Bishop

  • Active Members
  • PipPipPipPipPipPip
  • 2,498 posts

Posted 13 February 2009 - 07:07 PM

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, 13 February 2009 - 07:08 PM.

When the words fail... music speaks

#3 Shady

Shady

    Seeker

  • Active Members
  • 10 posts

Posted 13 February 2009 - 07:24 PM

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.
Sorry for my bad English, Russian is my native language...

#4 Andreik

Andreik

    Bishop

  • Active Members
  • PipPipPipPipPipPip
  • 2,498 posts

Posted 13 February 2009 - 07:49 PM

Look here:

Attached Files


When the words fail... music speaks

#5 Shady

Shady

    Seeker

  • Active Members
  • 10 posts

Posted 13 February 2009 - 08:32 PM

Andreik, it will be cool if you will show me how to use this UDF :)
Sorry for my bad English, Russian is my native language...

#6 Shady

Shady

    Seeker

  • Active Members
  • 10 posts

Posted 15 February 2009 - 08:32 AM

is there's somebody who can help me?
Sorry for my bad English, Russian is my native language...

#7 Manjish

Manjish

    !!DT!!

  • Active Members
  • PipPipPipPipPipPip
  • 558 posts

Posted 15 February 2009 - 09:32 AM

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])

Posted ImageManjish NaikEngineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

#8 Manjish

Manjish

    !!DT!!

  • Active Members
  • PipPipPipPipPipPip
  • 558 posts

Posted 15 February 2009 - 09:35 AM

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, 15 February 2009 - 09:37 AM.

Posted ImageManjish NaikEngineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

#9 Shady

Shady

    Seeker

  • Active Members
  • 10 posts

Posted 15 February 2009 - 01:30 PM

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?
Sorry for my bad English, Russian is my native language...

#10 Shady

Shady

    Seeker

  • Active Members
  • 10 posts

Posted 16 February 2009 - 07:57 AM

Up
Sorry for my bad English, Russian is my native language...

#11 Manjish

Manjish

    !!DT!!

  • Active Members
  • PipPipPipPipPipPip
  • 558 posts

Posted 16 February 2009 - 08:06 AM

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
Posted ImageManjish NaikEngineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

#12 Shady

Shady

    Seeker

  • Active Members
  • 10 posts

Posted 16 February 2009 - 08:45 AM

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? ;-)
Sorry for my bad English, Russian is my native language...

#13 Manjish

Manjish

    !!DT!!

  • Active Members
  • PipPipPipPipPipPip
  • 558 posts

Posted 16 February 2009 - 09:35 AM

1) keep ur video file open..

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

3) use it in _Video_Open..
Posted ImageManjish NaikEngineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

#14 Shady

Shady

    Seeker

  • Active Members
  • 10 posts

Posted 16 February 2009 - 10:04 AM

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?
Sorry for my bad English, Russian is my native language...

#15 Manjish

Manjish

    !!DT!!

  • Active Members
  • PipPipPipPipPipPip
  • 558 posts

Posted 16 February 2009 - 10:35 AM

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..
Posted ImageManjish NaikEngineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

#16 Shady

Shady

    Seeker

  • Active Members
  • 10 posts

Posted 16 February 2009 - 01:14 PM

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...
Sorry for my bad English, Russian is my native language...

#17 Manjish

Manjish

    !!DT!!

  • Active Members
  • PipPipPipPipPipPip
  • 558 posts

Posted 16 February 2009 - 01:24 PM

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.
Posted ImageManjish NaikEngineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com

#18 Belini

Belini

    Polymath

  • Active Members
  • PipPipPipPip
  • 242 posts

Posted 18 March 2012 - 04:05 PM

@ Andreik, your UDF ran videos MKV, MPG, MP4, AVI and reornou the duration of them perfectly, congratulations on the excellent work
Posted ImageAutoit Forum Brazil: http://autoitbrasil.com/ >> Autoit and arcades: http://www.arcadebr.com/forumMy Codes:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users