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 August 2014, 14:18   #1  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,744
How to gather 2 top fields then 2 bottom fields ?

Hi,
I'd like to see how does look a video in which each frame consists of 2 top fields or 2 bottom fields, and not of a top and a bottom field as usual.
I guess the first step with avisynth consists to separate fields, but then I don't know.
The idea is to gather fields 1 and 3 (while they come from 2 successive frames) then 2 and 4, 5 and 7, 6 and 8, ...
weave() is not good for that because it gathers 1 and 2, 3 and 4, ...
Music Fan is offline   Reply With Quote
Old 19th August 2014, 14:44   #2  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
You need SeparateFields, apply SelectEven/SelectOdd on the separated fields and Weave again.
Wilbert is offline   Reply With Quote
Old 19th August 2014, 14:50   #3  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,744
Quote:
Originally Posted by Wilbert View Post
You need SeparateFields, apply SelectEven/SelectOdd on the separated fields and Weave again.
Thanks, how exactly do I have to apply SelectEven/SelectOdd ?
One then the other, like this ?
Code:
SeparateFields()
SelectEven()
SelectOdd()
Weave()
Music Fan is offline   Reply With Quote
Old 19th August 2014, 15:38   #4  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,744
Actually no (I answer my own question), if one put SelectOdd() after SelectEven(), the total frames number is divided by 2 (it lacks a frame on two).
But after a few tests, I believe I found how to reach my goal ;
Code:
SeparateFields()
A=SelectEven().Weave()
B=SelectOdd().Weave()
Interleave(A, B)


I first tried this ;
Code:
SeparateFields()
A=SelectEven()
B=SelectOdd()
Interleave(A, B)
but it seems to correspond to this ;
Code:
SeparateFields()
Weave()

Last edited by Music Fan; 19th August 2014 at 15:43.
Music Fan is offline   Reply With Quote
Old 19th August 2014, 15:52   #5  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by Music Fan View Post
I first tried this ;
Code:
SeparateFields()
A=SelectEven()
B=SelectOdd()
Interleave(A, B)
but it seems to correspond to this ;
Code:
SeparateFields()
Weave()
No, it corresponds to just SeparateFields() on its own, because
Code:
A=SelectEven()
B=SelectOdd()
Interleave(A, B)
effectively does nothing. (It divides the clip into two then simply puts it back together again.)
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 19th August 2014, 16:17   #6  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,744
Right, I confounded some tests I made, I should have seen this before to write it.

edit : I believe I meant that ;
Code:
A=SelectEven()
B=SelectOdd()
Interleave(A, B)
corresponds to ;
Code:
SeparateFields()
Weave()

Last edited by Music Fan; 19th August 2014 at 16:25.
Music Fan is offline   Reply With Quote
Old 19th August 2014, 16:45   #7  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
It's a stretch to say they correspond, beyond the fact that they both do nothing. One creates two clips and the other doesn't.
videoh is offline   Reply With Quote
Old 19th August 2014, 17:30   #8  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
you might need separaterows and weaverows functions

Last edited by feisty2; 19th August 2014 at 17:32.
feisty2 is offline   Reply With Quote
Old 19th August 2014, 17:47   #9  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,744
Quote:
Originally Posted by feisty2 View Post
you might need separaterows and weaverows functions
What's the difference compared to the script I gave ?
Music Fan is offline   Reply With Quote
Old 19th August 2014, 18:14   #10  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Does this work ?

Code:
mpeg2source("d:\vob\XMEN2.d2v")

SeparateFields
E=SelectEven.AssumeFrameBased.SeparateFields
E_A=E.SelectEven
E_B=E.SelectOdd

O=SelectOdd.AssumeFrameBased.SeparateFields
O_A=O.SelectEven
O_B=O.SelectOdd

Interleave(E_A,O_A,E_B,O_B)
Weave
AssumeFieldBased
Weave
EDIT: I may have misunderstood requirement, above intended to have 2 top fields, then two bottom repeated.
__________________
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; 19th August 2014 at 18:24.
StainlessS is offline   Reply With Quote
Old 19th August 2014, 23:25   #11  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
Something like the above should work. Shorter would be:
Code:
c = mpeg2source("d:\vob\XMEN2.d2v")
f = c.SeparateFields().AssumeFrameBased() #t1b1t2b2t3b3... #not sure whether AssumeFrameBased() is necessary
f.SelectEvery(4,0,2,1,3) #t1t2b1b2 t3t4b3b4 ...
AssumeFieldBased()
Weave()

