Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 8th June 2018, 02:15   #41  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,079
From MysteryX
Quote:
With FrameRateConverter I have a pretty good algorithm for detecting artifacts but there's just no other backup plan than blending frames in those areas
From lansing
Quote:
Frame blending just doesn't look good on hand waving because on playback, it makes it looking like Matrix.
I believe that these artifacts have nothing to do with falling back to frame blending when artifacts are detected. I ran the source through the old original johnmeyer script from this post
https://forum.doom9.org/showthread.p...39#post1800439

and the artifacts were identical to the ones caused by FramerateConverter. And the johnmeyer script does not do any frame blending.

Cheers
manolito
manolito is offline   Reply With Quote
Old 8th June 2018, 02:29   #42  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,374
Quote:
Originally Posted by johnmeyer View Post
Which one is on the left? You didn't label them. The one on the left looks like standard ME, so I assume it is Twixtor, but maybe I'm wrong.
The order of presentation correlates with the order of text. So, left=dimitri , right=twixtor + track points. Note, that "automatic" or default twixtor looks a lot like mvtools2 results . Sometimes you need a bit of guidance for the motion estimation to make a shot usable.


Quote:
Originally Posted by manolito View Post

I believe that these artifacts have nothing to do with falling back to frame blending when artifacts are detected. I ran the source through the old original johnmeyer script from this post
https://forum.doom9.org/showthread.p...39#post1800439

and the artifacts were identical to the ones caused by FramerateConverter. And the johnmeyer script does not do any frame blending.
I agree, the "blending" is just mvtools2



I also tried ffmpeg minterpolate
https://ffmpeg.org/ffmpeg-filters.html#minterpolate

The default settings, are a lot like mvtools2, and you end up with frame blending, but occlusion and morphing artifacts with the default mode (There are many other settings you can play with, but only had time to play with a few)


And butterflow
https://github.com/dthpham/butterflow

All command line driven (well I guess ffmpeg minterpolate is too... ) but this can use OpenCL . This resulted in almost pure blending, so meh.. but I used the 0.2.4 dev version, not sure if something got broken, I'll revisit 0.2.3 stable when I have time



Blending might be "bad" for realtime playback; but sometimes blobby edge morphing occlusion artifacts are worse. At least blending is consistent. pros/cons
poisondeathray is offline   Reply With Quote
Old 8th June 2018, 21:02   #43  |  Link
zorr
Registered User
 
Join Date: Mar 2018
Posts: 447
Quote:
Originally Posted by MysteryX View Post
I just use LWLibavVideoSource for everything and don't have any issue.
Thanks, now I just need to figure out which Libav binary distribution to install... do you have recommendation on that? I'm using 32bit AviSynth.

[EDIT] Or should it work without Libav installation? I got
Code:
AviSynth open failure:
[Fatal]: Failed to avformat_open_input.
when I tried it.

[EDIT2] I'm dumb. I had the file name wrong. Works perfectly now.

Last edited by zorr; 8th June 2018 at 21:46.
zorr is offline   Reply With Quote
Old 8th June 2018, 23:11   #44  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,559
L-SMASH Source
MysteryX is offline   Reply With Quote
Old 9th June 2018, 16:30   #45  |  Link
zorr
Registered User
 
Join Date: Mar 2018
Posts: 447
I tried John Meyer's frame doubling script with that hand waving video. MediaInfo says
Code:
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
so I put 2 times 23.976 as the target frame rate.

For some reason the result doesn't have all the original frames. It goes "out of sync" after frame 55, every frame (or at least most of them) are interpolated after that. Using AssumeFPS doesn't help either. I also tried setting num=48000 and den=1001 but that made it go out of sync slightly faster, after frame 53.

Here's the script I tried, it should display nothing but black if the result has original frames. Can anyone spot an error?

Code:
LWLibavVideoSource("d:\process\hand wave.mkv")

orig = last
fps = jm_fps(last, 2*23.976, 32, 2)
orig_only = fps.SelectEven()
#orig_only.AssumeFPS(23.976)
return orig.Subtract(orig_only).Histogram("luma")

