Clarky Posted September 7, 2006 Share Posted September 7, 2006 Hello Heres a script that switches display resolution based on the frame rate of a video. expandcollapse popup$fps = GetVideoFPS($CmdLine[1]) ;MsgBox(0,"Test",$fps) $Res = "1920,1080,32,60" if $fps = 25 Then; Resolution for pal video $Res = "1920,1080,32,50" EndIf $Cmd = "C:\Program Files\MultiRes\MultiRes.exe /" & $Res & " /exit" ;MsgBox(0,"Test",$Cmd) RunWait($Cmd, "C:\Program Files\MultiRes") ;$Cmd = 'C:\Program Files\Zoom Player\zplayer.exe "' & $CmdLine[1] & '"' $Cmd = 'C:\Program Files\Zoom Player\zplayer.exe /F /Q /MOUSEOFF "' & $CmdLine[1] & '"' ;MsgBox(0,"Test",$Cmd) RunWait($Cmd, "C:\Program Files\Zoom Player") ;RunWait("C:\Program Files\MultiRes\MultiRes.exe /restore /exit", "C:\Program Files\MultiRes") Func GetVideoFPS($video) $Outputfile = "C:\out.txt"; $MplayerDir = "C:\windows\mplayer\"; $Exe = @COMSPEC & ' /c ' & $MplayerDir & 'mplayer.exe -vo null -ao null -frames 0 "' & $video & '" > ' & $Outputfile ;MsgBox(0,"Test",$Exe) FileDelete($Outputfile) ;RunWait($Exe ,$MplayerDir) RunWait($Exe ,$MplayerDir,@SW_HIDE) $file = FileOpen($Outputfile, 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf $Fps = 0; While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop if StringLeft($line,6) = "VIDEO:" Then If StringInStr($line,"23.976") Then $Fps = 23.976 EndIf If StringInStr($line,"29.970") Then $Fps = 29.970 EndIf If StringInStr($line,"25.000") Then $Fps = 25.000 EndIf EndIf if StringLeft($line,16) = "FPS seems to be:" Then $Fps = StringMid($line,18,7); EndIf Wend FileClose($file) Return $Fps EndFunc Hope someone finds it usefull Adam 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