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 19th October 2016, 12:52   #1  |  Link
kuchikirukia
Registered User
 
Join Date: Oct 2014
Posts: 478
Hybrid 30p/30i to 60fps?

I have a concert Bluray where some of the cameras were filming 30p, some 30i, and they left it that way. I'd like to keep the 60fps segments but not trash the 30p with unnecessary deinterlacing. Is there a way to detect the combed segments and bob them, then just double the 30p to match and make a a CFR 60fps video?
kuchikirukia is offline   Reply With Quote
Old 19th October 2016, 13:39   #2  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 4,026
From the Decomb plugin:
Quote:
IsCombed(parameter_list)
This utility filter is designed for use within ConditionalFilter(). It returns a boolean to indicate whether a frame is combed (interlaced).
threshold (0-255, default 20) sets the amount of combing required to declare a frame combed. It is analogous to the threshold parameter of FieldDeinterlace(). You may have to tweak this for best performance with your specific material.
I didn't try it, but I think it should provide the decision for subsequent processing of a frame like bobbing or frame doubling.
Sharc is offline   Reply With Quote
Old 19th October 2016, 14:51   #3  |  Link
kuchikirukia
Registered User
 
Join Date: Oct 2014
Posts: 478
Will it work on conditions which output two frames, or am I going to have to first double the frames and process both to be able to overwrite them individually with the deinterlaced even/odd fields?
And how do I double a frame?
kuchikirukia is offline   Reply With Quote
Old 19th October 2016, 21:15   #4  |  Link
AzraelNewtype
Registered User
 
AzraelNewtype's Avatar
 
Join Date: Oct 2007
Posts: 135
selectevery(1,0,0).

When I've done this, I've searched for ranges of interlaced bits in the fake bobbed version, replaced those spans with a real bobbed version via ClipClop, and then run dedup over the thing to delete the now irrelevant duplicates. Just keep the threshold as low as the plugin will accept. If you really want CFR you can just skip that.
AzraelNewtype is offline   Reply With Quote
Old 19th October 2016, 21:40   #5  |  Link
kuchikirukia
Registered User
 
Join Date: Oct 2014
Posts: 478
Quote:
Originally Posted by AzraelNewtype View Post
selectevery(1,0,0).

When I've done this, I've searched for ranges of interlaced bits in the fake bobbed version, replaced those spans with a real bobbed version via ClipClop.
How?

Seems like there should be a way to double it, run a conditional filter on every other frame to replace with qtgmc().selecteven() if combed, and again on the the other set with qtgmc().selectodd().
But it throws an error when I try that relating to the selecteven() after qtgmc. I think I need another way to select the field.
kuchikirukia is offline   Reply With Quote
Old 20th October 2016, 02:44   #6  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,018
Just knocked this up from script (much bigger) that I used some time ago, not much testing.

Code:
### DGIndex Template, HyBrid.avs
VideoFileName   ="__vid__"
AudioFileName   ="__aud__"
AudioDelay      =Value("__del__")
###
MPEG2Source(VideoFileName,UpConv=1)                                       # UpConv=1, YUY2, let DGIndex decide what parts encoded Intelaced/Progressive
Audio           = NICAC3Source(AudioFileName,channels=2,DRC=0)
AudioDub(Audio).DelayAudio(AudioDelay)
ResampleAudio(44100)
Trim(0,0)                                                                 # Trim/Pad audio to length
#
AssumeTFF                                                                 # Whatever (check)
#
DBLRATE      = True
EVEN         = True
SHOW         = True
COMBEDTHRESH = 20
RECYCLE_COMB = True                                                       # EDIT: re-use existing combed file
RootName     = RT_GetFullPathName(RT_FilenameSplit(VideoFileName,4))      # Just name node, no Dir\Path\Ext [EDIT: but in current dir]
Fn           = RT_String("%s_%s_%d_Clop.txt",RootName,(DBLRATE)?"DOUBLE":"SINGLE",COMBEDTHRESH)
myName       = "HyBrid: "
###
ORateC       = (DBLRATE) ? SelectEvery(1,0,0) : Last
#
Ex=Exist(Fn)
(!RECYCLE_COMB) ? Assert(!Ex,"Combing file already exists "+Fn) : NOP      # Force user to delete if necessary
Scan         = (!Ex||!RECYCLE_COMB)
(Scan)        ? RT_DebugF("Scanning for %s Rate Combing @ CombThresh=%d",DBLRATE?"Double":"Single",COMBEDTHRESH,name=myName) : NOP
(Scan)        ? ORateC.qCombed(FileName=FN,COMBEDTHRESH,Range=True) : NOP  # Get combed frame numbers at OUTPUT Single/Double rate
#
###  Whatever Deinterlacing
RT_DebugF("Nnedi3",name=myName)
NED         = NNedi3(Field=-2, nns=2)                                      # Field -2 = double rate, internal parity value to start (set by AssumeT/BFF)
YAD         = YadifMod(Order=-1,Mode=1,edeint=NED)                         # Order -1 = Internal Parity.  Mode 1=double rate do spactial check (3=no spatial check).
MC          = YAD.MCDegrainSharp(2)                                        # MC on double rate (temporal radius two frames)
MC          = (DBLRATE) ? MC :((EVEN) ? MC.SelectEven : MC.SelectOdd)      # Deinterlaced at output rate
###
UNLACED     = (SHOW) ? MC.Subtitle("COMBED",align=5,size=48) : MC
#
ClipClop(oRateC,UNLACED,Cmd=Fn).ConvertToYV12                    # Fast access to non decombed frames (non combed frames untouched)
### Additional Processing