# Motion Protected FPS converter script by johnmeyer from Doom9
# Slightly modified interface by manolito
# Requires MVTools V2 and RemoveGrain
# Also needs fftw3.dll in the System32 or SysWOW64 folder for Dct values other than 0
function jm_fps(clip source, float "fps", int "BlkSize", int "Dct") {
	fps = default(fps, 25.000)
	fps_num = int(fps * 1000)
	fps_den = 1000
	BlkSize = default(BlkSize, 16)
	Dct = default(Dct, 0)

#	fps_num = 48000
#	fps_den = 1001

	prefiltered = RemoveGrain(source, 22)
	super = MSuper(source, hpad = 16, vpad = 16, levels = 1, sharp = 1, rfilter = 4) # one level is enough for MRecalculate
	superfilt = MSuper(prefiltered, hpad = 16, vpad = 16, sharp = 1, rfilter = 4) # all levels for MAnalyse
	backward = MAnalyse(superfilt, isb = true, blksize = BlkSize, overlap = 4, search = 3, dct = Dct)
	forward = MAnalyse(superfilt, isb = false, blksize = BlkSize, overlap = 4, search = 3, dct = Dct)
	forward_re = MRecalculate(super, forward, blksize = 8, overlap = 2, thSAD = 100)
	backward_re = MRecalculate(super, backward, blksize = 8, overlap = 2, thSAD = 100)
	out = MFlowFps(source, super, backward_re, forward_re, num = fps_num, den = fps_den, blend = false, ml = 200, mask = 2)

	return out
}
zorr is offline   Reply With Quote
Old 9th June 2018, 17:02   #46  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,374
Quote:
Originally Posted by zorr View Post
Here's the script I tried, it should display nothing but black if the result has original frames. Can anyone spot an error?
commment out this line, replace it with fps .
Code:
#return orig.Subtract(orig_only).Histogram("luma")
It should be fps, or return fps
Code:
orig = last
fps = jm_fps(last, 2*23.976, 32, 2)
orig_only = fps.SelectEven()
#orig_only.AssumeFPS(23.976)
#return orig.Subtract(orig_only).Histogram("luma")
fps
poisondeathray is offline   Reply With Quote
Old 9th June 2018, 17:16   #47  |  Link
manolito
Registered User
 
manolito's Avatar
 
Join Date: Sep 2003
Location: Berlin, Germany
Posts: 3,079
If you want to double your frame rate and make sure that every other frame will be an original frame then you should edit the johnmeyer script like this:

Before:
Code:
out = MFlowFps(source, super, backward_re, forward_re, num = fps_num, den = fps_den, blend = false, ml = 200, mask = 2)

return out
After:
Code:
out = MFlowFps(source, super, backward_re, forward_re, num = fps_num, den = fps_den, blend = false, ml = 200, mask = 2)

out=out.selectodd()
interleave(source,out)
return last

Cheers
manolito

Last edited by manolito; 9th June 2018 at 17:19.
manolito is offline   Reply With Quote
Old 9th June 2018, 17:16   #48  |  Link
zorr
Registered User
 
Join Date: Mar 2018
Posts: 447
Quote:
Originally Posted by poisondeathray View Post
Code:
#return orig.Subtract(orig_only).Histogram("luma")
It should be fps, or return fps
Code:
orig = last
fps = jm_fps(last, 2*23.976, 32, 2)
orig_only = fps.SelectEven()
#orig_only.AssumeFPS(23.976)
#return orig.Subtract(orig_only).Histogram("luma")
fps
That's what I tried first, but I noticed the above mentioned problem. This script is just demonstrating the problem clearly, by taking every second frame from the fps clip and comparing it to the original. They should be identical but they're not.
zorr is offline   Reply With Quote
Old 9th June 2018, 17:21   #49  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,374
Oh, I see what you're doing, you're testing it . I get all black, but I'm using FFMS2 . It's probably a source filter issue

FFVideoSource("hand wave.mkv")
poisondeathray is offline   Reply With Quote
Old 9th June 2018, 17:24   #50  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,374
Yes, that's the problem. You ccan check with info()
LWLibavVideoSource returns an off framerate 23.9752 . Probably jitter in the timecodes. Add AssumeFPS(24000,1001). Framecount is correct

Or use FFMS2, which returns 24000/1001
poisondeathray is offline   Reply With Quote
Old 9th June 2018, 21:27   #51  |  Link
zorr
Registered User
 
Join Date: Mar 2018
Posts: 447
Quote:
Originally Posted by poisondeathray View Post
Yes, that's the problem. You ccan check with info()
LWLibavVideoSource returns an off framerate 23.9752 . Probably jitter in the timecodes. Add AssumeFPS(24000,1001). Framecount is correct

Or use FFMS2, which returns 24000/1001
Thanks, using AssumeFPS(24000,1001) fixes it. Or using AssumeFPS(23.976).

I thought it couldn't be a problem with the source because I also converted the mkv to Huffyuv-encoded avi and the problem occurred with that file as well. But obviously the error in framerate just propagated there.

So is FFMS2 better than LWLibavVideoSource in every way?
zorr is offline   Reply With Quote
Old 9th June 2018, 21:30   #52  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,374
Quote:
Originally Posted by zorr View Post

