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 December 2011, 11:30   #1  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,352
Source underlying framerate - Conversion

hello, here I have a funny source I think I solved but output framerate comes to be a bit strange.

You better download the sample to understand, but I explain:

source is interlaced NTSC, but only every other frame is a new frame, that is in fields: ab,ab,cd,cd...
-so select odds: ab,cd,ef...

-then bob and get NTSC 29.970 fps output with no dups. BUT, every 2 frames there is a bigger jump, just if the next had happened: ab,cd,gh,ij,mn...

-so I frame interpolate those missing frames, and I get 44.955fps. What kind of framerate this is? It's not even near any standard...
Code:
# NTSC 30fps source

selectodd # to  15fps

bob  # back to 30fps

InterFrame(Preset="Placebo",Tuning="Film",NewNum=60000,NewDen=1001,...) # to 60fps

selectevery(4,2,3,4) # To 45 fps. Skip the no-gaps interpolated frames.
Sample 60Mb (sorry there is little motion to catch):
http://www.mediafire.com/?722eb33nz5c3c6t

Last edited by Dogway; 8th December 2011 at 11:32.
Dogway is offline   Reply With Quote
Old 8th December 2011, 12:35   #2  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,389
It are interlaced frames that are missing (dup-replaced) in the source file. Therefore in the gaps there are 2 fields missing, hence you need to fill in 2 frames after bobbing.

Code:
ab cd ef gh ij kl mn op           #  (1) interlaced original

ab ab ef ef ij ij mn mn           #  (2)  oddframes dropped, evenframes doubled

A B x x E F x x I J x x M N x x   #  (3) this is needed, but can't be constructed directly

A . . B x x E . . F x x I . . J x x M . . N x x   #  construct this (2 newframes for each), 
0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 4 5 0 1 2 3 4 5   #   then select
With (2) being the source you're starting with.


Code:
# NTSC 30fps source

selectodd # to  15fps

bob  # back to 30fps

assumefps(30)
InterFrame(Preset="Placebo",Tuning="Film",NewNum=90,NewDen=1,...) # tripling to 90fps

SelectEvery(6,0,3,4,5)
AssumeFPS(60000,1001)  # now have reconstucted 60p.
No guarantee this works directly (cannot try now with your sample), but you see the principle.
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)

Last edited by Didée; 8th December 2011 at 12:39.
Didée is offline   Reply With Quote
Old 8th December 2011, 17:26   #3  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,352
ah, yes. I was thinking source was originally 29.97, hence assuming that type of interlacing where you discard half the dups. But seems it originally was 60fps, so 2 frames to add. It didn't look so a big gap to fill.

In this case Interframe doesn't work because it tries to even the temporal difference touching correct frames: A,B,E,F etc

So I used mflowfps, I ended up with this script, just left bob to be replaced. I added the variable "b" because the source is composed of numerous trims, so it was going to be a pain to manual edit each of those, I just wonder if I'm gonna have a problem if I go out of range like selectevery(2,1,2)

Code:
### Deblock
SeparateFields()
Deblock_QED(quant1=20, quant2=30)


### Averaging repeated fields
b=0
e=mt_average(selectevery(4,b),selectevery(4,b+2),u=3,v=3)
o=mt_average(selectevery(4,b+1),selectevery(4,b+3),u=3,v=3)


### Remove Dups
interleave(e,o) # fields...
weave           # 15fps (interlaced)
bob             # back to 30fps. Working in frames now.
assumefps(30)


### Frame interpolation
super = MSuper(pel=2)
backward_vec = MAnalyse(super, overlap=4, isb = true, search=3)
forward_vec = MAnalyse(super, overlap=4, isb = false, search=3)
MFlowFps(super, backward_vec, forward_vec, num=90,den=1)


### Back to source framerate
SelectEvery(6,b,b+3,b+4,b+5)
AssumeFPS(60000,1001)
I also discovered FillDropsI() while searching, I thought it was going to work as per description, but it didn't : /

Last edited by Dogway; 8th December 2011 at 17:33.
Dogway is offline   Reply With Quote
Old 8th December 2011, 18:21   #4  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,345
Are you trying to interpolate to 59.94p then re-interlace for NTSC?

Code:
a = MPEG2Source


###ODD FIELDS INTERPOLATION using "FILLDROPS"
a
AssumeTFF()
SeparateFields()
SelectOdd()
odd = last
super_odd=MSuper(odd,pel=2)
vfo=manalyse(super_odd,truemotion=true,isb=false, delta=1)
vbo=manalyse(super_odd,truemotion=true,isb=true,delta=1)
filldrops_o = mflowinter(odd,super_odd,vbo,vfo,time=50)

ConditionalFilter(odd, filldrops_o, odd, "YDifferenceFromPrevious()", "lessthan", "1.3")

odd_filtered=last


odd_filtered
bob #interpolated 29.97p now


###MFlowFPS for 2x framerate (or use interframe instead)
source=last

super = source.MSuper(pel=2)
backward_vec = MAnalyse(super, overlap=4, isb = true, search=3)
forward_vec = MAnalyse(super, overlap=4, isb = false, search=3)
source.MFlowFps(super, backward_vec, forward_vec, blend=false, num=60000, den=1001)

#59.94p now, reinterlace if necessary

Last edited by poisondeathray; 8th December 2011 at 18:24.
poisondeathray is offline   Reply With Quote
Old 8th December 2011, 23:27   #5  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,352
I think I finally got it. I can use variable "b" for the averaging of fields, and another variable "c" for the last selectevery offset, on debug test I try several incremental numbers until I find what I like for each, and based on the this number I manual input the correct offset inside the selectevery range as closest to zero as possible, to avoid some misalignments at the trim extremes.

I also had to fix chroma:
interleave(mergechroma(selectevery(4,0),selectevery(4,-2)),selectevery(4,1),selectevery(4,2),selectevery(4,3))

@poisondeathray: I wanted to recover the original framerate with progressive output. Actually Didée explained it very well on his first CODE box. The source is like if it was 60fps but with dupped frames, hence the output has 60fps resolution pair of frames, and 20fps resolution pair of frames, producing a gap. So I'm just filling those holes, there's no need for dup detection since it's constant all over the footage. But I'll keep the function just in case.

Thanks to both for the help, now just left some dozen trims and adjustments, and the anime insertions which is another story : )

Last edited by Dogway; 9th December 2011 at 00:24.
Dogway is offline   Reply With Quote
Reply

Tags
dup, framerate, gap, interlaced

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 10:41.


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