Sign in to follow this  
Followers 0
Simplify iT

dllcall mediainfo.dll

15 posts in this topic

Hi All,

I am having some problems with DllCall - specifically using mediainfo.dll.

I have read the information with mediainfo.dll and also the info on dllcall - but for the life of me i can't understand it.... :D

I simply want to make a call to mediainfo.dll and retrieve the Video codec information only. Can someone please help?

The code below is what comes with the mediainfo.dll and this is the autoit example...

;Loading the DLL
$DLL=DllOpen("MediaInfo.dll")

;Info
$Info_Parameters=DllCall($DLL, "wstr", "MediaInfo_Option", "ptr", 0, "wstr", "Info_Parameters", "wstr", "")
MsgBox(0, "MediaInfo_Option - Info_Parameters", $Info_Parameters[0])
$Info_Capacities=DllCall($DLL, "wstr", "MediaInfo_Option", "ptr", 0, "wstr", "Info_Capacities", "wstr", "")
MsgBox(0, "MediaInfo_Option - Info_Capacities", $Info_Capacities[0])
$Info_Codecs=DllCall($DLL, "wstr", "MediaInfo_Option", "ptr", 0, "wstr", "Info_Codecs", "wstr", "")
MsgBox(0, "MediaInfo_Option - Info_Codecs", $Info_Codecs[0])

;New MediaInfo handle
$Handle=DllCall($DLL, "ptr", "MediaInfo_New")

;Open
$Open_Result=DllCall($DLL, "int", "MediaInfo_Open", "ptr", $Handle[0], "wstr", "Example.ogg")

;Inform with Complete=false
DllCall($DLL, "wstr", "MediaInfo_Option", "ptr", 0, "wstr", "Complete", "wstr", "")
$Inform=DllCall($DLL, "wstr", "MediaInfo_Inform", "ptr", $Handle[0], "int", 0)
MsgBox(0, "Inform with Complete=false", $Inform[0])

;Inform with Complete=true
DllCall($DLL, "wstr", "MediaInfo_Option", "ptr", 0, "wstr", "Complete", "wstr", "1")
$Inform=DllCall($DLL, "wstr", "MediaInfo_Inform", "ptr", $Handle[0], "int", 0)
MsgBox(0, "Inform with Complete=true", $Inform[0])

;Custom Inform 
DllCall($DLL, "wstr", "MediaInfo_Option", "ptr", 0, "wstr", "Inform", "wstr", "General;Example : FileSize=%FileSize%")
$Inform=DllCall($DLL, "wstr", "MediaInfo_Inform", "ptr", $Handle[0], "int", 0)
MsgBox(0, "Custom Inform", $Inform[0])

;Get with Stream=General and Parameter=FileSize
$Info_Get=DllCall($DLL, "wstr", "MediaInfo_Get", "ptr", $Handle[0], "int", 0, "int", 0, "wstr", "FileSize", "int", 1, "int", 0)
MsgBox(0, "Get with Stream=General and Parameter=FileSize", $Info_Get[0])

;GetI with Stream=General and Parameter=46
$Info_GetI=DllCall($DLL, "wstr", "MediaInfo_GetI", "ptr", $Handle[0], "int", 0, "int", 0, "int", 46, "int", 1, "int", 0)
MsgBox(0, "Get with Stream=General and Parameter=46", $Info_GetI[0])

;Count_Get with StreamKind=Stream_Audio
$Count_Get=DllCall($DLL, "int", "MediaInfo_Count_Get", "ptr", $Handle[0], "int", 2, "int", 0)
MsgBox(0, "Count_Get with StreamKind=Stream_Audio", $Count_Get[0])

;Get with Stream=General and Parameter=AudioCount
$Info_Get=DllCall($DLL, "wstr", "MediaInfo_Get", "ptr", $Handle[0], "int", 0, "int", 0, "wstr", "AudioCount", "int", 1, "int", 0)
MsgBox(0, "Get with Stream=General and Parameter=AudioCount", $Info_Get[0])

;Get with Stream=Audio and Parameter=StreamCount
$Info_Get=DllCall($DLL, "wstr", "MediaInfo_Get", "ptr", $Handle[0], "int", 2, "int", 0, "wstr", "StreamCount", "int", 1, "int", 0)
MsgBox(0, "Get with Stream=Audio and Parameter=StreamCount", $Info_Get[0])

;Delete MediaInfo handle
$Handle=DllCall($DLL, "none", "MediaInfo_Delete", "ptr", $Handle[0])

;Close the DLL
DllClose($dll)

all help appreciated!

Share this post


Link to post
Share on other sites



Wht comes with mediainfo.dll? :D


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Can you just post part of the documentation that describes how to call these functions?

Or we'll wait for someone to do it for you.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Found it here (doxygen of the headerfile, only needed up to line 247)

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

...ProgAndy will.

@Simplify iT, try this:

$hDLL = DllOpen("MediaInfo.dll")


; New MediaInfo handle
$aMediaInfo = DllCall($hDLL, "ptr", "MediaInfo_New")
$hMediaInfo = $aMediaInfo[0]


