Log in

View Full Version : How to remove MVTools artifacts when using MFlowFps?


Reino
16th February 2014, 23:37
Hello,

I'm making a compilation video of a tabletennis match where at some point I want to do slomo. With ConvertFPS(200).AssumeFPS(50,true).SSRC(48000) or ConvertFPS(200).AssumeFPS(50).TimeStretch(tempo=25), I get the desired result, but after some searching and reading I noticed I can always do better with MVTools;

BX3=AudioDub(LWLibavVideoSource("00024.mkv"),LWLibavAudioSource("00024.mkv")) #1080p50 source

function SmoothFps(clip source, float fps) {
fp=fps*100
super=MSuper(source)
mvbw=MAnalyse(super,isb=true,overlap=4)
mvfw=MAnalyse(super,overlap=4)
return MFlowFps(source,super,mvbw,mvfw,num=int(fp),den=100).AssumeFPS(source)
}

...
#BX3.Trim(6026,6100).ConvertFPS(200).AssumeFPS(50).TimeStretch(tempo=25)
#BX3.Trim(6026,6100).ConvertFPS(200).AssumeFPS(50,true).SSRC(48000)
SmoothFps(BX3.Trim(6026,6100),200)

Y=ConvertToY8().Spline36Resize(1280,720)
U=UtoY8().Spline36Resize(1280,720,src_left=0.25)
V=VtoY8().Spline36Resize(1280,720,src_left=0.25)
YToUV(U,V,Y)With function SmoothFps I'm getting these 'artifacts':
http://www.ld-host.de/uploads/thumbnails/edaf451c6c206179c0bbfc7d88d0eb91.jpg (http://www.ld-host.de/uploads/images/edaf451c6c206179c0bbfc7d88d0eb91.jpg)

I've tried numerous MAnalyse settings without succes, so I was wondering if anyone more experienced with MVTools can lend me a hand, because this is the first time I'm using MVTools.

I've uploaded a lossless YV24 version of...
BX3=AudioDub(LWLibavVideoSource("00024.mkv"),LWLibavAudioSource("00024.mkv")) #1080p50 source

BX3.Trim(6026,6100)

