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 30th September 2015, 15:09   #1  |  Link
ingoldie
Registered User
 
Join Date: Sep 2014
Posts: 132
Please help about Yushko Frame Rate Converter

I’m getting an error when I try to use Yushko Frame Rate Converter with the following script.

AVISource("C:\Program Files\AviSynth 2.5\plugins\Sample_SD.avi").YFRC()

Please download the video from the following link to see the error.
Result:
http://www.mediafire.com/file/qcepf7...0db/Result.avi

Sample_SD:
http://www.mediafire.com/file/go9nrm.../Sample_SD.avi

What am I doing wrong?

Download link for YFRC:
http://forum.doom9.org/showthread.ph...93#post1362093

Last edited by ingoldie; 26th November 2017 at 16:55.
ingoldie is offline   Reply With Quote
Old 1st October 2015, 13:29   #2  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,743
Strange, it has to be a script error (in YFRC). Or an incompatibility with YUY2 (the format of your sample).
Try this ;
Code:
AVISource("C:\Program Files\AviSynth 2.5\plugins\Sample_SD.avi")
converttoyv12()
YFRC()
If it does not help, you can try Interframe instead of YFRC.
And even if it helps actually, because Interframe is probably more recent and advanced.
For a 18 fps video, you can also convert to 54 fps and add assumefps(50) to get a more common framerate than 36, but it will be 7,4 % slower.
But in my opinion, whatever you will do, this video needs first a Deshaker or something like that.

Last edited by Music Fan; 1st October 2015 at 13:39.
Music Fan is offline   Reply With Quote
Old 1st October 2015, 17:07   #3  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
YFRC appears to be nothing more than a front end for MVTools2. Therefore, I would recommend instead simply using MVTools2. Start by using the sample scripts, given in the MVTools2 documentation, for frame rate conversion. Music Fan gave you some good advice.

You didn't provide the frame rate of the source, and the frame rate you are trying to achieve. There may be other approaches that will work more reliably than motion estimation, but the answer depends on what you are trying to do. I don't have time this week to download your various files, so you'll need to post that information.
johnmeyer is offline   Reply With Quote
Old 1st October 2015, 20:18   #4  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,743
His video is in 18 fps and seems to be a Super 8 transfer. The problematic video is in 36 fps with a strange effect.

Last edited by Music Fan; 1st October 2015 at 21:30. Reason: orthography
Music Fan is offline   Reply With Quote
Old 1st October 2015, 21:04   #5  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
I always recommend using simple pulldown (repeated fields) when going from 18 fps to 29.97 or 18 fps to 25. You never get surprises, and everything is sharp. This is the way film has been converted to video since the dawn of the video era in the late 1940s. Motion estimation (MVTools2 and its cousins) can produce great looking results in some scenes and some frames, but it fails often, and its failures are really awful. There is no way around this that I know of, even if you use $$$ motion estimation tools like Twixtor: it is simply the limitation of motion estimation.
johnmeyer is offline   Reply With Quote
Old 2nd October 2015, 00:33   #6  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Quote:
Originally Posted by johnmeyer View Post
There is no way around this that I know of, even if you use $$$ motion estimation tools like Twixtor: it is simply the limitation of motion estimation.
Yes, is no "automatic" way around the prototypical scenarios that cause optical flow to fail. It would be impossible to get 100% accuracy for some computer or algorithm, at least with today's technology.

The partial solution is manual guidance to improve the motion estimation

The "pro" versions of retiming software like twixtor pro, kronos - they have additional controls and inputs. You guide the motion estimation and optical flow vectors with motion tracking +/- manual input. So you use foreground mattes to tell the algorithm what is "background" and what is "foreground" to create separation and to delineate object edges - it reduces the edge dragging/morphing artifacts. Twixtor pro also has "track points" which the semi-automated point tracker can plug into helping guide the motion estimation. It has "splines" (essentially open or closed bezier masks) that you use to guide it - so it can keep track of changing shapes and objects which normally fool the "automatic" mode

But it can be a lot of work to fix problem frames with the advanced options , and often there is no solution despite the advanced features. But it can salvage some situations , or at least reduce the amount of pure manual work like photoshop. You might decide to use it sparingly only to "fix" a few critical scenes.

A free optical flow/retimer is slowmovideo. It's not much better than mvtools2 (or derivatives like svpflow,interframe), and probably slightly worse when used at default. But it has additional features such as editing the optical flow data to reduce occlusion artifacts, and curves to adjust speed
http://slowmovideo.granjow.net/

