Automatic Refreshrate Changer (2 Viewers)

Slurm

MP Donator
  • Premium Supporter
  • December 16, 2006
    301
    33
    58
    Graz
    Home Country
    Austria Austria
    @ slurm, yes its the tv for sure - if i set it manuallyto 60hz in the ati control center the same happens
    ..i have a pioneer 50inch..for now i only switch to 50hz and 24hz.
    Also, my next problem, it seems i have a huge audio synch problem at 24hz...trying different audio codecs now.
    Using ffdshow audio, didnt help .....

    oke did some testing, it seems that the EVR setting, gives me a audio synch problem...or at least, it looks like
    when i switch to vmr it looks oke (this needs more investigation)

    Well, you're not the only one. I've had the same problem and could solve it by using PowerDVD and ffdaudio as codecs (for others this didn't help). You could also try reclock. Here's a bug report regarding the problem: https://forum.team-mediaportal.com/1-0-rc3-svn-builds-288/no-audio-video-sync-when-refresh-rate-24hz-maybe-other-rr-too-47725/
     

    ppeterr

    Portal Pro
    July 20, 2008
    136
    5
    thank you for your reply slurm, very usefull link also. Tried the powerdvd+ffdshow, and yes, there is an improvement. But still
    not lip synch. Gonna try reclock later on. hope that it helps. since switching off EVR aint an option for me.
    With EVR most things go a lot smoother, also in MP things go smoother (or at least it look like it does).
    Since it seems there is already a lot on this forum about this issue, and it doesnt really have to
    do anything with this topic. I'll report back later if i found a solution. kthx again
     

    akiaki

    Portal Pro
    September 15, 2008
    125
    4
    Zagreb
    Home Country
    Croatia Croatia
    ok, i had problems with lipsync and DD and DTS files as many have on 24hz playback. I was experimenting yesterday with everything and somehow I fixed it!!
    First I used reclock to force media playback to 25fps on 50hz refresh rate and av sync is great, but reclock drops ac3 frames and it's annoying..
    Then, I disabled reclock, put ffdshow as the h.264 codec (I have h.264 set to disabled and raw to all so that the coreavc kicks in - I had to mannualy unregister MPV codec!) and ac3 filter for audio codec and default directsound device as audio renderer (I have spdif optical cable to my receiver which handles decoding). ac3 filter is set to use spdif, passtrough all audio - DD, DTS and MPEG, but what seems was causing trouble was JITTER CORRECTION! After disabling it everything was in sync! PERFECT PLAYBACK on all movies and series I had trouble before!
    So maybe someone can see if it help him/her and report back :)
    I'm happy happy happy, perfect lipsync 5.1 audio finally :)
    Of course, without refresrate changer, this would be very difficult, thank you!
     

    Justchill

    Portal Pro
    February 25, 2008
    247
    1
    Brugge
    Home Country
    Belgium Belgium
    ok, i had problems with lipsync and DD and DTS files as many have on 24hz playback. I was experimenting yesterday with everything and somehow I fixed it!!
    First I used reclock to force media playback to 25fps on 50hz refresh rate and av sync is great, but reclock drops ac3 frames and it's annoying..
    Then, I disabled reclock, put ffdshow as the h.264 codec (I have h.264 set to disabled and raw to all so that the coreavc kicks in - I had to mannualy unregister MPV codec!) and ac3 filter for audio codec and default directsound device as audio renderer (I have spdif optical cable to my receiver which handles decoding). ac3 filter is set to use spdif, passtrough all audio - DD, DTS and MPEG, but what seems was causing trouble was JITTER CORRECTION! After disabling it everything was in sync! PERFECT PLAYBACK on all movies and series I had trouble before!
    So maybe someone can see if it help him/her and report back :)
    I'm happy happy happy, perfect lipsync 5.1 audio finally :)
    Of course, without refresrate changer, this would be very difficult, thank you!


    Interesting,

    but I don't understand, what X.264 videocodec do you use atm: CoreAVC or FFDSHOW ?
    You also use the AC3 filter as audio codec? Did you install AC3 filter seperately?

    got it working, so thanks a lot !!!! My ati onboard switches perfectly to 24hz and 50hz back....
    my tv picks it up flawless...
    Only thing, is that when i switch to 60hz....uhmm how do i say that, i got less overscan ?
    In other words..ntsc stuff siwtched to 60hz, gives me a zoomed in video, with black borders (smaller).
    This is not a problem caused by this refreshrate switcher, but maybe anyone can explain to me
    why this happens, and if i can fix this...

    The solution is easy, you have to put the overscan to maximum for that refreshrate/resolution combo in the CCC.
     

    akiaki

    Portal Pro
    September 15, 2008
    125
    4
    Zagreb
    Home Country
    Croatia Croatia
    Interesting,

    but I don't understand, what X.264 videocodec do you use atm: CoreAVC or FFDSHOW ?
    You also use the AC3 filter as audio codec? Did you install AC3 filter seperately?

    I am using coreAVC trough FFDSHOW because I want ffdshow for subtitle support. I hate vobsub and can't zoom in and ffdshow works great. I installed ac3filter separately and use it for passtrough of ac3 audio, yes.
     

    dannyb0y

    Portal Member
    February 27, 2006
    12
    1
    Why thirdparty software?

    I have written some code that uses windows API to change refresh rate.
    in my thread https://forum.team-mediaportal.com/plugins-47/very-simple-refreshrate-changer-39790/ you can get the source code.
    My suggestion is to build a plugin that does not use any thirdparty products to change refresh rate.

    here is the c# class:

    using System;
    using System.Runtime.InteropServices;


    //http://groups.google.se/group/microsoft.public.dotnet.framework.drawing/browse_thread/thread/2898363a6bc22f30/22e9e76998ccf819?hl=sv&lnk=st&q=refresh+rate+win32+api+c%23#22e9e76998ccf819

    namespace Monitor
    {
    public sealed class Win32
    {

    public const int CCHDEVICENAME = 32;
    public const int CCHFORMNAME = 32;

    [Flags]
    public enum DISPLAY_DEVICE_StateFlags : uint
    {
    None = 0x00000000,
    DISPLAY_DEVICE_ATTACHED_TO_DESKTOP = 0x00000001,
    DISPLAY_DEVICE_MULTI_DRIVER = 0x00000002,
    DISPLAY_DEVICE_PRIMARY_DEVICE = 0x00000004,
    DISPLAY_DEVICE_MIRRORING_DRIVER = 0x00000008,
    DISPLAY_DEVICE_VGA_COMPATIBLE = 0x00000010,
    DISPLAY_DEVICE_REMOVABLE = 0x00000020,
    DISPLAY_DEVICE_MODESPRUNED = 0x08000000,
    DISPLAY_DEVICE_REMOTE = 0x04000000,
    DISPLAY_DEVICE_DISCONNECT = 0x02000000
    }

    [Flags]
    public enum DEVMODE_Fields : uint
    {
    None = 0x00000000,
    DM_POSITION = 0x00000020,
    DM_BITSPERPEL = 0x00040000,
    DM_PELSWIDTH = 0x00080000,
    DM_PELSHEIGHT = 0x00100000,
    DM_DISPLAYFLAGS = 0x00200000,
    DM_DISPLAYFREQUENCY = 0x00400000
    }


    [Flags]
    public enum ChangeDisplaySettings_Flags : uint
    {
    None = 0x00000000,
    CDS_UPDATEREGISTRY = 0x00000001,
    CDS_TEST = 0x00000002,
    CDS_FULLSCREEN = 0x00000004,
    CDS_GLOBAL = 0x00000008,
    CDS_SET_PRIMARY = 0x00000010,
    CDS_VIDEOPARAMETERS = 0x00000020,
    CDS_RESET = 0x40000000,
    CDS_NORESET = 0x10000000
    }


    public enum ChangeDisplaySettings_Result : int
    {
    DISP_CHANGE_SUCCESSFUL = 0,
    DISP_CHANGE_RESTART = 1,
    DISP_CHANGE_FAILED = -1,
    DISP_CHANGE_BADMODE = -2,
    DISP_CHANGE_NOTUPDATED = -3,
    DISP_CHANGE_BADFLAGS = -4,
    DISP_CHANGE_BADPARAM = -5,
    DISP_CHANGE_BADDUALVIEW = -6
    }


    public enum EnumDisplaySettings_EnumMode : uint
    {
    ENUM_CURRENT_SETTINGS = uint.MaxValue,
    ENUM_REGISTRY_SETTINGS = uint.MaxValue - 1
    }


    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
    public class DISPLAY_DEVICE
    {
    public uint cb = (uint)Marshal.SizeOf(typeof(DISPLAY_DEVICE));
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
    public string DeviceName = "";
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
    public string DeviceString = "";
    public DISPLAY_DEVICE_StateFlags StateFlags = 0;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
    public string DeviceID = "";
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
    public string DeviceKey = "";
    }


    [StructLayout(LayoutKind.Sequential)]
    public struct POINTL
    {
    public POINTL(int x, int y)
    {
    this.x = x;
    this.y = y;
    }
    public int x;
    public int y;
    }


    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
    public class DEVMODE_Display
    {
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = CCHDEVICENAME)]
    public string dmDeviceName = null;
    public ushort dmSpecVersion = 0;
    public ushort dmDriverVersion = 0;
    public ushort dmSize = (ushort)Marshal.SizeOf(typeof(DEVMODE_Display));
    public ushort dmDriverExtra = 0;
    public DEVMODE_Fields dmFields = DEVMODE_Fields.None;
    public POINTL dmPosition = new POINTL();
    public uint dmDisplayOrientation = 0;
    public uint dmDisplayFixedOutput = 0;
    public short dmColor = 0;
    public short dmDuplex = 0;
    public short dmYResolution = 0;
    public short dmTTOption = 0;
    public short dmCollate = 0;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = CCHFORMNAME)]
    public string dmFormName = null;
    public ushort dmLogPixels = 0;
    public uint dmBitsPerPel = 0;
    public uint dmPelsWidth = 0;
    public uint dmPelsHeight = 0;
    public uint dmDisplayFlags = 0;
    public uint dmDisplayFrequency = 0;
    public uint dmICMMethod = 0;
    public uint dmICMIntent = 0;
    public uint dmMediaType = 0;
    public uint dmDitherType = 0;
    public uint dmReserved1 = 0;
    public uint dmReserved2 = 0;
    public uint dmPanningWidth = 0;
    public uint dmPanningHeight = 0;
    }


    [DllImport("user32.dll", CharSet = CharSet.Unicode)]
    public extern static int EnumDisplayDevices([In] string lpDevice, [In]
    uint iDevNum, [In][Out] DISPLAY_DEVICE lpDisplayDevice, [In] uint dwFlags);


    [DllImport("user32.dll", CharSet = CharSet.Unicode)]
    public extern static int EnumDisplaySettingsEx([In] string lpszDeviceName,
    [In] EnumDisplaySettings_EnumMode iModeNum, [In][Out] DEVMODE_Display
    lpDevMode, [In] uint dwFlags);


    [DllImport("user32.dll", CharSet = CharSet.Unicode)]
    public extern static ChangeDisplaySettings_Result
    ChangeDisplaySettingsEx([In] string lpszDeviceName, [In] DEVMODE_Display
    lpDevMode, [In] IntPtr hwnd, [In] ChangeDisplaySettings_Flags dwFlags, [In]
    IntPtr lParam);


    public static void CycleRefreshRate(uint monitorIndex, uint refreshRate)
    {

    Monitor.Win32.DISPLAY_DEVICE displayDevice = new Monitor.Win32.DISPLAY_DEVICE();
    int result = Monitor.Win32.EnumDisplayDevices(null, monitorIndex, displayDevice, 0);

    if (result != 0)
    {
    Monitor.Win32.DEVMODE_Display devMode = new Monitor.Win32.DEVMODE_Display();

    devMode.dmFields = Monitor.Win32.DEVMODE_Fields.DM_DISPLAYFREQUENCY;

    devMode.dmDisplayFrequency = refreshRate;
    Monitor.Win32.ChangeDisplaySettings_Result r = Monitor.Win32.ChangeDisplaySettingsEx(displayDevice.DeviceName, devMode,
    IntPtr.Zero, Monitor.Win32.ChangeDisplaySettings_Flags.None, IntPtr.Zero);
    }
    }

    }





    }
     

    5Hundred

    Portal Pro
    December 14, 2007
    166
    4
    Home Country
    New Zealand New Zealand
    dannyboy I use the automatic refresh rate changer to also change resolution, i suspect using your solution that i would no longer be able to do that?

    The reason i require the resolution change is that my LCD does not support all refresh rates at all resolutions so i have to switch around to get a working hz and res combination. I'm sure that i'm not alone in this requirement, although i may well be in a minority.
     

    Ausir

    Portal Member
    January 12, 2008
    27
    2
    Home Country
    Sweden Sweden
    I'm using two profiles in ATI Catalyst Center to switch between my Plasma and my Projector as my primary and only screen, using macroed keypresses mapped to my iMon Remote. The plasma is native 1024*768 (doesn't look good in skins...) and the projector is 1280*720. I wonder if I somehow would be able to use this AutoRefreshrateChanger now that I also have to have two different profiles depending if I'm watching the telly or the projje?
     

    AberDino

    MP Donator
  • Premium Supporter
  • February 17, 2005
    246
    34
    Kincardineshire
    Home Country
    Scotland Scotland
    dannyb0y, I like the idea, but my concern would be as follows. I use the soundcard onboard my ATI graphics card and feed the combined video plus audio signal to my LCD TV using an HDMI cable. It is possible to switch the video refresh rate with various tools but then the sound disappears, apparently because the card itself doesn't check the video refresh rate when including the audio packets. ATI's CCC utility is required to switch refresh rates in this case, as it seems to 'tell' the card what refresh rate should be used to insert the audio packets.
     

    Users who are viewing this thread

    Top Bottom