VideoHelp Forum
+ Reply to Thread
Results 1 to 14 of 14
Thread
  1. Member
    Join Date
    Apr 2008
    Location
    Estonia
    Search Comp PM
    My idea how to do it goes like this. Lets assume the source to be a DV AVI, 4:3, letterboxed and interlaced.

    1. Load the source
    2. Separate the fields (You are left with two videos, both 720x288)
    3. Crop field one (36px from the top and 36px from the bottom, you are left with a 720x216 video)
    4. Crop field two (36px from top and bottom, you are left with 720x216)
    5. Resize field one to 720x288
    6. Resize field two to 720x288
    7. Combine them line by line so it becomes interlaced again.

    The result should be a 720x576 image without black borders.

    Can someone replace the lines with AviSynth code?

    EDIT: I found out that I can create the exact same filter inside VirtualDub.

    - open file
    - add filter Deinterlace method "Unfold fields side by side"
    - add filter Null Transform and crop 36px from top and bottom, result 1440x216
    - add filter Resize and scale to 1440x288, mode: Bicubic (or whatever you like)
    - add filter Deinterlace once more and choose "Fold side-by-side fields together"

    Result is a 720x576 interlaced anamorphic image that you can write to a DVD as a 16:9 video.
    Last edited by Koppel; 12th Aug 2010 at 07:31.
    Quote Quote  
  2. Always Watching guns1inger's Avatar
    Join Date
    Apr 2004
    Location
    Miskatonic U
    Search Comp PM
    Better yet, download and install AvsP, and you will be able to visually create the script yourself.

    We aware that doing converting 4:3 to 16:9 this way really only works well if the source was letterboxed 4:3 and you are removing the bars, or the source was actually framed with this cropping in mind during shooting. Otherwise you risk cropping off heads and feet unintentionally. It is akin to a straight centre crop pan and scan, without the scan.
    Read my blog here.
    Quote Quote  
  3. Resizing fields like that should be avoided if possible. It treats scanlines that are not next to each other (they are separated by one scan line) as if they are. Sharp horizontal edges will develop artifacts.

    WhateverSource()
    SeparateFields()
    Crop(0,36,-0,-36) # you may have to adjust the top and bottom crop if the video isn't centered
    BicubicResize(720,288) # or your favorite resizer
    Weave()
    A better solution is to use a smart bob doubler like Yadif() or TempGaussMC_beta1mod() to create full frames from each field then reinterlace:
    WhateverSource()
    Crop(0,72,-0,-72) # you may have to adjust the top and bottom crop if the video isn't centered
    Yadif(mode=1, order=0) #25i becomes 50p
    BicubicResize(720,576) # or your favorite resizer
    SeparateFields()
    SelectEvery(4,1,2) #assuming BFF
    Weave()
    Cropping before resizing will be a little faster.

    Source (TFF, 720x480 NTSC):
    Click image for larger version

Name:	orig.png
Views:	750
Size:	1,014.7 KB
ID:	3050

    First script:
    Click image for larger version

Name:	script1.png
Views:	748
Size:	1,014.7 KB
ID:	3051

    Second script:
    Click image for larger version

