Switching resolutions for different videos (1 Viewer)

axc97c

New Member
September 1, 2006
1
0
Hello

Heres a script that switches display resolution based on the frame rate of a video. I am using the script as an external player that then calls zoom player.

The script requires AutoIT 3 to run

Hope someone finds it usefull

Adam

Code:
$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
 

Users who are viewing this thread

Top Bottom