So is FFMS2 better than LWLibavVideoSource in every way?

No, sometimes one is preferred over the other for some types of sources. And it depends on the specific version too.

I find you need to have both, and backup plan B,C,D,E
poisondeathray is offline   Reply With Quote
Old 9th June 2018, 21:33   #53  |  Link
zorr
Registered User
 
Join Date: Mar 2018
Posts: 447
Quote:
Originally Posted by manolito View Post
If you want to double your frame rate and make sure that every other frame will be an original frame then you should edit the johnmeyer script like this:
...
That's certainly a way to achieve it, but it seems like it's just covering the real problem which is the incorrect frame rate reported by the source filter. I think the interpolation quality will suffer (perhaps not much, but who knows) when MFlowFps is working with incorrect frame rate.
zorr is offline   Reply With Quote
Old 9th June 2018, 22:57   #54  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Originally Posted by zorr View Post
That's certainly a way to achieve it, but it seems like it's just covering the real problem which is the incorrect frame rate reported by the source filter. I think the interpolation quality will suffer (perhaps not much, but who knows) when MFlowFps is working with incorrect frame rate.
Manolito posted that before it becme clear that you had a source filter problem.

Also, AssumeFPS(24000,1001) is better than AssumeFPS(23.976),
as 24000/1001 is actually 23.97602398.

EDIT: To below,
Quote:
AssumeFPS(23.976) is an alias for AssumeFPS(24000,1001) in Avisynth 2.57 and up, along with a number of other common framerates.
Thanks Foxy, I had seen in sources, detection and replacment of close to standard common framerates, indeed I do it myself in some scripts.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 10th June 2018 at 10:12.
StainlessS is offline   Reply With Quote
Old 10th June 2018, 06:01   #55  |  Link
foxyshadis
Angel of Night
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
Quote:
Originally Posted by StainlessS View Post
Manolito posted that before it becme clear that you had a source filter problem.

Also, AssumeFPS(24000,1001) is better than AssumeFPS(23.976),
as 24000/1001 is actually 23.97602398.
AssumeFPS(23.976) is an alias for AssumeFPS(24000,1001) in Avisynth 2.57 and up, along with a number of other common framerates. Still good practice to use the real fraction in case you need a non-standard framerate, though.
foxyshadis is offline   Reply With Quote
Old 10th June 2018, 21:48   #56  |  Link
zorr
Registered User
 
Join Date: Mar 2018
Posts: 447
Quote:
Originally Posted by StainlessS View Post
Manolito posted that before it becme clear that you had a source filter problem.
That's true, I didn't mean to diss his answer. Especially when he was just trying to help me. Sorry Manolito!

Quote:
Originally Posted by StainlessS View Post
Also, AssumeFPS(24000,1001) is better than AssumeFPS(23.976),
as 24000/1001 is actually 23.97602398.
I started to wonder why is it reported as 23.976 (by MediaInfo and even by AviSynth) when that's not what the correct ratio is. Maybe it's because 32bit float can only represent about 7 decimals and the correct ratio needs 8.
zorr is offline   Reply With Quote
Old 10th June 2018, 23:48   #57  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
and the correct ratio needs 8
Sorry, I just copied from my calculator, no idea how many digits required to accurately represent true result, if indeed it can be expressed in a finite number of digits.
Maybe I should have said something akin to "as 24000/1001 is actually more like 23.97602398."

EDIT: Using WinXP Calculator, Scientific mode, 23.976023976023976023976023976024, 239760 sequence recurring.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 11th June 2018 at 00:31.
StainlessS is offline   Reply With Quote
Old 11th June 2018, 00:22   #58  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 940
Quote:
Originally Posted by StainlessS View Post
Sorry, I just copied from my calculator, no idea how many digits required to accurately represent true result, if indeed it can be expressed in a finite number of digits.

Online calculators
end up repeating "976023", even if use some unbound decimal points/etc.

23.976023976023976023976023976023etc
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Old 11th June 2018, 00:35   #59  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Actually sequence starts right at the beginning, ie 239760, etc
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 11th June 2018, 01:00   #60  |  Link
Sparktank
47.952fps@71.928Hz
 
Sparktank's Avatar
 
Join Date: Mar 2011
Posts: 940
I see what happened. The coffee cup is always half empty.
__________________
Win10 (x64) build 19041
NVIDIA GeForce GTX 1060 3GB (GP106) 3071MB/GDDR5 | (r435_95-4)
NTSC | DVD: R1 | BD: A
AMD Ryzen 5 2600 @3.4GHz (6c/12th, I'm on AVX2 now!)
Sparktank is offline   Reply With Quote
Reply

Tags
motion interpolation

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 13:13.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.