Linux HOW-TO achieve perfect playback at 23.97 or 59.94 Hz with NVIDIA GPU hardware - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33) +--- Forum: Tips, tricks, and step by step guides (https://forum.kodi.tv/forumdisplay.php?fid=110) +--- Thread: Linux HOW-TO achieve perfect playback at 23.97 or 59.94 Hz with NVIDIA GPU hardware (/showthread.php?tid=70068) |
HOW-TO achieve perfect playback at 23.97 or 59.94 Hz with NVIDIA GPU hardware - JumJum - 2010-03-17 OUTDATED with NVidia driver 302.17!!!!! (It has support for xrandr 1.2/1.3 and can distinguish between 23.976 and 24) Howto achieve judder free perfectly synced playback. Since there's a lot of misinformation in the forum about how xorg display modes works, I though I'd post a howto and explain how to do it the (in my opinion) right way. First of all, modelines are not a the magic solution to all your problems. Modelines are only needed with tv's that have faulty EDID information. Most TVs provide the correct modes for 29.97/59.94 Hz, but the modes are not used by xrandr by default, so XBMC can't see that they are available. To check how ~24 and ~60 Hz modes are currently handled on your setup you can run the following command: (XBMC Live doesn't have libgtk, which is required by nvidia-settings. Either check the refresh inside XBMC instead by pausing a video and pressing "o", or run "sudo apt-get install libgtk2.0-0".) Code: for i in 24 60; do xrandr -r $i; nvidia-settings -q RefreshRate | grep -o "[0-9][0-9].*Hz"; done The steps needed to set everything up are:
Automatic installation All the steps can be performed automatically by dropping to a shell by pressing CTRL-ALT-F1 and running this script either by using copy & paste to an empty file or by downloading it using: Code: curl "http://pastebin.com/download.php?i=bU1QFQ3c" | tr -d \\r > nvidia.sh Code: sh nvidia.sh The script has been tested on
If you don't trust my bash scripting skills. (Nobody's perfect... ) Here's how to do it step by step: Manual installation Backing up your current settings Code: mkdir $HOME/old; cp /etc/X11/xorg.conf $HOME/.nvidia-settings-rc $HOME/.xbmc/userdata/guisettings.xml $HOME/old 2>/dev/null Code: wget "http://pastebin.com/download.php?i=5xAKDHNi" -O ~/nvidia-xorg.conf Code: Section "Device" This is all that is needed. Don't use options you don't understand! Explanations to all the options can be found in the NVIDIA drivers manual. The ModeDebug option makes the nvidia driver print all the available modes to Xorg's log file. 2. Finding what modes the TV says it supports in it's EDID. Now that ModeDebug is enabled Xorg needs to be restarted so the available modes will be written to the log file. Hook up your HDMI cable and restart Xorg. Code: sudo service gdm restart Code: sudo service xbmc-live stop Code: sed -n '/- Modes/,/- End/p' /var/log/Xorg.0.log | sed 's/.*(0)://g' > $HOME/Desktop/modes.txt Open up modes.txt and /etc/X11/xorg.conf in your favourite editor. Code: nano $HOME/Desktop/modes.txt Code: --- Modes in ModePool for Philips FTV (DFP-1) --- My TV supports both both 60 and 59.94 Hz. The left column is the name of the mode. As you can see both modes have names that start with "1920x1080_60". Since xrandr can't have two ~60 Hz modes available at the same time, we need to tell it to use the 59.94 Hz mode when switching to a ~60 Hz refresh rate. Same needs to be done with the ~24 Hz mode. The two modes I want are called "1920x1080_60_0" and "1920x1080_24_0" since they provide the correct refresh rates. To enable these, paste the names of the modes to the Modes-line of /etc/X11/xorg.conf replacing the current setting. The first mode on the line will be your default mode. In my case it looks like this when done: Code: Modes "1920x1080_60_0" "1920x1080_24_0" Code: sudo service gdm restart Code: sudo service xbmc-live stop To enable all the right and disable all the wrong options in the drivers you can run this command: (Not needed on XBMC Live) Code: export DISPLAY=:0; nvidia-settings -a "SyncToVBlank=1" -a "AllowFlipping=1" -a "FSAAAppControlled=1" -a "OpenGLImageSettings=3" -a "LogAniso=0" -a "GPUScaling[DFP-1]=1,1"; nvidia-settings -r 5. Adjusting the settings in XBMC. In XBMC you want to set "Render method" to Auto, "Use pixel buffer objects" to On, "Adjust display refresh..." to On, "Sync playback to display" to On, A/V sync method to "Audio" and "Vertical blank sync" to Always. Voila, XBMC now automatically switches between 23.97, 50, and 59.94 Hz for 23.97, 25 and 29.97 FPS content respectively. Two settings that you might want to try if you run into trouble is setting "Sync playback to display" to Off in XBMC and/or change NoFlip to "false" in /etc/X11/xorg.conf. Restoring your previous settings Your Xorg settings: Code: sudo cp $HOME/old/xorg.conf /etc/X11/xorg.conf Code: cp $HOME/old/.nvidia-settings-rc $HOME; nvidia-settings -l Code: cp $HOME/old/guisettings.xml $HOME/.xbmc/userdata Forcing target refresh rates for ranges of source fps advancedsettings.xml Code: <advancedsettings> - finite3 - 2010-03-18 Thanks - for reference sake, the script ran just fine under xbmcfreak v11 live. - Ayla - 2010-03-18 Thanks... In the other thread recovered, it says that: ""Sync playback to display" to On, A/V sync method to "Audio"" should be OFF, because it speeds up 23.976 to 24.000. Here it says it should be ON. What is the correct way to do it? - JumJum - 2010-03-18 Ayla Wrote:Thanks... That was incorrect information. It does not speed up the video at all. This is the correct way to do it. - Ayla - 2010-03-18 Thanks for that, I will try it when I get home! The only problem I have is, that I need to set a sound delay of 200ms for all my movies to be in sync, but when I save it with "Set as default for all movies", it only lasts until XBMC restarts... then it forgets the 200ms delay setting and resets it to zero. Anyone else experiencing that? PS. I only need the 200ms delay for 23.976hz movies (not 50hz videos). That's a bit strange!? - Ayla - 2010-03-18 Another problem I have is that sometimes XBMC doesn't switch back to 1080p@60hz resolution when I stop a movie. I always use 1080p@60hz when browsing in XBMC and when I start a 23.976hz movie, the resolution switches like it should to 1080p@24hz. Then I press Stop and return to the menu and once in a while XBMC stays in 1080p@24hz instead of switching back to 1080p@60hz. This is rather annoying as I have to go to Settings and switch back to 1080p@60hz manually every time. Anyone else experiencing this or have a solution? Thanks - JumJum - 2010-03-18 Ayla Wrote:Thanks for that, I will try it when I get home! Works fine here. You can check if it's saved at all with: Code: grep audiodelay ~/.xbmc/userdata/guisettings.xml Also, make a backup of guisettings.xml and see if the problem still exists after xbmc creates a fresh one. I once had a similar issue but with screen calibration settings. Create a new thread for this issue if that doesn't work. - bobo1on1 - 2010-03-18 Ayla Wrote:Another problem I have is that sometimes XBMC doesn't switch back to 1080p@60hz resolution when I stop a movie. What revision are you running? - Ayla - 2010-03-18 bobo1on1 Wrote:What revision are you running? I'm using the latest "safe" build, r28256. - coupas - 2010-03-18 I just wanted to say thanks for this post. It saved me a lot of time and everything works pretty good for me now. Not perfect, but good enough. Thanks! - sonic - 2010-03-18 Nice script!. I get this error when running the script on my newly installed system. Anyone who can help me fix it?, because nvidia-settings --help doesnt help me much . I can add that I am new to linux. 5/6 Applying NVIDIA settings No protocol specified ERROR: The control display is undefined; please run `nvidia-settings --help` for usage information. No protocol specified ERROR: The control display is undefined; please run `nvidia-settings --help` for usage information. EDIT: Hmmm everything seems to be working as it should, even with the error . - JumJum - 2010-03-19 sonic Wrote:Nice script!. I get this error when running the script on my newly installed system. Anyone who can help me fix it?, because nvidia-settings --help doesnt help me much . I can add that I am new to linux. This part is acctually not needed if you have a newly installed system, so you're good! - Matija - 2010-03-19 Just a short question. I have problems with video jutter and tear and a lot people say it's due to xorg.conf, would your solution solve this? Thank you in advance. - johnskiller - 2010-03-19 which refresh rate should I use for 29.97 movie? 1920x1080_30 or 1920x1080_0? Also if my tv support 25Hz, should I use it instead of 50Hz for some PAL TV show? I have a movie that has lots of jutter and tear when use 24Hz, but played well when use 60Hz. the movie is 24p(or 23.97, not sure), any idear? - Matija - 2010-03-19 Matija Wrote:Just a short question. I have problems with video jutter and tear and a lot people say it's due to xorg.conf, would your solution solve this? Sorted by using your script! Worked awesome, thanks again! |