INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: You can reduce Video "Jitter" from mismatched frame rate & refresh rate  (Read 8952 times)

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14465
  • I won! I won!

For those wanting to reduce jitter induced by a mismatch between the Frame Rate of your encoded Video and the Refresh Rate of your Video card, I've added a page to the WIKI http://wiki.jrmediacenter.com/index.php/Video_Playback_Customization that may help.  I've outlined two options you can use to match the Video Card's Refresh Rate to that of the Video File's Frame Rate:
1) MC13's inbuilt "Change Display Settings" feature or
2) ReClock to automatically detect the Media's Frame Rate and then select the correct Video Card Refresh Rate.
Thanks
Nathan

============= ReClock "RunEvent.VBS" details ===================
Firstly thanks to "cbemore / noee" for advice on the ReClock (http://forum.slysoft.com/forumdisplay.php?f=85) script (modified and posted below) to call DisplayChanger (http://www.12noon.com/displaychanger.htm) to change your display's settings to match that of your Video File's Frame Rate.  You will need to replace the code in the existing "RunEvent.VBS" file in your RECLOCK directory with that below (and make sure the run event options is enabled) and away you go!  Note: This script presumes your Video Card and Display is capable of 24, 50, and 60hz.  If you'r setup is not 24hz compatible you will need to modify "newRefreshRate" to "60" for the Case under "CINEMA").  Discussions on this particular ReClock script is from this thread http://forum.slysoft.com/showthread.php?t=24822


Code: [Select]
' -------------------------------------
' Event notification script for ReClock
' -------------------------------------
'
' This script will be called when ReClock change the media adaptation of a played file
' either automatically or after some manual change made in the properties panel
' It is called only for media file which contain a video stream, and when frame rate of this file is known
'
' ---------------------------------------------------------------------------------------------
' The 7 parameters received by this script are explained below:
'
' (1) contains the event name that just occurred:
'    - "GREEN"  : tray icon just got green (all is fine). Parameter
'    - "YELLOW" : tray icon just got yellow. We should make what is necessary
'                 to change the monitor refresh rate
'    - "STOP"   : playback just stopped
'    - "QUIT"   : ReClock is about to quit
'
' Parameters (2), (3), (8) and (9) apply only with "GREEN" and "YELLOW" events. Otherwise they contain "-"
'
' (2) contains the type of media file currently played :
'    - "CINEMA" : frame rate of source file is around 24 fps
'    - "PAL"    : frame rate of source file is around 25 fps
'    - "NTSC"   : frame rate of source file is around 30 fps
'    - "CUSTOM" : frame rate of source file does not fall in previous categories
'
' (3) contains the current sound playback mode (apply only with GREEN/YELLOW event):
'    - "PCM"    : PCM mode
'    - "SPDIF"  : AC3 passthrough SPDIF
'
' (4) contains the current monitor selected for playback (1=primary, 2=secondary, etc...)
'
' (5) contains the total monitor count detected in the system
'
' (6) contains the current resolution of your monitor (WIDTHxHEIGHT)
'
' (7) contains the current refresh rate of your monitor (in Hz)
'
' (8) contains the original playback rate of the file (in fps multiplied by 1000)
'
' (9) contains the current playback rate of the file (in fps multiplied by 1000)
'
' (10) contains the filename of the current media file
'
' ---------------------------------------------------------------------------------------------
' Notifications examples:
'   - GREEN CINEMA PCM 1 1 1024x768 72 23976 24000 c:\test.avi : all is good
'   - GREEN NTSC PCM 1 1 1024x768 60 29970 30000  c:\test.avi : all is good
'   - YELLOW PAL SPDIF 1 1 1024x768 72 25000 25000 c:\test.avi : please switch to a multiple of 25 hz since PAL wants 25 fps
'   - YELLOW CINEMA SPDIF 1 1 1024x768 75 23976 23976 c:\test.avi : please switch to 71.928 hz
'
' ---------------------------------------------------------------------------------------------
' Here is a sample in VbScript that will call Powerstrip to change the monitor refresh rate
' using the /T parameter (to obtain the timings parameters go to the timings setup in powerstrip and copy
' them to the clipboard)
' There is a VERY important thing to note. Powerstrip change the timings directly in the hardware, but
' forget to notify Windows applications it did that (including ReClock). So this script MUST exit with
' an exit code of 0 if it did change the configuration with powerstrip. Otherwise the script should
' return 1

' Decode the parameters
Set objArgs = WScript.Arguments
If objArgs.Count < 10 Then
    MsgBox "Bad argument count !",  MB_OK, "ReClock Event Notification"
   
    ' We have done nothing. Return 1 to indicate ReClock that
    ' the configuration has not changed
    WScript.Quit 1
End If

eventName = objArgs(0)
mediaType = objArgs(1)
soundMode = objArgs(2)
currentMonitor = objArgs(3)
totalMonitorCount = objArgs(4)
currentResolution = objArgs(5)
currentRefreshRate = objArgs(6)
originalPlaybackSpeed = objArgs(7)
currentPlaybackSpeed = objArgs(8)
currentMediaFile = objArgs(9)

' If you need to debug, replace false with true in the following line
if false Then MsgBox _
    eventName & " " & _
    mediaType & " " & _
    soundMode & " " & _
    currentMonitor & " " & _
    totalMonitorCount & " " & _
    currentResolution & " " & _
    currentRefreshRate & " " & _
    originalPlaybackSpeed & " " & _
    currentPlaybackSpeed, _
    MB_OK, "ReClock Event Notification"

' Here is a sample of what can be done with PowerStrip
Set wshShell = CreateObject("WScript.Shell")

' We will put new timings here if necessary
newRefreshRate = currentRefreshRate

' Obviously we have something to do only if the icon is yellow
'If eventName = "YELLOW" Then
'If currentRefreshRate <> originalPlaybackSpeed Then
        Select Case mediaType
            Case "CINEMA"
                newRefreshRate = "24"
                newWidth       = "1920"
                newHeight      = "1080"
            Case "PAL"
                newRefreshRate = "50"
                newWidth       = "1920"
                newHeight      = "1080"
            Case "NTSC"
                newRefreshRate = "60"
                newWidth       = "1920"
                newHeight      = "1080"
        End Select

'End If

' We quit the player, restore our favorite refresh rate and/or resolution
If eventName = "QUIT" Then

    newRefreshRate = "50"
    newWidth       = "1920"
    newHeight      = "1080"

End If

' Do we have new timings to apply ?
If currentRefreshRate <> newRefreshRate Then

    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(&H26&)
    Set objFolderItem = objFolder.Self

    ' Now run DisplayChanger command and wait for it to finish its job
    WshShell.Run """" & objFolderItem.Path  & _
                 "\12noon Display Changer\dc.exe"" -refresh=" & newRefreshRate & _
                                         " -width="   & newWidth & _
                                         " -height="  & newHeight & _
                                         " -depth=max -quiet", 0, true

    ' In case we did a configuration change we MUST return 0 to
    ' indicate ReClock it need to recalibrate itself.
    WScript.Quit 0

End If

' We have done nothing. Return 1 to indicate ReClock that
' the configuration has not changed
WScript.Quit 1


Logged
JRiver CEO Elect

raym

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3583
Re: You can reduce Video "Jitter" from mismatched frame rate & refresh rate
« Reply #1 on: January 22, 2009, 02:51:22 am »

Thanks again for this Nathan. I've wondered about an automatic method of doing this for quite some time. Nice work!
Logged
RKM Smart Home - www.rkmsmarthome.com.au
Z-Wave Home Automation

rpalmer68

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2639
Re: You can reduce Video "Jitter" from mismatched frame rate & refresh rate
« Reply #2 on: February 02, 2009, 06:53:16 pm »

Hi Nathan,

I see in the reclock forum you were having problems with frequency switching and youir ATIO card. I have an ATI4850 so before I try what you're posted above I though I should check what you'd found/discovered with using this and the ATI card.

I was also thinking of  trying SetDisplayFrequency.exe from slysoft (comes with anyDVD), have you tried it?

Cheers
Richard
Logged

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14465
  • I won! I won!
Re: You can reduce Video "Jitter" from mismatched frame rate & refresh rate
« Reply #3 on: February 03, 2009, 07:55:32 pm »

Hi Richard - Yup I still get odd Judder problems if I switch freq when playback has started with some combinations of filters.  I'm guessing that one (or more) filter hates the change once the Filter Graph has been built (but I've not yet worked out which ones in the chain but I definatly kwon that one in the EVR / FFDSHOW / HAALI combo does not like it).  FYI - It is not a big issue for me as I tend to tag files first in MC then it is all fine as I guess that the freq change starts prior to the filter graph becoming active for files and Arcsoft TMT does not seem to have the problem.  When I'm back in Syd I'll play some more as I it will not take long to work out which filter has the issue.

I also see over at the Reclock forum you can call ATI's CCC as well to change refresh rates, but I don't know if it or the SetDisplayFrequency.exe will be any gentler on the filters (I doubt it) but it can not hurt to try.

Thanks
Nathan
Logged
JRiver CEO Elect

rpalmer68

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2639
Re: You can reduce Video "Jitter" from mismatched frame rate & refresh rate
« Reply #4 on: February 03, 2009, 08:59:34 pm »

  FYI - It is not a big issue for me as I tend to tag files first in MC then it is all fine as I guess that the freq change starts prior to the filter graph becoming active for files ...

I'd probably do this too if I could work out how to tag the files in MC to set the refresh rate without having to also set the resolution, as my systems run at different resolutions....ANYBODY???

R
Logged

jmone

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 14465
  • I won! I won!
Re: You can reduce Video "Jitter" from mismatched frame rate & refresh rate
« Reply #5 on: February 03, 2009, 09:09:48 pm »

For some reason I thought you could just specify one part of the timing (eg Freq)....but I may be thinking of other utils like Display Changer....

Yaobing could confirm what syntax (if any) can call just a freq change...
Logged
JRiver CEO Elect

rpalmer68

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2639
Re: You can reduce Video "Jitter" from mismatched frame rate & refresh rate
« Reply #6 on: February 03, 2009, 09:50:17 pm »

For some reason I thought you could just specify one part of the timing (eg Freq)....but I may be thinking of other utils like Display Changer....

Yaobing could confirm what syntax (if any) can call just a freq change...

Hopefully.

I have asked a few times but have never had a response, so I'm starting to think it may not be possible....

Yaobing - is it possible, and if not would it be possible to make it possible ??
Logged
Pages: [1]   Go Up