VideoHelp Forum




+ Reply to Thread
Results 1 to 26 of 26
  1. Member
    Join Date
    Mar 2007
    Location
    Slovakia
    Search Comp PM
    I have a one little problem, but sorry my english is wrong.
    I edit HDV (m2t) from Canon HV20 (PAL version) in Vegas8, and sometimes i make PAL DVD-Video. My problem is with resize in Vegas. Downconvert in Vegas is wrong. I try to use Avisynth and Lanczos3 filter, but output is jagged.

    My wrong way is this:

    I edit HDV in Vegas (project properties i set for HDV) and finaly use debugmode frameserver. Output is vegas.avi. Then i make avisynth script
    Code:
    DirectShowSource ("vegas.avi")
    Lanczos3Resize(720,576)
    this avs on player (MPC) and on prewiev mpeg2 enkoder (ProCoder) is jagged. When I open the same vegas.avi in VirtualDub and use Lanczos3 filter with option interlaced, output is no jagged. Is the way to resize in avisynth with option interlaced? I try use this scripts, but thats are wrong too:
    Code:
    DirectShowSource ("vegas.avi")
    SeparateFields()
    LanczosResize(720,288)
    odd=SelectOdd
    evn=SelectEven
    Interleave(evn,odd)
    Weave()
    
    DirectShowSource ("vegas.avi")
    SeparateFields()
    odd=SelectOdd
    evn=SelectEven
    Interleave(evn,odd)
    LanczosResize(720,576)
    Weave()
    thanx
    Quote Quote  
  2. Code:
    DirectShowSource ("vegas.avi") 
    SeparateFields() 
    LanczosResize(720,288) 
    Weave()
    Will work but won't give the best possible quality. A better option is to use a smart bobber like LeakKernelBob() or TDeint():

    Code:
    DirectShowSource ("vegas.avi") 
    TDeint(mode=1, order=0)
    LanczosResize(720,576) 
    SeparateFields()
    SelectEvery(4, 0, 3)
    Weave()
    Here's a 4x nearest neighbor enlargement using the two methods. On the top is the TDeint() method, the bottom the simple SeparateFields()/Weave() method:

    Quote Quote  
  3. Member
    Join Date
    Mar 2007
    Location
    Slovakia
    Search Comp PM
    OK, thanx, but i have some questions:

    Your script work, only when I load the plugin and convert the colours to YUY2. Is it correct? And finally, why is there SelectEvery(4, 0, 3), or what do this command? Thanx
    Quote Quote  
  4. Member Alex_ander's Avatar
    Join Date
    Oct 2006
    Location
    Russian Federation
    Search Comp PM
    Originally Posted by pkliment
    Your script work, only when I load the plugin and convert the colours to YUY2. Is it correct? And finally, why is there SelectEvery(4, 0, 3), or what do this command? Thanx
    If I remember it right, you have a choice in DebugMode (or Vegas) options between RGB and YUY2, use the latter setting to avoid extra conversion. Many of avs filters don't have RGB support.
    The numbers (4,0,3) mean that of each 4 sequential fields (100 fields/s) you select ## 0 & 3 for making the output frames with Weave(), the rest are not used.
    BTW, the script above will output BFF. If you want TFF, use AssumeTFF() before SeparateFields().
    Also I'd use the more reliable AviSource() for opening the DebugMode output.
    Quote Quote  
  5. Member
    Join Date
    Mar 2007
    Location
    Slovakia
    Search Comp PM
    Thanx.
    So when there are fields 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19, 20..., for Weave() SelectEvery(4,0,3) selects this fields 0,3,4,7,8,11,12,15,16,19...?

    I dont understand it, because then I lost information, when I dont use all fields. This unused fields are redundant?
    Quote Quote  
  6. Originally Posted by pkliment
    So when there are fields 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19, 20..., for Weave() SelectEvery(4,0,3) selects this fields 0,3,4,7,8,11,12,15,16,19...?
    Yes.

    Originally Posted by pkliment
    I dont understand it, because then I lost information, when I dont use all fields. This unused fields are redundant?
    TDeint(mode=1) converts each field into a full frame. So after TDeint() you have twice as many frames as the original video. Each frame is then split into two fields, half the fields are thrown away, and the remaining fields woven back into frames. In the end you have the same number of frames as the original video.
    Quote Quote  
  7. Member
    Join Date
    Mar 2007
    Location
    Slovakia
    Search Comp PM
    jagabo
    Alex_ander

    Thanx for your time and suggestions.
    Quote Quote  
  8. Member
    Join Date
    Mar 2007
    Location
    Slovakia
    Search Comp PM
    Sorry, but yet another question. When I use Lanczos3 with option interlaced in Virtualdub, SD(PAL) otput is subjective correct (no post-resize jugged). The resize (with interlaced option) in VD is on the same base like in Avisynth with TDeint or Yadif? Or the resize in VD is on other base -> when yes, so what? Thanx.
    Quote Quote  
  9. Member Alex_ander's Avatar
    Join Date
    Oct 2006
    Location
    Russian Federation
    Search Comp PM
    Originally Posted by pkliment
    The resize (with interlaced option) in VD is on the same base like in Avisynth with TDeint or Yadif? Or the resize in VD is on other base -> when yes, so what?
    I'm almost sure it's based on simple field separation (like in the first simple script) that is much worse than with smart-bob functions like LeakKernelBob (of LeakKernelDeint plugin), TDeint or Yadif. The idea is to create good frames from fields in order to resize on progressive material thus minimizing artifacts.
    Heard many complaints from HD camera users who had tried resizing to SD by simply resizing separated fields. The problem is that horizontal object edges can never get to the right TV line which is in the other field. Also vertical disallignment error takes place with this method.
    Quote Quote  
  10. Member
    Join Date
    Jan 2004
    Location
    Australia
    Search Comp PM
    The avisynth script above doesn't look right. The definitive answer and some follow-up :-
    http://forum.doom9.org/showthread.php?p=1117735#post1117735
    http://forum.doom9.org/showthread.php?p=1115201#post1115201

    The 2-phase resize (horizontal then deinterlace then vertical then reinterlace) is quicker than deinterlace then resize then reinterlace... less area to deinterlace.

    Questions on SelectEvery ? This may help http://forum.doom9.org/showthread.php?p=1110710#post1110710
    Quote Quote  
  11. Member Alex_ander's Avatar
    Join Date
    Oct 2006
    Location
    Russian Federation
    Search Comp PM
    Originally Posted by halsboss
    script above doesn't look right.
    I can only see field order in TDeint is assumed BFF while HDV is TFF, this will at worst reverse field order by the end of the script (it will be TFF).

    The 2-phase resize (horizontal then deinterlace then vertical then reinterlace) is quicker than deinterlace then resize then reinterlace... less area to deinterlace.
    Quicker. But is it the same quality resizing when you first do it horizontally, then vertically? Two-dimensional functions (like bi-cubic) are not necessarily composed of horizontal/vertical factors, so the results might be different. Also, is it 100% safe to resize horizontally, using a bi-dimensional function on interlaced and assuming independently resized the lines of the adjacent fields?
    Quote Quote  
  12. Sorry, I assumed HDV was BFF like regular DV. For a TFF source you can use:

    Code:
    DirectShowSource ("vegas.avi") 
    TDeint(mode=1, order=1) 
    LanczosResize(720,576) 
    AssumeTFF()
    SeparateFields() 
    SelectEvery(4, 0, 3) 
    Weave()
    VirtualDub's interlaced resize option is about the same as the first AviSynth script I gave:

    Code:
    SeparateFields() 
    LanczosResize(720,288) 
    Weave()
    Or in VirtualDub you can perform the steps sequentially:

    Code:
    Deinterlace -- unfold fields side by side
    Resize
    Deinterlace -- fold side by side fields together
    The trouble this type of resizing is that scanlines that are not next to each other are treated as if they are. That is, a field consists of every other scanline of a picture. The part of the picture that was between those scanlines is missing (it has been replaced by the other field.). SeparateFields() splits the two fields apart and packs the scanlines together. The artifacts generated by this method of interlaced resizing are most noticable on sharp, horizontal edges.
    Quote Quote  
  13. Member
    Join Date
    Jan 2004
    Location
    Australia
    Search Comp PM
    Originally Posted by Alex_ander
    Quicker. But is it the same quality resizing when you first do it horizontally, then vertically?
    Yes. Use a resizer of your choice. Significant encoding time savings for almost zip difference.

    Originally Posted by Alex_ander
    Also, is it 100% safe to resize horizontally, using a bi-dimensional function on interlaced and assuming independently resized the lines of the adjacent fields?
    Yes according to the resident experts at Doom9. See their links and use their search.,, discussed extensively over the years, it's one of their bread and butter questions.

    Code:
    AVISource("G:\HDTV\zzz.avi") 
    AssumeFPS(25) 
    AssumeTFF() 
    LastW=LAST.width() 
    LastH=LAST.height() 
    bicubicresize(720,LastH) 
    tdeint(mode=1,order=1) # mode=0=same rate output mode=1=double rate output (bobbing) order=0=BFF order=1=TFF 
    bicubicresize(720,576) 
    separatefields() 
    selectevery(4,0,3) 
    weave() 
    Converttoyv12(interlaced=true) 
    SetPlanarLegacyAlignment(True)
    Quote Quote  
  14. As I understand it the resizing filters have special cases when resizing only one dimension so it's safe to resize horizontally then deinterlace or bob.

    I wonder if the smart bobs will have a harder time (as in less accurate) detecting motion areas if the frame is downsized horizontally first though.

    In any case, all the bobs (dumb and smart) are imperfect and they always will be. They just differ in the amount and types of imperfections, and speed.
    Quote Quote  
  15. Member
    Join Date
    Jan 2004
    Location
    Australia
    Search Comp PM
    Try it.
    Quote Quote  
  16. Member racer-x's Avatar
    Join Date
    Mar 2003
    Location
    3rd Rock from the Sun
    Search Comp PM
    I tried your scripts.......sorry to say I'm not impressed. I prefer my much faster and equal quality script for resizing HDV 1080i to SD 480i:

    Code:
    DirectshowSource("mclip.avi")
    assumetff().Bob(height=480)
    LanczosResize(720,480)
    assumetff().separateFields()
    SelectEvery(4,0,3) #TFF source - use (4,1,2) for BFF
    Weave()
    Converttoyv12(interlaced=true)
    Your script yields 13 fps and mine yields 25.8 fps. My script gives the same or better quality as yours in all my tests so far. Mine gives better details. Using a "Smart Bobber" is a good idea when the output is the same size or larger size then the source. When resizing down less than half vertical resolution, I find a simple Bob works just as well.
    Got my retirement plans all set. Looks like I only have to work another 5 years after I die........
    Quote Quote  
  17. Member
    Join Date
    Jan 2004
    Location
    Australia
    Search Comp PM
    Bobbing ... you get what you ask for. Non-motion-compensated deinterlacing. Try decent motion action and see how you go. Why do you think it's faster than Tdeint ? Fairies hanging on ? Swing over to Doom9 and take a look around as to why the serious video processing people use these things. Bottom line = want good output then do good things to the video... chews fps to do that.
    Quote Quote  
  18. Member racer-x's Avatar
    Join Date
    Mar 2003
    Location
    3rd Rock from the Sun
    Search Comp PM
    It's a matter of opinion. Your method is good, but I prefer mine for 1080i resized to 480i. Yes I did test it on fast motion.........Sports is 90% of what I shoot anyway. I like Tdeint, but I think I like Yadif better for processing to same sized output. Now when I'm processing to a size smaller than the field size, I feel that a plain Bob works just fine. I've tested this way too many times allready. However I'm glad that you posted your method, because I got to learn about the nnedi plugin. Now that's interesting.........

    Yes I agree that there are some smart people on Doom9, but don't think for a second that's the only place you'll find them.........
    Got my retirement plans all set. Looks like I only have to work another 5 years after I die........
    Quote Quote  
  19. Member
    Join Date
    Jan 2004
    Location
    Australia
    Search Comp PM
    Can't argue with that, you're right it's personal preference. If it works for you then great. Yadif seems close enough to Tdeint to me too, although I've stayed with TDeint.

    I do sports action too and, like you no doubt, wish for minimal artifacts As long as the people's choices are more informed than less, which yours is, then great !

    Addendum: from the Wiki note the bolded sentence:-
    http://avisynth.org/mediawiki/Bob
    Bob takes a clip and bob-deinterlaces it. This means that it enlarges each field into its own frame by interpolating between the lines. The top fields are nudged up a little bit compared with the bottom fields, so the picture will not actually appear to bob up and down. However, it will appear to "shimmer" in stationary scenes because the interpolation doesn't really reconstruct the other field very accurately. This filter uses BicubicResize to do its dirty work.

    Also see you Bobbing to height 480 1st up... reversing the resize order and using Bob to resize vertically in step 1 using Bicubic (which the other script does although you could substitute another resizer in it if you chose)

    Have fun.
    PS what do you use to encode ?
    Quote Quote  
  20. Originally Posted by halsboss
    http://avisynth.org/mediawiki/Bob
    Bob... will appear to "shimmer" in stationary scenes because the interpolation doesn't really reconstruct the other field very accurately
    Yes but when you resize down to 44 percent of the original size it's not noticable. You will also see less sharp horizontal edges (compared to TDeint and Yadif). But this isn't a huge deal either. One might even prefer it for better compressibility.
    Quote Quote  
  21. Member
    Join Date
    Jan 2004
    Location
    Australia
    Search Comp PM
    Originally Posted by jagabo
    Originally Posted by halsboss
    http://avisynth.org/mediawiki/Bob
    Bob... will appear to "shimmer" in stationary scenes because the interpolation doesn't really reconstruct the other field very accurately
    Yes but when you resize down to 44 percent of the original size it's not noticable.
    Maybe. I've seen what I interpret as otherwise, briefly. Do so if you like, no problem for me, in the full knowledge of the statements in the Wiki. It may be quite acceptable for your purposes, up to you.

    Originally Posted by jagabo
    You will also see less sharp horizontal edges (compared to TDeint and Yadif). But this isn't a huge deal either. One might even prefer it for better compressibility.
    Yes, it might be "because the interpolation doesn't really reconstruct the other field very accurately", and even so one might well choose to trade-off. I have done too by using ffmpeg from time to time on sources I'm not too fussed about The ffmpeg mailing list indicated it's internal resizer isn't too great but it seems "close enough" for some sources.

    Careful as line-wrapping in code-blocks seems to be an issue. And it produces bitrate "spikes" which you may need to resolve (I do so by creating DVD from the ffmpeg output using VideoReDo TV Suite which auto fixes up such things).
    Code:
    @echo OFF
    REM put fully-qualified drive/path/filename in between the quotes
    Call :1pass "test.mpg"
    pause
    exit
    
    :1pass
    REM 1-pass 1080i to 576i
    set        fINPUT=%~1%
    set       fOUTPUT=%~1%.mpg
    set f2passlogfile=%~1%.log
    set fSIZE=704x576
    set fASPECT=16:9
    set faveragebitrate=9200k
    set fMAXBITRATE=9400k
    set fMINBITRATE=7000k
    set faudiofreq=48000
    set faudiobitrate=192k
    Rem Tff=1 Bff=0
    set FieldFirst=1
    rem INTERLACED FLAGS -ilme -ildct -flags +ildct+ilme -ildctcmp satd -top %FieldFirst% 
    set fInterlacedSETTINGS=-top %FieldFirst% -ilme -ildct -flags +ildct+ilme+loop+trell+cgop -mbd rd -cmp satd -subcmp satd -ildctcmp satd -vb_strategy 1
    set fNonInterlacedSETTINGS=-flags +loop+trell+cgop -mbd rd -cmp satd -subcmp satd -vb_strategy 1
    @echo on
    "C:\SOFTWARE\ffmpeg\ffmpeg.exe" -y -i "%fINPUT%" -target pal-dvd -b %faveragebitrate% -minrate %fMINBITRATE% -maxrate %fMAXBITRATE% -qmin 1 -qmax 31 -dc 10 %fInterlacedSETTINGS% -s %fSIZE% -aspect %fASPECT% -ab %faudiobitrate% -ar %faudiofreq% -ac 2 -acodec ac3 "%fOUTPUT%"
    goto :EOF
    
    :2pass
    REM 2-pass 1080i to 576i
    set        fINPUT=%~1%
    set       fOUTPUT=%~1%.mpg
    set f2passlogfile=%~1%.log
    set fSIZE=704x576
    set fASPECT=16:9
    set faveragebitrate=9200k
    set fMAXBITRATE=9400k
    set fMINBITRATE=7000k
    set faudiofreq=48000
    set faudiobitrate=192k
    Rem Tff=1 Bff=0
    set FieldFirst=1
    rem INTERLACED FLAGS -ilme -ildct -flags +ildct+ilme -ildctcmp satd -top %FieldFirst% 
    set fInterlacedSETTINGS=-top %FieldFirst% -ilme -ildct -flags +ildct+ilme+loop+trell+cgop -mbd rd -cmp satd -subcmp satd -ildctcmp satd -vb_strategy 1
    set fNonInterlacedSETTINGS=-flags +loop+trell+cgop -mbd rd -cmp satd -subcmp satd -vb_strategy 1
    @echo on
    "C:\SOFTWARE\ffmpeg\ffmpeg.exe" -y -i "%fINPUT%" -pass 1 -passlogfile "%f2passlogfile%" -target pal-dvd -b %faveragebitrate% -minrate %fMINBITRATE% -maxrate %fMAXBITRATE% -qmin 1 -qmax 31 -dc 10 %fInterlacedSETTINGS% -s %fSIZE% -aspect %fASPECT% -an "%fOUTPUT%"
    "C:\SOFTWARE\ffmpeg\ffmpeg.exe" -y -i "%fINPUT%" -pass 2 -passlogfile "%f2passlogfile%" -target pal-dvd -b %faveragebitrate% -minrate %fMINBITRATE% -maxrate %fMAXBITRATE% -qmin 1 -qmax 31 -dc 10 %fInterlacedSETTINGS% -s %fSIZE% -aspect %fASPECT% -ab %faudiobitrate% -ar %faudiofreq% -ac 2 -acodec ac3 "%fOUTPUT%"
    goto :EOF
    1080i-to-576i-ffmpeg-interlaced.bat
    Quote Quote  
  22. Member racer-x's Avatar
    Join Date
    Mar 2003
    Location
    3rd Rock from the Sun
    Search Comp PM
    halsboss wrote:
    PS what do you use to encode ?
    For SD / DVD I like HCenc. For H.264 I like MeGui. For VC-1 I like wmvmuxer. For HDV, I use a variety of encoders like HCenc, TMPGEnc, and Main Concept.
    Got my retirement plans all set. Looks like I only have to work another 5 years after I die........
    Quote Quote  
  23. Member
    Join Date
    Jan 2004
    Location
    Australia
    Search Comp PM
    Originally Posted by racer-x
    For SD / DVD I like HCenc. For H.264 I like MeGui. For VC-1 I like wmvmuxer. For HDV, I use a variety of encoders like HCenc, TMPGEnc, and Main Concept.
    Thanks. I prefer the free HC for mpeg2 too. What do you think of command line X264 for mpeg4 ? http://x264.nl/ I gather it underpins a range of other products, as does the ubiquitous ffmpeg.
    Quote Quote  
  24. Originally Posted by halsboss
    Originally Posted by jagabo
    Originally Posted by halsboss
    http://avisynth.org/mediawiki/Bob
    Bob... will appear to "shimmer" in stationary scenes because the interpolation doesn't really reconstruct the other field very accurately
    Yes but when you resize down to 44 percent of the original size it's not noticable.
    Maybe. I've seen what I interpret as otherwise, briefly.
    Maybe I should have said barely noticeable.
    Quote Quote  
  25. Member
    Join Date
    Jan 2004
    Location
    Australia
    Search Comp PM
    Maybe works for me too. Trick seems to be for a person to use whatever makes him/her happy, knowing the possibilities and risks. The OP got his/her money's worth
    Quote Quote  
  26. Member racer-x's Avatar
    Join Date
    Mar 2003
    Location
    3rd Rock from the Sun
    Search Comp PM
    Sorry, I don't like comandline tools much (besides Avisynth). Hence the reason I use MeGui. I prefer to change settings via a GUI. I do think x264 does a great job though.
    Got my retirement plans all set. Looks like I only have to work another 5 years after I die........
    Quote Quote  



Similar Threads

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