### End
Return Last
Good luck

EDIT: qCombed:- http://forum.doom9.org/showthread.ph...95#post1776495

EDIT: Say if it worked well for you or give any mods that you found necessary, and maybe I'll add script to qCombed thread (or you add if you like).
__________________
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; 20th October 2016 at 04:04.
StainlessS is offline   Reply With Quote
Old 20th October 2016, 05:11   #7  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,018
Mod of above, left original in-place in case you prefer.

Allows view simple BOB mode (Default) to check field order/quality etc quickly (plays well even on low grade machine).

Code:
### DGIndex Template, HyBrid.avs
VideoFileName   ="__vid__"
AudioFileName   ="__aud__"
AudioDelay      =Value("__del__")
###
MPEG2Source(VideoFileName,UpConv=1)                                       # UpConv=1, YUY2, let DGIndex decide what parts encoded Intelaced/Progressive
Audio           = NICAC3Source(AudioFileName,channels=2,DRC=0)
AudioDub(Audio).DelayAudio(AudioDelay)
ResampleAudio(44100)
Trim(0,0)                                                                 # Trim/Pad audio to length
#
AssumeTFF                                                                 # Whatever (check)
#
DBLRATE      = True
EVEN         = True
SHOW         = True
COMBEDTHRESH = 20
RECYCLE_COMB = True                                                       # re-use existing combed file
SIMPLE       = True                                                       # True = Simple Bob(), False=YadIfMod (Or set your own deinterlacer)
MCD          = 0                                                          # 0 (off)->2, Uses MCDegrain(MCD)
SHARP        = False                                                      # Use MCDegrainSharp instead of MCDegrain
STACK        = True                                                       # Return StackVertical(Orig,Last)
###################
RootName     = RT_FilenameSplit(VideoFileName,4)                          # Just name node, no Dir\Path\Ext
RootName     = RT_GetFullPathName(RootName)                               # But in current directory (not in source directory, if different)
Fn           = RT_String("%s_%s_%d_Clop.txt",RootName,(DBLRATE)?"DOUBLE":"SINGLE",COMBEDTHRESH)
myName       = "HyBrid: "
###
ORateC       = (DBLRATE) ? SelectEvery(1,0,0) : Last
#
Ex=Exist(Fn)
(!RECYCLE_COMB) ? Assert(!Ex,"Combing file already exists "+Fn) : NOP      # Force user to delete if necessary
Scan         = (!Ex||!RECYCLE_COMB)
(Scan)        ? RT_DebugF("Scanning for %s Rate Combing @ CombThresh=%d",DBLRATE?"Double":"Single",COMBEDTHRESH,name=myName) : NOP
(Scan)        ? ORateC.qCombed(FileName=FN,COMBEDTHRESH,Range=True) : NOP  # Get combed frame numbers at OUTPUT Single/Double rate
#
RT_DebugF("De-Bob/interlace",name=myName)
###  Whatever Bobbing/Deinterlacing @ Double rate output
NED          = NNedi3(Field=-2, nns=2)                                      # Field -2 = double rate, internal parity value to start (set by AssumeT/BFF)
DEINT        = YadifMod(Order=-1,Mode=1,edeint=NED)                         # Order -1 = Internal Parity.  Mode 1=double rate do spactial check (3=no spatial check).
###
DEINT        = (SIMPLE) ? Bob : DEINT                                       # If SIMPLE then use simple Bob() (quick view, eg check field order)
###
DEINT        = (MCD>0)?(((SHARP)?DEINT.MCDegrainSharp(MCD):DEINT.MCDegrain(MCD))):DEINT   # MCDegrain on double rate (temporal radius MCD)
DEINT        = (DBLRATE)?DEINT:((EVEN)?DEINT.SelectEven:DEINT.SelectOdd)    # Deinterlaced at output rate
###
UNCOMBED     = (SHOW) ? DEINT.Subtitle("DE-COMBED",align=5,size=48) : DEINT
#
ClipClop(oRateC,UNCOMBED,Cmd=Fn).ConvertToYV12                              # Fast access to non decombed frames (non decombed untouched)
### Additional Processing

