Smoothvideo ("Sync playback to display" feature) now merged in the mainline branch - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Discussions (https://forum.kodi.tv/forumdisplay.php?fid=222) +--- Forum: Kodi related discussions (https://forum.kodi.tv/forumdisplay.php?fid=6) +--- Thread: Smoothvideo ("Sync playback to display" feature) now merged in the mainline branch (/showthread.php?tid=51054) |
Smoothvideo ("Sync playback to display" feature) now merged in the mainline branch - bobo1on1 - 2009-05-15 Since smoothvideo has been merged into linuxport and the old thread contains replies about the former implementation (which relied on opengl vsync for timing) the discussion will continue here. What is it for? Lots of people experience jerkiness when playing video on a computer, this has to do with the way video frames are presented, smoothvideo tries to fix this by syncing the video to the refreshrate of the monitor. It's like the reclock directshow filter, only much better. How does it work? Usually video is referenced to the system clock, but with a little magic a clock can be made with information from the videocard, this makes sure every frame is presented right after a vblank. Also because the clock can now be controlled, the speed can be changed a little so the fps of the video playing matches the refreshrate. What about audio? Audio has to stay in sync, this can either be done by resampling, skipping/duplicating packets, or adjusting the clock if it gets out of sync too far. Resampling has the advantage that the speed of the video can be changed considerably, so 24 fps can be sped up to 25 fps to play at PAL speed. The disadvantage of resampling is that it doesn't work with passthrough, and there is a slight loss of audio quality. Skipping/duplicating audiopackets has no loss of audio quality, but the speed of the video can only be changed a little to avoid doing a skip/duplication too often, most of the time it's inaudible, but it can produce a very audible click. Adjusting the clock has the best audioquality, but some extra video jitter can occur, also the speed of the video can't change much, as the audio will sync the clock more often the more the speed of the video is changed. How do I turn it on? Under Settings->Videos->Player there are several new options:
What about the adjust refreshrate option? That's something different, it will automatically set the refreshrate which is best matched with the video that is playing, but it is a good combination with the vblank clock. How do I know it's working? Turn on debug logging, turn on Sync playback to display and start a video, then search the debug log for CVideoReferenceClock. Mine looks like this (on ubuntu with the binary nvidia driver): Quote:21:09:39 T:2874137488 M:1382379520 DEBUG: CVideoReferenceClock: Setting up GLX Here I'm playing a 29.97 fps video on a monitor with a 60 hertz refreshrate, the speed of the clock is increased by 0.1% so the video wil play at exactly 30 fps. The rounding of the refreshrate from 59.89 to 60 hertz does NOT matter. Why? because of the automatic change in clock speed. Now press 'o' while playing to bring up the codec information, if the vblank clock is running it will show "VBlanks missed:" with a number next to it, that number shows how many updates the vblank clock has missed, this can either be because the update was too late or it missed a vblank completely and it's waiting for the next vblank. This is not especially bad, because the render thread will update the clock instead. However if that number increases really fast it can mean the clock is not running at all or it's missing a lot of vblanks, in which case you might get some strange pitch effects when resampling and even jerky video. If you get a like like this in the debug log: Quote:CVideoReferenceClock: Setup failed, falling back to QueryPerformanceCounter It means it couldn't set up the clock and it uses the systemclock instead, the lines containing CVideoReferenceClock above it will usually explain what went wrong. Known issues Some videos don't provide correct fps information, so they'll play jerky anyway. Crashes in linux with the binary ati driver. On windows the detected refreshrate might be wrong, to fix this you can turn on measurerefreshrate in Advancedsettings.xml. - SlaveUnit - 2009-05-15 I get very similar actions http://forum.xbmc.org/showpost.php?p=336233&postcount=322 I can play something at a certain framerate, but after stopping it I get jerkiness on other vids at different framrates. I can restart XBMC and all is smooth again. This repeats. this may have nothing to do with the Smoothbranch (even though its in the main branch now). It seems like XBMC gets thrown off. Almost like it needs an HZ reset once a video is done playing? Bobo1on1, When you state.. Known issues Some videos don't provide correct fps information, so they'll play jerky anyway. Do you mean that the videos themselves are reporting incorrectly or XBMC itself is reporting them incorrectly? Thanks for all the hard work on this. Everyone has made so much progress in such a short amount of time its insane for a open source product. - Louike - 2009-05-15 edit: i had to disable trippe buffering (and remove d3overider) to get rid of tearing in the top quarter of the screen. - wildonrio - 2009-05-15 What's the latest revision that includes it? - SlaveUnit - 2009-05-15 They all include it as of yesterday. Is that what you are asking? - wildonrio - 2009-05-16 Yeah that works. Just making sure my version has it already. - seeker83 - 2009-05-16 Well, adjust refresh rate on windows vista is still broken. I just tried a bunch of setting combiations, and none worked. The ONLY way to get the correct 24fps output for me is to set desktop to 24Hz AND run XBMC in window mode (where refresh rate is ignored) or fullscreen at 24hz. The "Adjust Refresh Rate" setting sure tries to change the refreshrate in other modes, but it fails in all of them, resulting in 60Hz Here's a partial debug log (only the most important messages) for playing a few different movies while running windows at 60hz, xbmc set to 1080p fullscreen and adjust refresh rate enabled: Code: 23:51:40 T:8744 M:1223294976 NOTICE: Desktop Resolution: 1920x1080 32Bit at 60Hz "Unable to register window class", "CreateDevice returned D3DERR_DEVICELOST" and "CThread:taticThread : Access violation at 0x006009dc" sure looks suspicios to me, but I don't know what to make of it... - bobo1on1 - 2009-05-16 Well, I don't know what the refreshrate change issue is, but the other issues I probably fixed in revisions 20329 and 20335. - SlaveUnit - 2009-05-16 What SVN you running? - bartdesign - 2009-05-16 20338 is running smooth as butter on ubuntu. Thanks bobo1on1, that makes movie watching a whole lot more enjoyable - hikaricore - 2009-05-16 bartdesign Wrote:20338 is running smooth as butter on ubuntu. I hate to go offtopic but your rattie or possibly mouse is cute. ^_^ - dteirney - 2009-05-16 Quote:Crashes in linux with the binary ati driver. Is this known issue with the ATI driver able to be resolved at some point or does it rely on the vsync stuff working without chewing up 100% CPU? By binary ATI driver I assume you mean the latest Catalyst fglrx driver (what I'm using). I just turned this on this new functionality to see what happened and the xbmc.bin process locked up hard. Couldn't even kill it using sudo kill -9. Had to restart the box. - Hitcher - 2009-05-16 It seems to start working and then fails. Code: CVideoReferenceClock: Setting up Direct3d on adapter 0 Any other attempt after that, even after restarting XBMC, always results in this - Code: CVideoReferenceClock: CreateDevice returned D3DERR_DEVICELOST The only time I'll see it detecting the refresh rate again is after a reboot of Vista. Full debug log. EDIT: Build 20361. - bartdesign - 2009-05-16 hikaricore Wrote:I hate to go offtopic but your rattie or possibly mouse is cute. ^_^It's my rat. Rats rule, they are very intelligent. - Louike - 2009-05-16 bartdesign Wrote:It's my rat. Rats rule, they are very intelligent. is it planning to take over the world? |