Name:	script2.png
Views:	786
Size:	1,014.7 KB
ID:	3052
    Last edited by jagabo; 12th Aug 2010 at 07:33.
    Quote Quote  
  4. Member
    Join Date
    Apr 2008
    Location
    Estonia
    Search Comp PM
    Resizing fields like that should be avoided if possible. It treats scanlines that are not next to each other
    I was thinking about that, but my results seemed OK.

    Is there a way to do it correctly with VirtualDub?

    SelectEvery(4,1,2) #assuming BFF
    How do I change this to Upper Field First?
    Quote Quote  
  5. Originally Posted by Koppel View Post
    Is there a way to do it correctly with VirtualDub?
    I don't think you can do it in VirtualDub because there's no equivalent to SelectEvery().

    Originally Posted by Koppel View Post
    SelectEvery(4,1,2) #assuming BFF
    How do I change this to Upper Field First?
    Add AssumeTFF() just after opening the source and change SelectEvery(4,1,2) to SelectEvery(4,0,3).

    WhateverSource()
    AssumeTFF()
    Crop(0,72,-0,-72) # you may have to adjust the top and bottom crop if the video isn't centered
    Yadif(mode=1, order=0) #25i becomes 50p
    BicubicResize(720,576) # or your favorite resizer
    SeparateFields()
    SelectEvery(4,0,3) # TFF
    Weave()
    Last edited by jagabo; 12th Aug 2010 at 09:57.
    Quote Quote  
  6. Member Alex_ander's Avatar
    Join Date
    Oct 2006
    Location
    Russian Federation
    Search Comp PM
    + add AssumeTFF() before separate fields, otherwise it will depend on source. A simple rule: SelectEvery(4,0,3) gives the same output field order as just before field separation, SelectEvery(4,1,2) gives inverse order.
    Quote Quote  
  7. Member
    Join Date
    Apr 2008
    Location
    Estonia
    Search Comp PM
    What does the AssumeTFF() do? Automatically understands the field order of the source?

    Is it absolutely clear that it is impossible to recreate the same thing correctly with just VirtualDub?
    Quote Quote  
  8. Originally Posted by Koppel View Post
    What does the AssumeTFF() do? Automatically understands the field order of the source?
    It tells AviSynth to treat the video as top field first instead of bottom field first.

    Originally Posted by Koppel View Post
    Is it absolutely clear that it is impossible to recreate the same thing correctly with just VirtualDub?
    I don't know of any way to duplicate the SelectEvery(4,0,3) in VirtualDub.
    Quote Quote  
  9. Member Alex_ander's Avatar
    Join Date
    Oct 2006
    Location
    Russian Federation
    Search Comp PM
    Originally Posted by Koppel View Post
    Automatically understands the field order of the source?
    In most cases you have to manually adjust your script to actual field order of the source. In current version of the script it's 'order=0', which only works correctly for BFF Yadif input. AssumeTFF before Yadif only changes one thing: Yadif will declare TFF for its output progressive video and that provides the proper order of field separation later. If your input video were TFF, you'd have to use order=1 in Yadif, otherwise it would output frames out of order (with motion phases mixed up) - it would still work, but with BFF in the end of the script.
    Quote Quote  
  10. Member
    Join Date
    Apr 2008
    Location
    Estonia
    Search Comp PM
    I would like to edit the first post, so that it contains all the correct information and the script, can someone take a look and say if all of this is correct now?

    CODE tags put // infront and behind of "C:\Program... - why the hell?

    LoadCPlugin("C:\Program Files\AviSynth 2.5\plugins\yadif.dll")
    AVISource("filename.avi") #Or DirectShowSource for MPEG files
    Crop(0,72,-0,-72) # you may have to adjust the top and bottom crop if the video isn't centered
    Yadif(mode=1, order=0) #25i becomes 50p
    BicubicResize(720,576) # or your favorite resizer
    AssumeTFF()
    SeparateFields()
    SelectEvery(4,1,2) #assuming BFF
    Weave()


    Also, how to read the SelectEvery(4,1,2) command. What do the numbers mean?
    Last edited by Koppel; 13th Aug 2010 at 00:50.
    Quote Quote  
  11. Originally Posted by Koppel View Post
    Also, how to read the SelectEvery(4,1,2) command. What do the numbers mean?
    Of every 4 frames/fields (fields in your case) select the second and third and toss out the first and fourth (AviSynth numbering begins with zero).
    Quote Quote  
  12. Member
    Join Date
    Apr 2008
    Location
    Estonia
    Search Comp PM
    Ok, so... SelectEvery(4,1,2) means:

    4 - of every 4 fields
    1 - select second
    2 - select third

    The fields are T - top, B - bottom
    [T, B, T, B] - four fields
    selected ones are upper case
    [t, B, T, b][t, B, T, b]

    Can someone confirm the script two posts up to be as correct as can be?
    Last edited by Koppel; 13th Aug 2010 at 03:00.
    Quote Quote  
  13. Member Alex_ander's Avatar
    Join Date
    Oct 2006
    Location
    Russian Federation
    Search Comp PM
    Originally Posted by Koppel View Post
    I would like to edit the first post...
    LoadCPlugin("full_path\yadif.dll")# not needed if yadif.dll is in "C:\Program Files\AviSynth 2.5\plugins\" folder
    #LoadPlugin("full_path\DGDecode.dll")# for mpeg files; or put it into "C:\Program Files\AviSynth 2.5\plugins" folder
    AVISource("filename.avi") # or MPEG2Source("filename.d2v") of DGDecode plugin for MPEG files
    Crop(0,72,-0,-72) # you may have to adjust the top and bottom crop if the video isn't centred
    Yadif(mode=1, order=0) #25i becomes 50p; use 'order=1' for TFF input video
    BicubicResize(720,576) # or your favourite resizer
    AssumeTFF()# corresponds to the desired output field order (with 4,0,3 numbers below)
    SeparateFields()
    SelectEvery(4,0,3)
    Weave()
    Quote Quote  
  14. Member Alex_ander's Avatar
    Join Date
    Oct 2006
    Location
    Russian Federation
    Search Comp PM
    Originally Posted by Koppel View Post
    And "Weave()" puts them together how exactly?
    It will take BT, BT... as they follow and write them into frames. So in the case you analyzed the order would be BFF.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!