Last edited by Wilbert; 20th August 2014 at 00:46.
Wilbert is offline   Reply With Quote
Old 19th August 2014, 23:47   #12  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,496
Did you miss a weave() at the end there, Wilbert?

Annoyingly that script is exactly what I was going to suggest, but didn't want to look foolish if it turned out I'd got it wrong
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 20th August 2014, 00:46   #13  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
Quote:
Did you miss a weave() at the end there, Wilbert?
Yes doctor Thx. I corrected it above.
Wilbert is offline   Reply With Quote
Old 20th August 2014, 00:51   #14  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,744
Same question than above, what's the difference between this script and mine for the output ?
I post it here again ;

Code:
SeparateFields()
A=SelectEven().Weave()
B=SelectOdd().Weave()
Interleave(A, B)
Music Fan is offline   Reply With Quote
Old 20th August 2014, 00:55   #15  |  Link
Wilbert
Moderator
 
Join Date: Nov 2001
Location: Netherlands
Posts: 6,364
I think they are the same.
Wilbert is offline   Reply With Quote
Old 20th August 2014, 01:57   #16  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,744
Ok.
There is something strange in Virtual Dub with my script : the duration is divided by 4 compared to the original video while the framerate and the number of frames of my script are identical to those of the original video.

edit : that's an error, actually the duration is the same but I realize that ffvideosource does not detect the good framerate, thus I have to add assumefps(25/1), which I did in my main script but not in my first script containing only one line (ffvideosource ...).
The source is a TS file containing mpeg-2 in 720.576, ffvideosource has maybe a problem with ts files.
If I don't add assumefps(25/1), the detected framerate is 5.89 fps.

Last edited by Music Fan; 20th August 2014 at 02:11.
Music Fan is offline   Reply With Quote
Old 20th August 2014, 14:30   #17  |  Link
bxyhxyh
Registered User
 
Join Date: Dec 2011
Posts: 354
It seems you found the answer. But you can try this
Code:
SeparateRows(4)
SelectEvery(4,0,2,1,3)
WeaveRows(4)
bxyhxyh is offline   Reply With Quote
Old 21st August 2014, 14:20   #18  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,744
Quote:
Originally Posted by bxyhxyh View Post
It seems you found the answer. But you can try this
Code:
SeparateRows(4)
SelectEvery(4,0,2,1,3)
WeaveRows(4)
The result is very different than my script which makes the video shake, not yours.
And the frame number differs in 1 case ; if I i add trim(100,0) (= from 100 to end) in both scripts, I get 6832 frames with mine, 6831 with yours.
But if I add trim(100,199), they both get 100 frames.
If I don't use trim, they both get 6931 frames.

But this is a ts file recorded on tv, I should try with another file.
Music Fan is offline   Reply With Quote
Old 22nd August 2014, 11:43   #19  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,744
@ bxyhxyh ;
I tested with another file, there is clearly a problem with your script which seems to blend fields, not mine.
You can see it by adding SeparateFields() at the end of the script.
Music Fan is offline   Reply With Quote
Old 22nd August 2014, 12:28   #20  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,744
Here is an interesting exercise, begin the script with this to see big numbers on an interlaced video, you don't even need video, thanks to BlankClip function ;
Code:
BlankClip(length=100, width=720, height=576, fps=25, color=$000000)
ShowFrameNumber(size=400)
separatefields() 
selectevery(4,0,3) 
weave()
This way, each field has its number.

Then add bxyhxyh's script, then mine, add SeparateFields() at the end, forward frame by frame in Virtual Dub and see what happens

Here are the complete scripts ;
Code:
BlankClip(length=100, width=720, height=576, fps=25, color=$000000)
ShowFrameNumber(size=400)
separatefields() 
selectevery(4,0,3) 
weave()
SeparateFields()
A=SelectEven().Weave()
B=SelectOdd().Weave()
Interleave(A, B)
SeparateFields()

Code:
BlankClip(length=100, width=720, height=576, fps=25, color=$000000)
ShowFrameNumber(size=400)
separatefields() 
selectevery(4,0,3) 
weave()
SeparateRows(4)
SelectEvery(4,0,2,1,3)
WeaveRows(4)
SeparateFields()
Music Fan 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 21:05.


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