MVTools2 has vizualization for vectors with MShow(), but no capacity to use edited vectors or flow data as input that I'm aware of.
poisondeathray is offline   Reply With Quote
Old 2nd October 2015, 01:49   #7  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
Quote:
Originally Posted by poisondeathray View Post
But it can be a lot of work to fix problem frames with the advanced options , and often there is no solution despite the advanced features. But it can salvage some situations , or at least reduce the amount of pure manual work like photoshop. You might decide to use it sparingly only to "fix" a few critical scenes.
As I've stated in a few other threads, when the project calls for motion estimated frame rate conversion, and if I'm being paid, I'll render both a motion estimated and a hard-coded pulldown version of the same thing. I'll line up both "final" outputs on my NLE timeline, and then simply cut between them when the motion estimation fails. This works pretty well (not as well, of course, as what you describe), but it is not a lot of work, once the two renders have been done.
johnmeyer is offline   Reply With Quote
Old 2nd October 2015, 04:15   #8  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,664
Quote:
Originally Posted by johnmeyer View Post
YFRC appears to be nothing more than a front end for MVTools2.
Actually YFRC is not just a front end for MVTools2. YFRC uses masks to reduce artifacts in areas where interpolation failed. It works reasonably well in scenes with lots of motion. The results are not perfect but definitely better than artifacts. This method was later incorporated into the SVP modified MVTools2 (MSmoothFps). If I'm not mistaken I believe SVPflow also uses the masking technique, take a look at the mask:{} parameters. Speaking of SVP, InterFrame is truly a front end for SVPflow (a dumbed-down one at that).


@ingoldie
YFRC is only useful for doubling the frame rate. Only use it if you actually want 36fps. Other than that use MVTools2 or SVPflow to achieve the desired frame rate.

While I'm at it, let me post the latest YFRC with a tiny modification to make it compatible with the current MVTools2 variants. It requires MaskTools2 so make sure you have the latest recommended version.

YFRC-06dd-01mm-2011yyyy.avsi:
Code:
# Author: RunForLife(Oleg Yushko) http://videomontazh.com.ua
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA, or visit
# http:#www.gnu.org/copyleft/gpl.html.

#LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MvTools2\mvtools2debug.dll")
#LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\MaskTools2.0a36\mt_masktools-26.dll")

#If u feel bad with blending, u can turn it off: YFRC(OverlayType=1)

######################################################################################################################################################################################################################
function YFRC(clip clp_Input, int "BlockH", int "BlockV", int "OverlayType", int "MaskExpand")
{
#Yushko Frame Rate Converter 2x
#ColorSpace: YV12
#OverlayType: 0 - soft (blend), 1 - hard (SelectOdd)

clp_input      = ConvertToYV12(clp_input)                      # script produce YV12 colorspace (3 times faster than YUY2!!!)
clp_Super      = MSuper(clp_Input.blur(1), chroma=true, pel=2) # blur(1) - smooth edges for better analysing
ox             = clp_Input.width()
oy             = clp_Input.height()
fps_num        = FrameRateNumerator(clp_input)*2  # Numerator  , always 2X
fps_den        = FrameRateDenominator(clp_input)  # Denominator, always same as input clip

fps_num        = ((fps_num==0||fps_den==0)) ? FramerateNumerator(clp_input)*2 : fps_num
fps_den        = ((fps_num==0||fps_den==0)) ? FramerateDenominator(clp_input) : fps_den
MaskExpand     = default(MaskExpand, 1) # 1 or 2
OverlayType    = default(OverlayType, 0) # 0 - like ConvertFPS (blend); 1 - like ChangeFPS (strong);
blendSOFT      = (OverlayType==0) ? clp_Input.ConvertFPS(fps_num, fps_den).SelectOdd() : DeleteFrame(clp_Input, 0)
BlockH         = default(BlockH, 16) # use 8 for 320x240 (WEB); 16 for 720x576 (SD); 32 for 1280x720 (720p HD); 32 for 1920x1080 (1080p HD)
BlockV         = default(BlockV, 16) # use 8 for 320x240 (WEB); 16 for 720x576 (SD); 32 for 1280x720 (720p HD); 32 for 1920x1080 (1080p HD)
blendHARD      = DeleteFrame(clp_Input, 0) # SceneChange detection

bw1_vec116     = clp_Super.MAnalyse(blksize=BlockH, blksizeV=BlockV, isb=true , chroma=false, search=1, searchparam=1, truemotion=true, lambda=2000, global=true, dct=0, divide=2)
fw1_vec116     = clp_Super.MAnalyse(blksize=BlockH, blksizeV=BlockV, isb=false, chroma=false, search=1, searchparam=1, truemotion=true, lambda=2000, global=true, dct=0, divide=2)
ErrorMask16L   = MMask(clp_input, bw1_vec116, kind=1)
ErrorMask16R   = DeleteFrame(MMask(clp_input, fw1_vec116, kind=1), 0)
ErrorMask16    = Overlay(ErrorMask16L, ErrorMask16R, opacity=0.5, mode="Lighten")#.ColorYUV(gain_y=256)
SceneChange    = MSCDetection(clp_input, bw1_vec116, thSCD2=130)
FPSconverted16 = clp_input.MFlowFps(clp_input.MSuper(levels=1), bw1_vec116, fw1_vec116, num=fps_num, den=fps_den, blend=false, mask=0) #mask=0 - doesn't matter what mode is

CircleExpand   = mt_circle(radius=MaskExpand, zero=true)
CircleInpand   = mt_circle(radius=1         , zero=true)
ErrorMask16    = ErrorMask16.BicubicResize(Round((Ox/BlockH)/4)*4, Round((Oy/BlockV)/4)*4).mt_expand(mode=CircleExpand).mt_inpand(mode=CircleInpand).mt_binarize(64).Blur(1).BicubicResize(ox, oy)

ClipToReturn   = mt_merge(SelectOdd(FPSconverted16), blendSOFT, ErrorMask16, luma=true)
ClipToReturn   = mt_merge(ClipToReturn, blendHARD, SceneChange, luma=true)
ClipToReturn   = Interleave(clp_Input, ClipToReturn)

return ClipToReturn
}
######################################################################################################################################################################################################################

