MediaPortal Forums HTPC/MediaCenter

Go Back   MediaPortal Forum » MediaPortal 1 » Main Features (talk, share your ideas, get support) » Watch / Listen Media » MyTV - Engine 0.2 » Tips and Tricks


Tips and Tricks Post your Tips and Tricks in here.

Reply
 
Thread Tools Display Modes
Old 2006-09-07, 13:48   #1 (permalink)
Portal User
 
Join Date: Sep 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts


Default Switching resolutions for different videos

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
axc97c is offline   Reply With Quote
Old 2006-09-07, 21:30   #2 (permalink)
Portal Member
 
chili's Avatar
 
Join Date: Sep 2004
Location: somewhere in the bowels of Texas
Posts: 339
Thanks: 0
Thanked 0 Times in 0 Posts

My System

Default

cool, thanks for posting this.
__________________
chili
my stuff
chili is offline   Reply With Quote
Reply

Bookmarks

Tags
resolutions, switching, video

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hard time switching from Meedio - too many bugs automated General Support 6 2006-12-17 11:29
Skipping/Scrubbing thru My Videos doesn't work anymore? snarlyboy General Support 5 2006-11-05 15:52
Recording Conflicts gwiley General Support 15 2006-09-15 07:28
MP suddenly stops when watching videos in My Videos MisterTee General Support 5 2006-07-29 16:58
Sources for music videos? Anonymous OffTopic 2 2004-11-22 19:39


All times are GMT +1. The time now is 20:45.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 Protected by Akismet Blog with WordPress
Advertisement System V2.6 By   Branden