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 February 2008, 12:31   #1  |  Link
yup
Registered User
 
Join Date: Feb 2003
Location: Russia, Moscow
Posts: 854
Script for change TFF to BFF

Hi All!
Simple question:
this script
Code:
AVISource("test.avi")
AssumeTFF()
DoubleWeave()
SelectOdd()
Will be change TFF interlaced video to BFF? Task very simple, I captured video as TFF and now need reencode to DV which could be BFF.
Please advise, may be exist other way?
With kind regards yup.
yup is offline   Reply With Quote
Old 10th February 2008, 00:58   #2  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,173
Yes, DoubleWeave() pairs fields alternatly [01][12][23][34][45]... and with SelectOdd() then select the [12][34][56]... pairing. So you will end up with BFF frames.

Note you do loose the 1st field (0) and reuse the 2nd last field in the last frame. ...[n-4,n-3][n-2,n-1][n,n-1]
IanB is offline   Reply With Quote
Old 10th February 2008, 02:20   #3  |  Link
stickboy
AviSynth Enthusiast
 
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,268
Try my JDL_ReverseFieldDominance function.
stickboy is offline   Reply With Quote
Old 10th February 2008, 10:57   #4  |  Link
yup
Registered User
 
Join Date: Feb 2003
Location: Russia, Moscow
Posts: 854
IanB!

And this script introduce delay between audio and video half time between frames in my case PAL 20ms?
stickboy

Your function JDL_ReverseFieldDominance not introduce delay and first and last frames will be get from bobbed if bobFirstLast=true.
One more thanks. I have 4 hour capture video and Your answer very important for me.
yup.
yup is offline   Reply With Quote
Old 12th February 2008, 18:10   #5  |  Link
yup
Registered User
 
Join Date: Feb 2003
Location: Russia, Moscow
Posts: 854
I try 3 way:
1.
Code:
AVISOurce("part1f.avi")
AssumeTFF()
DoubleWeave()
SelectOdd()
and using cedocida DV codec in YUY2.
2.
Code:
AVISOurce("part1f.avi")
AssumeTFF()
JDL_ReverseFieldDominance(bobfirslast=true)
and using cedocida DV codec in YUY2.
3.
Code:
AVISOurce("part1f.avi")
AssumeTFF()
and using Mainconcept DV codec 2.4.16 using flang change field order.
All ways give jerky results especialy on date stamp which moving up and down.
That I made wrong?
With kind regards yup.
yup is offline   Reply With Quote
Old 12th February 2008, 19:41   #6  |  Link
stickboy
AviSynth Enthusiast
 
Join Date: Jul 2002
Location: California, U.S.
Posts: 1,268
Are you sure you need to reverse the field dominance in the first place?
stickboy is offline   Reply With Quote
Old 12th February 2008, 20:42   #7  |  Link
yup
Registered User
 
Join Date: Feb 2003
Location: Russia, Moscow
Posts: 854
@ stickboy!
Yes, I have problem with capture AVI all my file have BFF but indeed TFF, my card Pinnacle PCI 700 and I use VirtualDub for capture. I get good result with Reverse Field Dominance.
4 way
Code:
AVISource("part1f.avi")
ReverseFieldDominance(true)
AssumeBFF
and using Cedocida DV codec
yup.
yup is offline   Reply With Quote
Old 12th February 2008, 21:36   #8  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,173
@Yup,

Perhaps you had better check this AVI file, it sounds like AssumeTFF() is NOT the correct choice for this file.
Code:
AVISource("part1f.avi")
AssumeTFF() # or AssumeBFF()
Bob()
Load this in to VirtualDub and examine, frame by frame, a high motion scene. Ignore any artifacts from dumb Bob(), you are just looking for correct motion order here. To be sure try again with AssumeBFF(). One should be correct the other should do the 2 step forwards 1 step back shuffle.

Please report your findings here so others may benefit from your experiences.

The above script will take the individual fields and crudely make them into 2 times as many full frames.


And
Quote:
Code:
AVISource("part1f.avi")
ReverseFieldDominance(true)
AssumeBFF
Unless there is more script following, the AssumeBFF() here does nothing.

Assume?FF() just set internal flags such that field order sensitive filters can know the time order of the fields, the field order information is NOT exported.
IanB is offline   Reply With Quote
Old 13th February 2008, 05:28   #9  |  Link
yup
Registered User
 
Join Date: Feb 2003
Location: Russia, Moscow
Posts: 854
@IanB!
Code:
AVISource("part1f.avi")
AssumeTFF()
Bob()
give flow monion
Code:
AVISource("part1f.avi")
AssumeBFF()
Bob()
give jerky result with back motion per 2 frames.
Also when I encoding this file in CCE I do not use field shift.
Better result for me give script:
Code:
bob()# or yadifmod, or nnedi as bobber
SeparateFields()
SelectEvery(4,1,2)
Weave()
yup.
yup is offline   Reply With Quote
Old 31st August 2011, 11:03   #10  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,666
Hi,
I found another simple solution to convert BFF to TFF in the doc of Remove Blend 0.3, but I don't know if it works to convert TFF to BFF;
Code:
avisource("your_clip.avi")
separatefields()
trim(1,0)
weave()
Music Fan is offline   Reply With Quote
Old 31st August 2011, 11:47   #11  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,385
The basic idea works, but to make it convert TFF to BFF you will have to add AssumeTFF() since the Avisynth default is BFF.
Code:
avisource("your_clip.avi")
AssumeTFF()
separatefields()
trim(1,0)
weave()
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 31st August 2011, 15:36   #12  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,666
Quote:
Originally Posted by Music Fan View Post
I don't know if it works to convert TFF to BFF
I just tested with both TFF and BFF videos and it works (I answer to myself ).