### End
Return (STACK) ? (StackVertical(OrateC.ConvertToYV12.SubTitle("ORIG"),Last)) : Last
EDIT: ADDED STACK mode (default).

EDIT: The series of episodes I more or less created above for looked better as single rate, the odd interlaced fields were quite nasty
and blurred, especially at scene changes, hopefully the simple BOB mode (default) will allow you to detect similarly lousy
clips too, and make decision as to whether single rate would actually be preferred over double.

If you keep RECYCLE_COMB=True, you can try scan at different COMBEDTHRESH, to view results, and when you decide that you
like one of them best, you can just change back to that COMBEDTHRESH and avoid another scan, will use original combed file
as combed file names are as so:- "bab59_DOUBLE_20_Clop.txt" for double rate CombedThresh=20.
Keeping RECYCLE_COMB=True, and changing from eg SHOW=true to SHOW=false will likewise avoid another qCombed scan.
__________________
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; 20th October 2016 at 06:16.
StainlessS is offline   Reply With Quote
Old 20th October 2016, 14:36   #8  |  Link
amayra
Quality Checker
 
amayra's Avatar
 
Join Date: Aug 2013
Posts: 294
do you mean something like InterFrame 2.8.2 ?
__________________
I love Doom9
amayra is offline   Reply With Quote
Old 20th October 2016, 14:47   #9  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,018
amayra,
I dont know who you are addressing, but read the opening post.

This thread is about hybrid interlaced and progressive video in the same clip, not about interpolating frames to give the impression of a higher frame rate.
__________________
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 21st October 2016, 19:12   #10  |  Link
thecoreyburton
Guest
 
Posts: n/a
I encounter this a lot, I find the simplest way is to use the following bit of script:

Quote:
DeInt=QTGMC(preset="Very Slow")
A=ConditionalFilter(last,DeInt.SelectEven,last,"IsCombedTIVTC","=","true")
B=ConditionalFilter(last,DeInt.SelectOdd,last,"IsCombedTIVTC","=","true")
Interleave(A,B)
It will double the frame rate of the video from 30fps to 60fps, duplicating progressive frames and deinterlacing interlaced frames using QTGMC. Change the preset in QTGMC to suit your needs - I use "Very Slow" for DVD footage and "Faster" for blu ray, but it's a subjective matter of time vs. quality.

If you want to go even further and make a VFR clip (where the 30fps portions play at 30fps, and the interlaced portions play at 60fps), you can do two passes with ExactDedup, which will remove the duplicates and generate timecodes for muxing later.
  Reply With Quote
Old 22nd October 2016, 13:54   #11  |  Link
kuchikirukia
Registered User
 
Join Date: Oct 2014
Posts: 478
Quote:
Originally Posted by thecoreyburton View Post
I encounter this a lot, I find the simplest way is to use the following bit of script:

Code:
DeInt=QTGMC(preset="Very Slow")
A=ConditionalFilter(last,DeInt.SelectEven,last,"IsCombedTIVTC","=","true") 
B=ConditionalFilter(last,DeInt.SelectOdd,last,"IsCombedTIVTC","=","true")
Interleave(A,B)
It will double the frame rate of the video from 30fps to 60fps, duplicating progressive frames and deinterlacing interlaced frames using QTGMC.

That's exactly what I was looking for. Thanks.
kuchikirukia is offline   Reply With Quote
Old 6th November 2016, 05:15   #12  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,018
Here mod of snippit posted by TheCoreyBurton, [cant find his post, TheCoreyBurton account deleted]