Y=ConvertToY8().Spline36Resize(1280,720)
U=UtoY8().Spline36Resize(1280,720,src_left=0.25)
V=VtoY8().Spline36Resize(1280,720,src_left=0.25)
YToUV(U,V,Y)... here (http://www.mediafire.com/download/48lgqq6qehy9qrm/TT-sample.mkv), so you can play with it yourself.
Thanks in advance!

raffriff42
17th February 2014, 03:50
Tested with Interframe. I was surprised to find any tuning except "smooth" fixes this artifact. "Film" tuning seems to give the most natural-looking motion blur here. #Last = "TT-sample.mkv"

## this is for testing only - you will want to call Interframe *before* converting to 4:4:4
ConvertToYV12(matrix="Rec709", chromaresample="spline16")

InterFrame(Preset="medium", Tuning="film", NewNum=200, NewDen=1)
AssumeFPS(50)
https://www.dropbox.com/s/3uyriz7fu8u484a/TT-sample-IF200-1s.jpg?raw=1

https://www.dropbox.com/s/gmi4wxamfd8pqqj/TT-sample-IF200-1f.jpg?raw=1

johnmeyer
17th February 2014, 05:39
That is a typical artifact which you will get with all motion estimation slow motion software, including expensive commercial products, like Twixtor.

I suggest you try explicitly setting the block size. I often get better slo-mo restuls when using a larger block size, like 16 (default is 8). You can also experiment with block overlap, although that probably won't help much. You can also experiment with the "search" parameter. Try setting this to "3."

None of these things will give you perfect slow motion every time because motion estimation algorithms have several known failure scenarios, such as people's legs as they walk, or panning horizontally across a picket fence. However, you should be able to get better results if you tweak these things.

You may find some interesting ideas in this old post:

MVTools2 artifacts, but only at high resolution (http://forum.doom9.org/showthread.php?p=1576719#post1576719)

This is a thread that I started, and while it is not about slow motion, the technology is actually identical, and the problems and solutions discussed will apply to what you are trying to do. If you read to the end, you'll see that scene detection parameters can cause problems if not set correction.

Reino
17th February 2014, 15:25
Thanks for all your replies.
Alright, with...
function Smoothfps(clip source, float fps) {
fp=fps*100
super=MSuper(source)
mvbw=MAnalyse(super,blksize=32,isb=true,overlap=8)
mvfw=MAnalyse(super,blksize=32,overlap=8)
return MFlowFps(source,super,mvbw,mvfw,num=int(fp),den=100).AssumeFPS(source)
}...I did manage to fix the 'artifact'.

I also gave SVPflow a try...
SetMTMode(3,4)
BX3=AudioDub(LWLibavVideoSource("00024.mkv"),LWLibavAudioSource("00024.mkv")) #1080p50 source

SetMTMode(2)
super_params="{pel:2,gpu:0}"
analyse_params="{block:{w:32,h:32},
main:{search:{coarse:{distance:-10}}},
refine:[{thsad:200}]
}"

smoothfps_params="{info:true,rate:{num:30,den:16,abs:false},scene:{mode:0,limits:{scene:8500}},algo:21,cubic:1}"

super = SVSuper(super_params)
vectors = SVAnalyse(super, analyse_params)
SVSmoothFps(super, vectors, smoothfps_params, mt=threads)...but no matter what, I constantly get "invalid argument for SVSuper".

Finally I gave InterFrame a try. InterFrame worked right away (but without the GPU, because it produced a wobbly image with the GPU). It looks just a bit better than Smoothfps and is bit faster too.
This is the script for the entire shot:
SetMTMode(3,4)
BX3=AudioDub(LWLibavVideoSource("00024.mkv"),LWLibavAudioSource("00024.mkv"))

BX3a=BX3.Trim(5900,6300)
SetMTMode(2)
BX3b=Reverse(BX3a.TemporalSoften(2,255,30).Selectevery(4).AssumeFPS(50).TemporalSoften(1,255,30, scenechange=39, mode=2))
BX3c=BX3.Trim(5900,6025)
BX3dv=InterFrame(BX3.Trim(6026,6100),"medium","film",200,1,Cores=4).AssumeFPS(50)
BX3da=BX3.Trim(6026,6100).ConvertFPS(200).AssumeFPS(50).TimeStretch(tempo=25)
#BX3da=BX3.Trim(6026,6100).ConvertFPS(200).AssumeFPS(50,true).SSRC(48000)
BX3e=BX3.Trim(6101,6300)
BX3a++BX3b++BX3c++AudioDub(BX3dv,BX3da)++BX3e
FadeIO(50)

FFT3DFilter(sigma=3, sharpen=0.5)

Y=ConvertToY8().Spline36Resize(1280,720)
U=UtoY8().Spline36Resize(1280,720,src_left=0.25)
V=VtoY8().Spline36Resize(1280,720,src_left=0.25)
YToUV(U,V,Y)

rew=ImageSource("rew.png", fps=50)
rewMask=ImageSource("rew.png", end=0, fps=50).Invert()
a=rewMask.Loop(404).Animate(388,404,"Levels", 0,1.0,255,0,0, 0,1.0,255,0,256)
b=rewMask.Loop(16).Animate(0,16,"Levels", 0,1.0,255,0,256, 0,1.0,255,0,0)
c=rewMask.Loop(16).Animate(0,16,"Levels", 0,1.0,255,0,0, 0,1.0,255,0,256)
d=rewMask.Loop(17).Animate(0,16,"Levels", 0,1.0,255,0,256, 0,1.0,255,0,0)
e=a+Loop((b+c),3)+d
Overlay(last,rew,mode="multiply",mask=e)
And Paul_slomo_Interframe_denoise.mkv (http://www.mediafire.com/download/e4ja7yonmh6wowj/Paul_slomo_Interframe_denoise.mkv) (720p50,yuv420p,crf21) is the end result.

Notes
- I first had SetMode(2) just before BX3dv, but this totally screwed up BX3b.
- Paul_slomo_Interframe_denoise.mkv contains 2 audiotracks; both BX3da lines. I can't make up my mind. Which one do you prefer?

Gavino
17th February 2014, 17:08
no matter what, I constantly get "invalid argument for SVSuper".
I expect this is because 'last' is not set.

Change this line:
BX3=AudioDub(...)
and remove the assignment to BX3 (which is not used), leaving:
AudioDub(...)

Reino
18th February 2014, 23:28
You're right. My mistake. It works when I add BX3 to SVSuper and SVSmoothFPS, except that my cpu somehow doesn't support {cubic:1}...
But anyway, my question has been answered and I prefer to use Interframe. The others are too complicated working with. Thank you all.