; Open
DllCall($hDLL, "dword", "MediaInfo_Open", _
        "ptr", $hMediaInfo, _ ; Handle
        "wstr", "FullPathToSomeVideoFile.avi.mpeg.whatever") ; Full path


; MediaInfo
$aMediaInfoGet = DllCall($hDLL, "wstr", "MediaInfo_Get", _
        "ptr", $hMediaInfo, _ ; Handle
        "int", 0, _ ; StreamKind
        "int", 0, _ ; StreamNumber
        "wstr", "Video_Format_List", _ ; Video Codecs in this file, separated by /
        "int", 1, _ ; KindOfInfo
        "int", 0) ; KindOfSearch

$sMediaInfo = $aMediaInfoGet[0]
ConsoleWrite("Video Codecs in this file, separated by / : " & $sMediaInfo & @CRLF)


; General MediaInfo
$aMediaInfoInform = DllCall($hDLL, "wstr", "MediaInfo_Inform", _
        "ptr", $hMediaInfo, _ ; Handle
        "int", 0) ; Options

$sMediaInfoInform = $aMediaInfoInform[0]

ConsoleWrite($sMediaInfoInform & @CRLF)

DllCall($hDLL, "none", "MediaInfo_Close", "ptr", $hMediaInfo)

DllClose($hDLL)

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Hi

with this script (and a couple of changes) if get this output - i am just looking to get the video codec only (video codecID)

$hDLL = DllOpen("MediaInfo.dll")


; New MediaInfo handle
$aMediaInfo = DllCall($hDLL, "ptr", "MediaInfo_New")
$hMediaInfo = $aMediaInfo[0]


; Open
DllCall($hDLL, "dword", "MediaInfo_Open", _
        "ptr", $hMediaInfo, _; Handle
        "wstr", "Matrix.Reloaded.Trailer-640x346-XviD-1.0beta2-HE_AAC_subtitled.mkv"); Full path


; MediaInfo
$aMediaInfoGet = DllCall($hDLL, "wstr", "MediaInfo_Get", _
        "ptr", $hMediaInfo, _; Handle
        "int", 0, _; StreamKind
        "int", 0, _; StreamNumber
        "wstr", "Video_Format_List", _; Video Codecs in this file, separated by /
        "int", 1, _; KindOfInfo
        "int", 0); KindOfSearch

$sMediaInfo = $aMediaInfoGet[0]
ConsoleWrite("Video Codecs in this file, separated by / : " & $sMediaInfo & @CRLF)


; General MediaInfo
$aMediaInfoInform = DllCall($hDLL, "wstr", "MediaInfo_Inform", _
        "ptr", $hMediaInfo, _; Handle
        "int", 0); Options

$sMediaInfoInform = $aMediaInfoInform[0]

;ConsoleWrite($sMediaInfoInform & @CRLF)
MsgBox(0, "Output", $sMediaInfoInform)

DllCall($hDLL, "none", "MediaInfo_Close", "ptr", $hMediaInfo)

DllClose($hDLL)

post-11823-1244258945_thumb.jpg

Share this post


Link to post
Share on other sites

Just change part below ; MediaInfo to this:

; MediaInfo
$aMediaInfoGet = DllCall($hDLL, "wstr", "MediaInfo_Get", _
        "ptr", $hMediaInfo, _ ; Handle
        "int", 1, _ ; StreamKind <--Video
        "int", 0, _ ; StreamNumber
        "wstr", "CodecID", _ ; Codec ID <-- this
        "int", 1, _ ; KindOfInfo
        "int", 0) ; KindOfSearch

$sMediaInfo = $aMediaInfoGet[0]
ConsoleWrite("Video Codec ID: " & $sMediaInfo & @CRLF)

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

Perfect! Thanks very much for your help trancexx!

Share this post


Link to post
Share on other sites

Hello,

a time ago, but I want to use the same dll (or commandline) for getting the framerate of a video. As I want to use it for a whole Blu-Ray directory, I have some questions. Perhaps someone knows how to handle this.

with the command line: MediaInfo.exe -f "z:\Medien\Testvideodirectory\" I get all the information including the framerate. But I do not know how to use this with the dll call. Perhaps it could be easier to directly get the information from the command line but I did not get it. Can someone help?

Regards,

Alex

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Sorry for digging up this old thread, but I'm trying to extract "Encoded date". This info shows up in red in the console when all extracted info is written, but when that info is extracted directly it writes nothing?

; MediaInfo
$aMediaInfoGet = DllCall($hDLL, "wstr", "MediaInfo_Get", _
"ptr", $hMediaInfo, _ ; Handle
"int", 1, _ ; StreamKind <--Video
"int", 0, _ ; StreamNumber
"wstr", "Encoded date", _ ; Codec ID <-- this
"int", 1, _ ; KindOfInfo
"int", 0) ; KindOfSearch

$sMediaInfo = $aMediaInfoGet[0]
ConsoleWrite("Encoded date: " & $sMediaInfo & @CRLF)
Edited by Tin2tin

Share this post


Link to post
Share on other sites

It's in the dll download package. I found this one at this location

MediaInfo_DLL_0.7.60_Windows_i386_WithoutInstallerDevelopersList_Of_ParametersVideo.csv

Share this post


Link to post
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
Sign in to follow this  
Followers 0