Code:
Function DoubleRate(clip c,Bool "Blend") {
    c
    Blend=Default(Blend,False)                                      # Avoid blends at scene change (copy previous frame)
    prefilt   = DeGrainMedian()                                     # some smoothing
    superfilt = MSuper(prefilt, hpad=16, vpad=16, rfilter = 4)      # all levels for MAnalyse
    super     = MSuper(pel=2, hpad=16, vpad=16,rfilter=4,levels=1)  # one level is enough for MRecalculate
    bw_1      = MAnalyse(superfilt, chroma = false, isb = true,  blksize = 16, OverLap=2, searchparam = 3, plevel = 0, search = 3, badrange = (-24))
    fw_1      = MAnalyse(superfilt, chroma = false, isb = false, blksize = 16, OverLap=2, searchparam = 3, plevel = 0, search = 3, badrange = (-24))
    bw_2      = MRecalculate(super, chroma = false, bw_1, blksize = 8, searchparam = 1, search = 3)    # No Overlap (currently broken for final vectors)
    fw_2      = MRecalculate(super, chroma = false, fw_1, blksize = 8, searchparam = 1, search = 3)    # No Overlap
    MBlockFps(super, bw_2, fw_2, num=FramerateNumerator(c) * 2, den=FramerateDenominator(c), mode=0, Blend=Blend)
    Return Last
}

Function HybridDoubleRate_QTGMC(clip c,String "Preset",Bool "Blend",Bool "Show") {
    c
    Preset=Default(Preset,"Very Slow")
    Blend=Default(Blend,False)      # for DoubleRate. False dont blend scene change, copy previous frame, true blend.
    Show=Default(Show,False)
    DeInt=QTGMC(preset=Preset)  Deint=(Show) ? Deint.AddBorders(0,0,0,20,$FF0000).Subtitle("QTGMC "+Preset+" Deinterlaced",Align=1) : Deint
    Dbl=DoubleRate(c,Blend)     Dbl  =(Show) ? Dbl.AddBorders(0,0,0,20,$000000).Subtitle("DoubleRate",Align=1) : Dbl
    A=ConditionalFilter(last,DeInt.SelectEven,Dbl.SelectEven,"IsCombedTIVTC","=","true")
    B=ConditionalFilter(last,DeInt.SelectOdd, Dbl.SelectOdd, "IsCombedTIVTC","=","true")
    Interleave(A,B)
    Return Last
}

Function HybridDoubleRate_NedYad(clip c,Bool "Blend",Bool "Show") {
    c
    Blend=Default(Blend,False)      # for DoubleRate. False dont blend scene change, copy previous frame, true blend.
    Show=Default(Show,False)
    NED  = NNedi3(Field=-2, nns=2)                        # Field -2 = double rate, internal parity value to start (set by AssumeT/BFF)
    DeInt= YadifMod(Order=-1,Mode=1,edeint=NED)           # Order -1 = Internal Parity.  Mode 1=double rate do spactial
    Deint=(Show) ? Deint.AddBorders(0,0,0,20,$FF0000).Subtitle("Ned/Yad Deinterlaced",Align=1) : Deint
    Dbl=DoubleRate(c,Blend)     Dbl  =(Show) ? Dbl.AddBorders(0,0,0,20,$000000).Subtitle("DoubleRate",Align=1) : Dbl
    A=ConditionalFilter(last,DeInt.SelectEven,Dbl.SelectEven,"IsCombedTIVTC","=","true")
    B=ConditionalFilter(last,DeInt.SelectOdd, Dbl.SelectOdd, "IsCombedTIVTC","=","true")
    Interleave(A,B)
    Return Last
}


VideoFileName   ="D:\BAB-59\VIDEO_TS\bab59.d2v"
MPEG2Source(VideoFileName)
AssumeTFF

#HybridDoubleRate_QTGMC(Preset="Slow",Show=True)
HybridDoubleRate_NedYad(Show=True)               # Deinterlaced scene changes NOT blended (I hate that, no idea how to stop QTGMC doing it)
Deinterlace interlaced sections, and MC doubled framerate for progressive sections.

Current version of MVTools has a problem when OverLap used to produce final vectors used by MBlockFps, reported here:- http://forum.doom9.org/showthread.ph...86#post1785086

But above snippit currently immune from the problem.

EDIT: Perhaps change YdifMod to YadifMod2
__________________
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; 14th November 2022 at 12:43.
StainlessS 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 04:50.


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