Achieving flawlessly smooth video playback on a PC, especially when using powerful tools like madVR with Kodi or other DirectShow-based players, can feel like chasing a myth. You might notice subtle stutters, dropped frames, or repeated frames that detract from your viewing experience. These issues often stem from the intricate dance between your computer’s various internal clocks – particularly the video and audio clocks – which, if not perfectly synchronized, can lead to playback imperfections.
Many users believe that achieving a “perfect” refresh rate, such as precisely 23.976Hz for 24fps content, is the holy grail of smooth playback. However, the reality is more nuanced. The ideal refresh rate for your system isn’t a fixed number but rather a target that shifts based on the subtle interplay of your system’s clocks. This guide aims to provide the best explanation and actionable steps to optimize your refresh rate and minimize frame drops or repeats when using madVR, particularly beneficial for Kodi users seeking the highest video quality.
This guide is inspired by the extensive research and insights shared by hannes69 on the Kodi forums, whose contributions have been invaluable in understanding and tackling these complex issues. While achieving absolute perfection across every file might be elusive, the methods outlined here will significantly improve playback smoothness, often reducing frame drops or repeats to negligible levels, even on demanding systems.
Understanding Clock Synchronization and Playback Issues
Unlike dedicated media players, PCs rely on multiple independent clocks for video and audio processing. Typically, we’re concerned with at least three: the system clock, the video clock, and the audio clock. Ideally, these clocks would operate in perfect harmony. However, in practice, slight discrepancies are common, and these discrepancies are the root cause of dropped or repeated frames.
To better understand this, let’s consider an explanation from madshi, the creator of madVR, from a post in 2013:
There are 3 clocks during video playback: (1) System clock (“time”). (2) Video refresh rate. (3) Audio hardware clock.
The system clock really doesn’t have anything to do with video playback, but madVR uses it to measure and compare the other two clocks. Now it is possible (even probable) that the system clock is not perfect. But that’s not a big problem because if it’s e.g. slightly too fast, both video and audio clocks will be measured wrong in the exact same way, so everything’s fine.
If the video and audio hardware clocks are “perfect”, there should be no dropped or repeated frames (if your PC is fast enough). However, video and audio clocks are usually both imperfect. If both are imperfect in the same way (e.g. being 0.1% too fast), again there’s no problem. But if the amount of “deviation from perfectness” of audio and video clocks is not identical then madVR has to either drop frames (video clock slower than audio clock) or repeat frames (video clock faster than audio clock) to make sure video and audio stay in sync.
The refresh rate as shown in the first line in the madVR OSD is madVR’s measurement of the video clock, measured by using the system clock. The audio “deviation” in the madVR OSD shows how much the audio clock deviates from “perfectness”, measured by the system clock. If e.g. the measured refresh rate is 24.24000Hz (1% too fast for 24.000 content) and the audio deviation is exactly 1%, too, then there should be no frame drops/repeats. If the video/audio deviation differs, there have to be drops or repeats.
This explanation highlights that the key to smooth playback is minimizing the difference in “deviation from perfectness” between the video and audio clocks. While some solutions attempt to address this on the audio side through resampling (like Reclock or Kodi’s “Sync to display” option), this guide focuses on adjusting the video refresh rate. This approach is particularly valuable for users who prefer bitstreaming audio or want to maintain the original audio signal.
Step-by-Step Guide to Optimizing Refresh Rates for Smooth Playback
This procedure will guide you through the process of fine-tuning your display’s refresh rate to minimize frame drops and repeats in madVR. We’ll use a combination of tools and iterative testing to achieve optimal results. It’s recommended to start with the resolution and refresh rate you use most frequently for your content. In this example, we’ll use 2560×1440 at 50.000Hz as our starting point.
1. Install Custom Resolution Utility (CRU)
Download and install Custom Resolution Utility (CRU) from MonitorTests. This tool allows you to create and modify custom display resolutions and refresh rates beyond those offered by your graphics driver.
2. Access Pixel Clock Calculator (PCC)
Navigate to the Pixel Clock Calculator (PCC) website, also provided by MonitorTests. This tool will help us calculate the necessary pixel clock and timings for our custom refresh rates.
3. Configure CRU with Pixel Clock Calculator Values
Follow the instructions provided by ToastyX, the creator of CRU, in the software’s release thread for detailed guidance on using CRU.
Important for HDMI/DisplayPort Audio: If you are using HDMI or DisplayPort for audio output, ensure you add the appropriate extension block files in CRU to maintain audio support. As mentioned in the CRU documentation:
For audio support, import one of these extension block files:
Start by using CRU’s “Automatic LCD standard timings” as a base. This will automatically populate correct values for front porch, back porch, and sync settings for your chosen resolution and refresh rate. Then, switch to “Manual” timings for finer control.
Using the Pixel Clock Calculator, aim for the desired refresh rate with high precision (down to the 5th or 6th decimal place in the “@” value). Set “Maximum decimal places” in PCC to 2, as this is the precision limit for pixel clock control in most GPUs. Compare the standard LCD timings from CRU and input the minimum and maximum blanking values in PCC. For minimum blanking, use the standard timings value. For maximum blanking, add 200-300 pixels to the minimum value. More precise adjustments require detailed knowledge of your display’s specifications, which is beyond the scope of this guide.
Remember these relationships:
- Active Pixels: The visible resolution (e.g., 2560×1440).
- Blanking: The “invisible” portion of the signal, composed of front porch, sync width, and back porch.
- Total Pixels: Active Pixels + Blanking.
These blanking values are crucial for preserving bitstreaming audio formats, as audio data is transmitted within the blanking interval in HDMI signals. CEA standard timings often require specific front porch values (e.g., 638 for 1080p24Hz and 528 for 1080p50Hz). For the “Multiple” setting in PCC, start with defaults (8 horizontal / 1 vertical). Experiment by decreasing the horizontal value if you need finer refresh rate adjustments.
Enter your desired resolution and refresh rate into PCC, adjust the “Multiple” values if needed, and click “Submit query.” PCC will provide a set of values for Horizontal total, Vertical total, and Refresh rate. These values are directly compatible with CRU. You can use Horizontal total, Vertical total, and the refresh rate (up to three decimal places) in CRU’s custom resolution settings.
Example of using Pixel Clock Calculator to determine custom resolution parameters.
Front porch and sync width values should remain as populated by CRU’s standard timings. Adjust back porch and blanking based on the total values from PCC. Save your changes in CRU and restart your graphics driver. After restarting, check for any visual artifacts like incorrect colors, shimmering pixels, or distortions. If you observe any issues, revert to different timings.
In our 2560×[email protected] example, PCC might suggest 2720×1475 lines with a pixel clock of 200.60 MHz, resulting in a calculated refresh rate of 50.000Hz.
Example of configuring a custom resolution in CRU based on Pixel Clock Calculator output.
4. Test Playback and Monitor madVR OSD
Find a video file that is at least 45 minutes long and play it using your preferred DirectShow player with madVR enabled. Allow the video to play for at least 30 minutes, or longer if possible, for more accurate measurements.
Note on Audio Renderers: ReClock is known to provide inaccurate clock deviation readings, even when bitstreaming. For precise clock deviation measurements, use Sanear (https://github.com/alexmarsev/sanear/releases) or your player’s default audio renderer.
5. Analyze madVR OSD for Frame Drops/Repeats and Clock Deviation
After the playback period, bring up the madVR OSD by pressing CTRL+J during playback. Note down the following values, and consider using a spreadsheet or text file to organize your results, including the filename and the time of testing:
- a) movie [framerate] fps (says source filter): Verify that madVR correctly identifies the video’s framerate. In rare cases, madVR might misreport the framerate (e.g., reporting 23.970fps for a 23.976fps file). If this happens, use a different test file.
- b) 1 frame [drop/repeat] every x.xx minutes/hours/days: This is the crucial value we aim to optimize. Note whether you are experiencing frame drops or repeats. In our example, let’s say we observe “1 frame dropped every 56.21 minutes.” This means one frame is dropped every (56.21 minutes * 60 seconds/minute) = 3372.6 seconds. In this case, the audio clock is exceptionally precise, while the video clock has a slight deviation.
Example of madVR OSD showing frame drops and clock deviation information.
Calculate Refresh Rate Compensation:
To calculate the necessary refresh rate adjustment, use the following formula:
*Error (in parts per million – ppm) = 1 / (seconds per drop/repeat movie framerate)**
In our example, the calculation is: 1 / (3372.6 seconds * 25.000 fps) = 0.00001186028, which is approximately 11.86028 ppm.
Apply Compensation:
- Frame Drops: If you are experiencing frame drops, add the calculated error to your current refresh rate.
- Frame Repeats: If you are experiencing frame repeats, subtract the calculated error from your current refresh rate.
In our example (frame drops), the compensated refresh rate becomes:
50.000 Hz (1 + 11.86028 ppm) = 50.000 Hz (1 + 0.00001186028) = 50.000 Hz * 1.00001186028 = 50.00059301 Hz (approximate to eight decimal places).
6. Input Compensated Refresh Rate into Pixel Clock Calculator
Go back to the Pixel Clock Calculator and input the newly calculated compensated refresh rate (50.00059301Hz in our example).
7. Update CRU with New Pixel Clock Calculator Values
Return to CRU and update your custom resolution settings using the values generated by the Pixel Clock Calculator for the compensated refresh rate. Again, choose the closest achievable values without introducing visual distortions. For our example, we might choose 2750×1541 with a pixel clock of 211.89MHz, resulting in a calculated refresh rate of 50.00058994Hz.
8. Re-test Playback and Analyze madVR OSD (Iterate)
Repeat steps 4 and 5 using the new custom resolution with the compensated refresh rate. Play the test video for at least 45 minutes and observe the frame drops/repeats in the madVR OSD. Ideally, you should now see frame drops/repeats occurring over a much longer period (hours or even days), or even “no frame drops/repeats expected.”
In our example, after the first iteration, we might observe “1 frame drop every 11 hours.”
madVR OSD showing improved frame drop rate after the first refresh rate adjustment iteration.
9. Further Refinement (If Needed)
If frame drops/repeats are still occurring more frequently than desired, repeat steps 5-8 to further refine the refresh rate. In our example, observing “1 frame drop every 11 hours” equates to an error of approximately 1.01 ppm.
Error = 1 / ((11 hours 3600 seconds/hour) 25 fps) = 0.00000101, or 1.01 ppm.
Since we are still experiencing frame drops, we add this error to the previous refresh rate:
50.00058994 Hz (1 + 1.01 ppm) = 50.00058994 Hz (1 + 0.00000101) = 50.00064044 Hz.
Using PCC with this new refresh rate, we might get values like 2860 horizontal total, 1639 vertical total, and a 234.38 MHz pixel clock, resulting in a calculated refresh rate of 50.00063999Hz. After applying these settings in CRU and retesting, we might achieve “1 frame drop every 18.15 hours.”
madVR OSD indicating even fewer frame drops after a second iteration of refresh rate adjustment.
This level of performance (1 frame drop every 18 hours) is generally considered excellent, providing a substantial margin for clock variations due to temperature fluctuations or other system factors. You can continue iterating this process for even finer adjustments, potentially reaching results like “1 frame drop every 1.02 days.”
Example of exceptional frame drop performance achieved through iterative refresh rate tuning.
Important Note on GPU Behavior: Be aware that GPUs might exhibit inconsistent behavior in certain refresh rate ranges. You might encounter situations where adjustments that should increase the refresh rate actually cause it to decrease. If you encounter such behavior, you may need to experiment with timings and work around these problematic regions through trial and error.
10. Calculate Audio/Video Clock Deviation Factor
Once you have achieved optimal results for your initial refresh rate (e.g., 50.00067942Hz in our example), you can calculate the deviation factor between your audio and video clocks.
*Deviation Factor = Optimized Refresh Rate / (2 Base Video Frame Rate)**
In our 50Hz example (assuming 25fps source content, madVR displays double the frame rate), the calculation is:
50.00067942 Hz / (2 * 25.00 Hz) = 1.0000135884.
The video clock deviation, in this case, is approximately -13.588 ppm (calculated as (1 – 1.0000135884) * 1,000,000).
11. Apply Deviation Factor to Other Refresh Rates
You can now apply this calculated deviation factor to determine optimized refresh rates for other frame rates, such as 23.976fps content.
For 23.976fps, the target refresh rate would be: 23.976 Hz * 1.0000135884 = 23.97635580 Hz.
Since some displays or systems may not accept refresh rates this low, you might need to double it: 47.952 Hz * 1.0000135884 = 47.95265159 Hz.
Apply this new calculated refresh rate in CRU and test playback. In our example, using 47.95265159 Hz resulted in “1 frame drop every 17.43 hours.”
madVR OSD displaying good frame drop performance for 23.976fps content after applying the calculated deviation factor.
Further refinement might lead to even better results, such as “1 frame drop every 1.22 days” for 23.976fps content.
Exceptional frame drop performance achieved for 23.976fps content through refined refresh rate adjustments.
Final Considerations
Keep in mind that clock deviation can fluctuate with temperature. Therefore, aiming for the lowest possible frame drop/repeat rate provides a safety margin to accommodate clock variations during extended playback sessions or changes in room temperature. Periodic testing and adjustments may be beneficial to maintain optimal performance under different conditions.
By following these steps and iteratively refining your custom refresh rates, you can significantly minimize frame drops and repeats when using madVR with Kodi or other DirectShow players, achieving a noticeably smoother and more enjoyable viewing experience. A special thank you again to hannes69 for his invaluable contributions and shared knowledge that made this guide possible.