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 July 2011, 16:07   #1  |  Link
TCmullet
Registered User
 
Join Date: Nov 2003
Posts: 342
60fps progressive to 30fps interlaced

Am still pretty green so am stuck. Sorry I can't figure it out alone.

Have a clip 720x480 60fps (frames / sec) progressive. Need to convert to 720x480 30fps interlaced. Tried this:

avisource("MyClip.avi")
AssumeFieldBased
SelectEvery(2, 0,1)
weave

But it results in 720x960. Would someone kindly help correct me?
TCmullet is offline   Reply With Quote
Old 19th July 2011, 16:14   #2  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 596
AVISource("MyClip.avi")
#AssumeTFF()
SeparateFields()
SelectEvery(4, 0, 3)
Weave()
__________________
my repositories
Chikuzen is offline   Reply With Quote
Old 19th July 2011, 20:51   #3  |  Link
TCmullet
Registered User
 
Join Date: Nov 2003
Posts: 342
Thanks so much, Chikuzen!

I'm guessing it doesn't hurt to include AssumeFrameBased() at the top.

Uh, every time I revisit code I wrote 2 years ago, I struggle to re-figure it out. This is what I wrote, with great difficulty for home movie conversion to DVD:

# Take a 16fps progressive input clip and apply 3:4:4:4
* pulldown, yielding a 30fps interlaced output clip
AssumeFrameBased
SeparateFields
SelectEvery(16, 0,1,0, 3,2,3,2, 5,4,5,4, 7,6,7,6,\
9,8,9, 10,11,10,11, 12,13,12,13, 14,15,14,15)
Weave

It's not greatly helped by the AviSynth doc, which gives examples, but no explicit description of them. Concerning our present script:

AssumeFrameBased()
SeparateFields()
SelectEvery(4, 0, 3)
Weave()

...Is this what it means?
The "4" means, grab the next 4 fields (numbered 0, 1, 2 and 3), which were really from 2 original frames, and output 2 fields (1 frame) in their place. ("0, 3" is a list of 2 field numbers.) "0" is the 1st of the 4 fields (top field of the 1st of 2 frames), and "3" is the 4th of the 4 fields (bottom field of the 2nd of 2 frames).

Am I grasping it right??

My old notes cover 2:3 and 3:4:4:4. As I re-study them, the thing that's initially confusing is that each of these has to be done TWICE to work. "2:3" means the 1st source frame supplies fields toward "2" destination fields, and the 2nd source frame supplies fields toward "3 destination fields. But that would leave you with only 5 destination fields, an odd number. So we do "2:3" TWICE so that we have 10 fields, an even number. Therefore we write using an "8":
SelectEvery(8, 0,1, 2,3,2, 5,4, 7,6,7)
which means grab 8 fields and output them into 10 fields (5 frames) with no leftover field.

If this is all correct, maybe it will help somebody down the road who stumbles upon this thread.
TCmullet is offline   Reply With Quote
Old 19th July 2011, 22:48   #4  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,408
Quote:
Originally Posted by TCmullet View Post
AssumeFrameBased()
SeparateFields()
SelectEvery(4, 0, 3)
Weave()

...Is this what it means?
The "4" means, grab the next 4 fields (numbered 0, 1, 2 and 3), which were really from 2 original frames, and output 2 fields (1 frame) in their place. ("0, 3" is a list of 2 field numbers.) "0" is the 1st of the 4 fields (top field of the 1st of 2 frames), and "3" is the 4th of the 4 fields (bottom field of the 2nd of 2 frames).

Am I grasping it right??
Essentially, yes, but with this script "0" is the bottom field of the 1st of 2 frames and "3" is the top field of the 2nd of 2 frames. This is because Avisynth defaults to BFF (bottom field first). If you want the top field first, you have to add AssumeTFF() before SeparateFields() (as suggested as an option in Chikuzen's script).

You don't normally need AssumeFrameBased as all normal source filters will set this already.
(It does not indicate whether the clip is progressive or interlaced.)
__________________
GScript and GRunT - complex Avisynth scripting made easier

Last edited by Gavino; 19th July 2011 at 22:54. Reason: Note on AssumeFrameBased
Gavino is offline   Reply With Quote
Old 21st July 2011, 17:18   #5  |  Link
TCmullet
Registered User
 
Join Date: Nov 2003
Posts: 342
Thanks, Gavino.

I ran thru my whole 2-hr show without the AssumeTFF(), then encoded to Mpeg2. The TV showed intraframe jaggies. Then in frustration I went back to this forum intending to ask a question and saw your comment that I had missed. (Somehow my email notification hadn't worked.) Ahh, your comment was the explanation!

I've now done a SMALL test (15-sec clip) both ways, and adding TFF does get things right.

But I'm still puzzled. I thought I should be able to verify this with:

#AssumeTFF()
SeparateFields()
#SelectEvery(4, 0, 3)
#Weave()

In Vdub, I thought I should have seen the jaggies temporally by scrolling the timeline (you know, sometimes a forward motion goes backward a frame, then forward again). But I couldn't. Whether I did AssumeTFF or not, the 60fps result of SeparateFields() is smooth. Yet the final results were appropriately different (via watching the mpeg2 result on my TV). How can I visually test the correct field order by inspecting the SeparateFields() output? It would be nice to SEE the difference by manually scrolling along in Vdub rather than have to wait til after an Mpeg encoding to see if I got it right.
TCmullet is offline   Reply With Quote
Old 21st July 2011, 17:38   #6  |  Link
TCmullet
Registered User
 
Join Date: Nov 2003
Posts: 342
>> (Somehow my email notification hadn't worked.)

I discovered the email address I had in my profile was one I haven't check in about 4 years! I had 300+ emails there, mostly spam, but also the 2 notifications from here at the top. So the notification feature is working just fine. (And I've updated my address, embarassingly.)

TCmullet is offline   Reply With Quote
Old 21st July 2011, 18:55   #7  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,408
Quote:
Originally Posted by TCmullet View Post
Whether I did AssumeTFF or not, the 60fps result of SeparateFields() is smooth. Yet the final results were appropriately different (via watching the mpeg2 result on my TV).
Since your input is progressive, the result of SeparateFields() will never show a backward jump, whether you use TFF or BFF. The two fields in each frame (top and bottom) correspond to the same moment in time.

The use of AssumeTFF or AssumeBFF in the script affects the field order of the final output (after Weave). The important thing is that what you tell your Mpeg2 encoder about the field order should match what the script produces.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Old 21st July 2011, 19:14   #8  |  Link
TCmullet
Registered User
 
Join Date: Nov 2003
Posts: 342
If I've done it incorrectly (by leaving off the AssumeTFF), isn't there something I could temporarily add after the Weave that would help me see in Vdub (via scrolling the timeline) the judders? (I wrongly labelled 'em "jaggies" earlier.)
TCmullet is offline   Reply With Quote
Old 21st July 2011, 19:57   #9  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,408
Well, you could add another call to SeparateFields() after the Weave() (or just comment out the Weave instead) if you want to inspect the stream of fields produced by the script.

But again that won't show you anything wrong with the temporal order - it only becomes 'wrong' if your encoder thinks it's TFF when it's BFF, or vice versa.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino 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 14:55.


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