Time interpolation seems not to be effective
I'm currently running mpv version git-532f05b from the Ubuntu package 2:0.12.0+git installed from the PPA at: https://launchpad.net/~mc3man/+archive/ubuntu/mpv-tests I would really like to make the time interpolation ("smoothmotion") feature work, but whichever combination of options I try, it seems like it's not effective: my video stutters, either when reproduced in a window, or when reproduced full-screen. As a reference, I use "my own eye" and compare the same video played with other players (that do not do any time interpolation) or through an set-top box on my Sharp TV (which instead is a 100 MHz LED TV with the feature that is usually called "movie mode", "natural motion" or alike). I consider myself very sensitive to fluid motions, so I don't think it's just a wrong feeling, especially when I see the same video being very smooth on my Sharp TV.
Let's go to the facts. I'm running mpv on my system, a HP notebook with Haswell i5 CPU (using the embedded Intel graphics). It's running Linux Mint 17.2 KDE edition (based and on par with current Ubuntu 14.04). The Linux kernel I'm using is 3.19.0-30-generic #33~14.04.1-Ubuntu SMP for amd64 architecture.
My mpv config file is ~/.config/mpv/mpv.conf and contains the following:
vo=opengl-hq:interpolation
hwdec=vaapi
hwdec-codecs=h264,vc1,wmv3,mpeg2video
ao=pulse
display-fps=60
swapinterval=1
sub-forced-only
keep-open
force-window
My KDE is configured in this way: the compositor type is OpenGL 3.1, the QT graphics system is Raster, VSync is set to "redraw the whole scene".
What I'm trying to play right now is a 23.976100 fps AVI video (Xvid codec) on my notebook display running at 60 Hz.
Please let me know if you need more information to try to understand if something can be done.
Quoting a madVR guide here
What Smooth Motion is not, is a frame interpolation system—it will not introduce the “soap opera effect” like you see on 120Hz+ TVs, or reduce 24p judder. Smooth Motion is designed to display content where the source framerate does not match up to any of the refresh rates that your display supports. For example, that would be 25/50fps content on a 60Hz-only display, or 24p content on a 60Hz-only display.
MPV's smoothmotion is a copy of madVR, so that's that
Are you sure your intel GPU is capable of rendering opengl-hq with interpolation using the mesa version of kernel 3.19? Particularly the fbo-format can cause lots of stuttering when set to float on intel GPUs and older mesa drivers.
We have our own explanations: https://github.com/mpv-player/mpv/wiki/Interpolation
Also, overriding display-fps will almost certainly give you slightly wrong results, don't know how much it matters though.
@Ricardo1991 and @wm4 I understand that smoothmotion is not the same as motion-based interpolation, but if the final result is as non-smooth as the normal 3:2 pulldown technique, what is all about? I mean, what I would have expected is something that is somewhat middle way between the result of my TV interpolation algorithm and no interpolation... Instead, what I see is essentially no benefit at all. I already tired to remove display-fps, but I see no actual difference.
@lamarpavel Honestly, I don't know. I'm using the default (open-source) drivers for my Intel chipset (i915 driver I think). I don't even know if there's something else available (I know Intel does not provide any proprietary drivers). In case, what may I try? I read about fbo-format, but since I'm not specifying it isn't the default rgba16 applied (which is non-float, I guess)?
Couldn't my problem be related to vsync not working correctly due to the KDE compositor interfering? Is there something I can check to determine if this is the case?
Many things could ruin it. You should try enabling display sync (--video-sync=display-resample or --video-sync=display-desync). If it behaves erratic, it's safe to say mpv isn't achieving any form of locking to the monitor's refresh rate.
I tried both --video-sync=display-resample and --video-sync=display-desync: how can I determine if it behaves erratic? If you mean that something clearly wrong should happen on video playback, I would say that it isn't my case, because I couldn't notice any actual difference after changing that option.
Make sure whether it enabled itself (might depend on the file etc.). You can see on the terminal status line. It will show additional things there. If that works, look at the A/V sync field. If it jitters around heavily by more than 0.001, there's something wrong.
The interpolation is too much for my system (i3-5010u, my limitation is the GPU, the TDP goes from ~0.8 to 3.5 when I enable interpolation according to turbostat and GPU usage goes from ~25% to 99% in intel_gpu_top), so I use the --video-sync=display-resample with a script to change the monitor refresh rate / --speed and get pretty good results.
~~The --video-sync=display-resample does increase the CPU load considerably(CPU TDP goes from ~4 to ~10 watts), but it is still under the limits of the CPU.~~
The --video-sync=display-resample does increase the CPU load considerably(CPU TDP goes from ~4 to ~10 watts), but it is still under the limits of the CPU.
That's odd. It shouldn't increase CPU not that much. It does put more load on the GPU, if the video framerate is different from the monitor's.
You're right, I was testing a bunch of videos so I got things mixed up, I retested, it's not a huge difference at all, I'd say it's even almost identical (Edit: I meant CPU/GPU usage is almost identical with --video-sync=display-resample on or off).
I think it's because I was testing VP9 (no hw accel) vs h264.
--video-sync=display-resample does make a visible difference, it seems to get rid of a visible hitching that happens once in a while, which is great.
it seems to get rid of a visible hitching that happens once in a while, which is great.
That's what it's supposed to do. It will also give interpolation better timing to work with.
@mauromol
I don't even know if there's something else available (I know Intel does not provide any proprietary drivers). In case, what may I try?
The open source drivers of intel are the only ones available and they are fine in general, but they build ontop of the mesa stack, which had some major developments in the past two years, most recently the jump to OpenGL 4 with kernel 4.2. So using newer mesa drivers than those provided with kernel 3.19 could have a noticable effect on performance, depending on the implementation of mpvs filters (I haven't looked at the GLSL code, but there are more things to consider than the #version).
In general though, interpolation from 23.976 to 60 FPS is no joke, my i5 ivy bridge GPU can't handle that. You are correct about the default for fbo-format though, it's rgba16 (integer) by default.
@lamarpavel My i5 is a Haswell one, so I think it should handle that too. In any case, I tried to change the fbo-format parameter to rgba32f and it seems to work fine (I would say even better than before, from a video quality point of view, but I can't quantify at all - maybe it's just a feeling). What I can say for sure is that neither rgb32f nor rgb16f (without "a") seem to work properly, because errors are printed in the terminal when mpv tries to set up a shader in the GPU (sorry if I use wrong terms, I'm not a gfx expert).
@wm4
I will check the terminal status line as soon as possible, thank you. In any case, if I understand it correctly, --video-sync=display-resample is something I would want to keep in my "stable" config file for best video quality...
I have the same behaviour on my intel GPU regarding textures without alpha, mpv needs to be set to rgbaX or rgbaXf. Your haswell GPU might be a bit faster or a lot (if it is an iris) than the ivy bridge, but the drivers you have might not be optimized for the computation that interpolation is performing and the step from 23.976 to 60 is honestly quite huge. It's been some time since I wrote GLSL shaders, but based on the shader code I'd say the time interpolation requires more computation than say any shader you would find in a game from the 2004-2006 era (eg. HL2).
I've been testing --video-sync=display-resample CPU/GPU usage on more files, on some files, it makes barely any difference in CPU / GPU usage, but on some files it makes the GPU usage very high and the video jerks around.
I have to head out, but will do more tests later.
This is going to depend on video resolution, framerate, and bitness.
@wm4
I tested better with --video-sync=display-resample: my status line is something like this:
[statusline] AV: 00:00:49 / 00:58:31 (1%) A-V: 0.010 DS: -0.00945% Cache: 10s+73MB
The A-V field fluctuates indeed. After letting the video play for some dozen seconds, it is under 0.010, but it may assume various values between 0.000 and 0.007 (it's hard to distinguish, values change rapidly). The DS field, instead, is more stable and is mostly +0.11570%, rarely changing to +0.24084%.
With --video-sync=display-desync the A-V value slowly grows, but if I understand the meaning of that option well, I would say it's normal... isn'it?
What do you think?
What driver? Fullscreen or windowed? What display FPS does it report (see /mpv file.mkv -v |grep FPS)?
With --video-sync=display-desync the A-V value slowly grows, but if I understand the meaning of that option well, I would say it's normal... isn'it?
Yes. But if display-resample fluctuates, this should fluctuate as well, or there's a different problem.
Driver: opengl-hq
Fullscreen or windowed: it's the same, I see no difference when the video is played windowed or fullscreen
I'll try to better explain what I see: with --video-sync=display-resample the video starts with DS: +0.11570% and A-V -0.039, that the A-V (which fluctuates continuously) slowly goes down until it reaches 0.000, then the DS is changed to +0.24084% and A-V fluctuates around values within -0.008 and 0.000. When it reaches 0, the DS is changed again to +0.11570% and A-V again fluctuates between -0.008 and 0.000, then DS is changed again to +0.24084% and so on.
If I grep for "FPS" I see this:
[vo/opengl-hq/x11] Display 0 (eDP1): [0, 0, 1366, 768] @ 60.009178 FPS
[vo/opengl-hq/x11] Current display FPS: 60.009178
[vo/opengl-hq] Assuming 60.009178 FPS for framedrop.
[vd] Container reported FPS: 23.976101
These numbers seem correct to me.
With display-desync, the DS value still fluctuates, but the mean value instead of decreasing down to 0, to continuously slowly grows up.