Last edited by Reel.Deel; 3rd October 2015 at 12:19. Reason: typo
Reel.Deel is offline   Reply With Quote
Old 2nd October 2015, 04:45   #9  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
Reel.Deel, thanks for the great post and the updated code. I learned something. I've used SVP, and it is great because it is fast, and it has a few bug fixes that still plague MVTools2, at least the version I'm using. Interframe didn't really add anything, although since the SVP syntax is a little odd (to me), Interframe does shield the user from that.

I thought the only reason to use SVP was for real-time speed. It obviously is limited for doing degraining, and other motion estimation work. I wasn't aware that SVPFlow uses selective masking, like what is in YFRC.

It would be interesting to apply either YFRC or SVP to some film that I doubled from 14.985 to 29.97 and then posted on YouTube. While the film judder is almost completely removed (which is why I did the frame doubling), the motion estimation failures are fairly frequent, and at times, blatant.

Here is that film, queued up to about three seconds before the elk antlers go crazy (if that sounds odd, you'll see what I mean):

1941 Flint Michigan Parade (on YouTube)

I've queued it to the section where the flow really breaks down badly. Yikes!

And here's the original 14.985 progressive footage, if anyone is interested in seeing if they can successfully frame-double it using motion estimation, but without breaking the antlers. This file is only 9 MB.

Original AVI, 14.985 fps, progressive, DV codec (Mediafire download)

Last edited by johnmeyer; 2nd October 2015 at 04:46. Reason: fix minor typo
johnmeyer is offline   Reply With Quote
Old 2nd October 2015, 09:02   #10  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,743
Quote:
Originally Posted by Reel.Deel View Post
Speaking of SVP, InterFrame is truly a front end for SVPflow (a dumbed-down one at that).
What is SVPflow able to do that InterFrame isn't ?

Last edited by Music Fan; 2nd October 2015 at 10:06.
Music Fan is offline   Reply With Quote
Old 2nd October 2015, 14:17   #11  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,843
InterFrame is just an avs script. It uses svp dlls.
kolak is offline   Reply With Quote
Old 2nd October 2015, 14:34   #12  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
Quote:
Originally Posted by Music Fan View Post
What is SVPflow able to do that InterFrame isn't ?
You can set all the SVP variables directly when you ditch the Interframe front end. I don't think Interframe "exposes" all the controls.
johnmeyer is offline   Reply With Quote
Old 2nd October 2015, 15:05   #13  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,843
It doesn't, but you can adjust them inside plugin script.
kolak is offline   Reply With Quote
Reply

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 09:40.


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