Quote:
Originally Posted by Gavino View Post
to make it convert TFF to BFF you will have to add AssumeTFF() since the Avisynth default is BFF
I'm not sure that one needs to add it, I often encode in TFF without this line and the resulting video is well encoded.

But there is something I don't understand in this script : the trim line removes 1 field (or actually a frame in this case, as the frames are separated in 2 progressive frames having half the resolution of the avi, each one containing one field whose lines are tightened), but the weave line renders the same number of frames than if one don't put the trim line.
Example ;
Code:
avi file#720.480, 115 frames
separatefields()#720.240, 230 frames
trim(1,0)#720.240, 229 frames, TFF became BFF (or vice versa depending on the original video's parity)
weave()#720.480, 115 frames again
How can the weave function create a complete frame with one missing field ?

Last edited by Music Fan; 31st August 2011 at 15:45.
Music Fan is offline   Reply With Quote
Old 31st August 2011, 17:35   #13  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,385
Quote:
Originally Posted by Music Fan View Post
I'm not sure that one needs to add it, I often encode in TFF without this line and the resulting video is well encoded.
Well, you certainly need it here, otherwise SeparateFields() will split the fields in the wrong order.
Encoding is a different case, since you can tell the encoder that the clip is TFF, but you will certainly need it for any Avisynth filters that need to know the correct field order to function properly.
Quote:
How can the weave function create a complete frame with one missing field ?
A good question.
What happens is that Avisynth repeats the last field to complete the sequence, so the final frame actually consists of two identical fields.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 31st August 2011, 17:38   #14  |  Link
yup
Registered User
 
Join Date: Feb 2003
Location: Russia, Moscow
Posts: 854
May be like Ianb explained at post #2? Two last frame from fields [n-2,n-1][n,n-1].
yup.
yup is offline   Reply With Quote
Old 31st August 2011, 17:53   #15  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,666
Right, thank you guys.
If I understand well, the only way to invert fields without losing the last field and without de-interlacing and re-interlacing is to use ReverseFieldDominance(true) ?
Music Fan is offline   Reply With Quote
Old 31st August 2011, 17:59   #16  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,666
Quote:
Originally Posted by Gavino View Post
Well, you certainly need it here, otherwise SeparateFields() will split the fields in the wrong order.
Encoding is a different case, since you can tell the encoder that the clip is TFF, but you will certainly need it for any Avisynth filters that need to know the correct field order to function properly.
I'm astonished, because my clip stays in TFF when I do this ;
Code:
avisource("your_clip.avi")#TFF
separatefields()
weave()
AssumeTFF()
bob()
I open it in Virtual Dub, and it's fluid. It's not if I choose BFF in place of TFF.
Doesn't it mean that separatefields and weave keep the good field order ?
Music Fan is offline   Reply With Quote
Old 31st August 2011, 18:12   #17  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,385
Quote:
Originally Posted by yup View Post
May be like Ianb explained at post #2? Two last frame from fields [n-2,n-1][n,n-1].
Yes, but I think IanB has got it wrong and it is [n-2,n-1][n,n].
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 31st August 2011, 18:22   #18  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,385
Quote:
Originally Posted by Music Fan View Post
If I understand well, the only way to invert fields without losing the last field and without de-interlacing and re-interlacing is to use ReverseFieldDominance(true) ?
It's the first field you lose, not the last (which gets repeated).
JDL_ReverseFieldDominance avoids that problem.

Quote:
Originally Posted by Music Fan View Post
Doesn't it mean that separatefields and weave keep the good field order ?
Yes, Weave will retain the field order used by SeparateFields, so you end up with the original frames again.
But in between the two, the fields will be in the wrong order so any filter that depends on the temporal order will not work properly. (Trim(1,0) falls into that category.)
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 31st August 2011, 19:27   #19  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,666
Ok, thanks.
Music Fan is offline   Reply With Quote
Old 1st September 2011, 01:03   #20  |  Link
IanB
Avisynth Developer
 
Join Date: Jan 2003
Location: Melbourne, Australia
Posts: 3,173
Quote:
Originally Posted by Gavino View Post
Quote:
Originally Posted by yup View Post
May be like Ianb explained at post #2? Two last frame from fields [n-2,n-1][n,n-1].
yup.
Yes, but I think IanB has got it wrong and it is [n-2,n-1][n,n].
Yes for the DoubleWeaveFields case. This is used by Weave() and DoubleWeave() with Field Separated clips.

No for the DoubleWeaveFrames case. This is used by DoubleWeave() with Framebased clips.


DoubleWeaveFrames always joins a Top fields with a Bottom field, so at the end boundary it fetches the last frame from the source clip for both inputs and extracts a Top field, n, and a Bottom field, n-1. Which is the case for my post #2 above.


DoubleWeaveFields always joins an even frame with an odd frame , so at the end boundary it fetches the last frame from the source clip for both inputs and use it as both top and bottom field.
IanB 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 22:59.


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