VideoHelp Forum




+ Reply to Thread
Results 1 to 16 of 16
  1. Hi

    please enter the cats only.

    However

    I would use

    Code:
    assumeFPS(50)
    AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()
    but interlacing is extremely slow. Is a specific plugin for avisynth that do interlace more fast? thanks
    Quote Quote  
  2. Use multithreading

    Prefetch(some value)
    Quote Quote  
  3. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    Add Prefetch to the very end of your script in this format:

    Prefetch(x)

    where X is the number of logical processors in your CPU -1 or 2.

    “The Prefetch number should be set to 1 or 2 less than the number of "logical processors" in your system. To check what that is, go to Task Manager in Windows, select the Performance tab, then click on the CPU item. You'll see down below in the window an entry for the number of logical processors in your system. For some people, it will be the same as the number of physical cores, for others it might be double that if your CPU supports Hyperthreading. In my case, I have 12 logical processors, so I set Prefetch to 10.”

    Quoted from here (and it works from personal experience; Prefetch on my system increased encoding speed by 250%):

    http://macilatthefront.blogspot.com/

    Number of Logical Processors:

    Image
    [Attachment 72864 - Click to enlarge]
    Last edited by Alwyn; 2nd Aug 2023 at 20:01.
    Quote Quote  
  4. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    Did some encoding time tests on an AVI capture using QTGMC. 9:40 length.

    Prefetch (I have 24 logical processors) set to
    0: 6:20
    5: 2:00
    10: 1:26
    15 and above: 1:25
    Quote Quote  
  5. Interlacing like that is very fast in AviSynth. Whether you use prefetch or not. Something else in or about your script is slow.

    A 12 minute 40 second 1280x720, 50 fps video took about 11 seconds to process (VirtualDub2, Video -> Fast Recompress, File -> Run Video Analysis Pass, i7 9900K).

    Code:
    ColorBarsHD() #width=1280, height=720, pixel_type="YV24")
    AssumeFPS(50)
    Trim(0, 28999)
    AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()
    Adding prefetch(N) actually made it run a little slower. And in fact, removing the interlacing line actually slows the processing rate -- because twice as much data must be passed to the editor/encoder.
    Last edited by jagabo; 2nd Aug 2023 at 23:40.
    Quote Quote  
  6. does exist an external plugin that do what the

    Code:
    AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()
    do?
    Quote Quote  
  7. Originally Posted by marcorocchini View Post
    does exist an external plugin that do what the

    Code:
    AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()
    do?
    I don't know of any. But why? It won't run significantly faster.

    Why don't you post your entire script? Then someone will be able to tell you where the slowness is coming from.
    Quote Quote  
  8. oh my ***

    this is the source

    https://www.swisstransfer.com/d/6bffde22-b94f-4666-a353-c9bcce3aa38f

    Code:
    LoadPlugin("V:\FFMS2_R1363_AGO2023\X64\ffms2.dll")
    
    Import("V:\FFMS2_AVSI_2023\FFMS2.AVSI")
    
    FFVideoSource("v:\concatHD.ts", fpsnum=50, fpsden=1).assumeFPS(50).converttoYV12(interlaced=false)
    
    emask = mt_convolution(vertical="-1 2 -1").ColorYUV(off_y=-64).ColorYUV(gain_y=128).mt_expand(chroma="-128").Blur(0.8)
    Overlay(last, Blur(0.5, 0.6), mask=emask)
    
    ConvertToYUY2(interlaced=false)
    
    assumeFPS(50)
    AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()
    Prefetch(8)
    I would like to encode it in MXF 50i using "your" emask to reduce the artifacts dues by the progressive-->interlaced and overall: getting the exact duration of the source if possible


    or for example consider to get the output file using virtualdub and encode to uncompressed YUY2 avi file: if I encode the script where the interlacing is due to avisynth, the duration of the outputted .avi file seems to me similar to the source.

    But, if the encoding is due by virtuald, and removing the "AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()" lines in the script, and using the "interlace" filter in virtualdub, seems to me that the outputted .avi file have 1 problematic frame missing to the end.

    So I I would like not to use avisynth's interlacing, but it seems that: not using it, results in a bad final file of 1 missing frame
    Last edited by marcorocchini; 3rd Aug 2023 at 14:06.
    Quote Quote  
  9. Interlacing requires pairs of frames from the input -- one field comes from each of the two input frames. Your source has an odd number of frames (923) so the very last output frame cannot be interlaced properly. 923 source frames would become 461.5 output frames. You can't have half a frame so AviSynth uses two fields from the last input frame to build the last output frame, resulting in 462 frames. That is 1/50 second longer than your source. It sounds like VirtualDub just discards the orphaned field at the end, giving a results that's 1/50 second shorter than the source.
    Quote Quote  
  10. ahh

    ok.

    But using "AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()" in the script, the output seems alwais correct, even if the processing appear to slow.

    Really there can be no solution to get interlacing outside the avisynth interlacing?
    Quote Quote  
  11. Originally Posted by marcorocchini View Post
    Really there can be no solution to get interlacing outside the avisynth interlacing?
    No program can interlace an odd number of input frames and produce the same exact running time as the source.

    By the way, the major source of slowness in your script is the creation of the horizontal edge mask, emask.
    Quote Quote  
  12. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Yes, if X = # of 50p progressive frames, and is ODD #, and if Y = X / 2, then Y (interlaced frames) is never a Whole Number, requiring either loss of 1/2 frame, addition of dupe 1/2 frame, replacement/blend of 1 or 2 half frames, or error.

    Scott
    Quote Quote  
  13. ahh ok

    however my question now is:

    is there an alternative to the

    Code:
    emask = mt_convolution(vertical="-1 2 -1").ColorYUV(off_y=-64).ColorYUV(gain_y=128).mt_expand(chroma="-128").Blur(0.8)
    Overlay(last, Blur(0.5, 0.6), mask=emask)
    to speedup the encoding?

    I know the the the emask works fine but in certain cases requires too much time, so is there a different way even if not as so good?
    Quote Quote  
  14. Your source is oversharpened on both the vertical and horizontal. So you might as well blur all sharp edges. This runs much faster, about 5 seconds (no encoding) for the entire clip, on my computer:

    Code:
    FFVideoSource("concatHD.ts", fpsnum=50, fpsden=1)
    
    emask = mt_edge(mode="hprewitt", thy1=200, thy2=200).mt_expand().Blur(1.0)
    Overlay(last, Blur(0.7), mask=emask)
    
    ConvertToYUY2(interlaced=false)
    
    AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()
    Note the absence of prefilter().

    And if you don't mind blurring everything this takes about 2 seconds:

    Code:
    FFVideoSource("concatHD.ts", fpsnum=50, fpsden=1)
    
    Blur(0.7)
    
    ConvertToYUY2(interlaced=false)
    
    AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()
    Last edited by jagabo; 4th Aug 2023 at 20:08.
    Quote Quote  
  15. mt_edge() can be used to detect horizontal edges only and is much faster than mt_convolution(). So if you want something like my original horizontal edge detection use this:

    Code:
    FFVideoSource("concatHD.ts", fpsnum=50, fpsden=1)#.assumeFPS(50)#.converttoYV12(interlaced=false)
    
    emask = mt_edge("1 2 1 0 0 0 -1 -2 -1 1", thy1=250, thy2=250).mt_expand().Blur(1.0) # horizontal edges only
    Overlay(last, Blur(0.7), mask=emask)
    
    ConvertToYUY2(interlaced=false)
    
    AssumeTFF().SeparateFields().SelectEvery(4, 0, 3).Weave()
    Quote Quote  



Similar Threads

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