VideoHelp Forum
+ Reply to Thread
Results 1 to 9 of 9
Thread
  1. Member
    Join Date
    Sep 2014
    Location
    Italy
    Search PM
    Hi,

    I've been using an AviSynth+ script without any errors for 2 years.

    However, since February 2023, it has been increasing the video length a lot. For example, a 2-hour video is being delivered as a 4-hour video.

    Interestingly enough, I have noticed that this problem of doubling the video length does not occur in videos shorter than 1 hour.

    I "guess" that it's not the AviSynth+ script that's causing the issue, but rather a Windows update on my Windows 10.

    I'm using LSMASHVideoSource to open the file in AviSynth+.


    Please,

    Does anyone know why it is happening?

    Have you faced a similar problem?


    More details about my PC features, Windows data, and AviSynth+ Script are available below:


    Device Name: Tony-PC
    Processor: AMD Ryzen 7 2700 Eight-Core Processor 3.20 GHz
    Installed RAM: 64.0 GB
    Device ID: C34E00E7-08DA-4E24-9800-FB393CD66A3C
    Product ID: 00331-20020-00000-AA561
    System Type: 64-bit operating system, x64-based processor
    Pen and Touch: No pen or touch input is available for this display.

    Operating System Name: Microsoft Windows 10 Pro
    Version: 10.0.19044 Build 19044
    Other Operating System Description: Not available
    Operating System Manufacturer: Microsoft Corporation
    System Name: TONY-PC
    System Manufacturer: System manufacturer
    System Model: System Product Name
    System Type: x64-based PC
    System SKU: SKU
    Processor: AMD Ryzen 7 2700 Eight-Core Processor, 3200 Mhz, 8 Core(s), 16 Logical Processor(s)
    BIOS Version/Date: American Megatrends Inc. 2407, 01/07/2020
    SMBIOS Version: 3.2
    Embedded Controller Version: 255.255
    BIOS Mode: Legacy
    BaseBoard Manufacturer: ASUSTeK COMPUTER INC.
    BaseBoard Product: TUF GAMING X570-PLUS_BR
    BaseBoard Version: Rev X.0x
    Platform Role: Desktop
    Secure Boot State: Unsupported
    PCR7 Configuration: Binding Not Possible
    Windows Directory: C:\Windows
    System Directory: C:\Windows\system32
    Boot Device: \Device\HarddiskVolume4
    Hardware Abstraction Layer: Version = "10.0.19041.2251"
    User Name: Tony-PC\Tony
    Time Zone: Brasilia Time
    Installed Physical Memory (RAM): 64.0 GB
    Total Physical Memory: 63.9 GB
    Available Physical Memory: 55.3 GB
    Total Virtual Memory: 63.9 GB
    Available Virtual Memory: 53.1 GB
    Page File Space: 0 bytes
    Kernel DMA Protection: Off
    Virtualization-based security: Not enabled
    Device Encryption Support: Reasons for failed automatic device encryption: TPM is not usable, PCR7 binding is not supported, Hardware Security Test Interface failed and device is not Modern Standby, Un-allowed DMA capable bus/device(s) detected, TPM is not usable
    Virtualization Enabled in Firmware: No
    Second Level Address Translation (SLAT) extensions: Yes
    Virtualization Enabled: No
    Data Execution Prevention Available: Yes


    AviSynth+ SCRIPT THAT I'M USING:
    Code:
    SetMemoryMax(1024)
    SetFilterMTMode("MT_SERIALIZED", 3)
    
    
    Loadplugin("m:\temp2\mvtools2.dll")
    LoadPlugin("m:\temp2\CNR2_x64.dll")
    LoadPlugin("M:\Temp2\LSMASHSource.dll")
    LoadPlugin("M:\Temp2\RgTools.dll")
    LoadPlugin("M:\Temp2\MPEG2DecPlus64.dll")
    Import("M:\Temp2\Zs_RF_Shared.avsi")
    Import("M:\Temp2\LSFMod.avsi")
    Import("M:\Temp2\SetMTMode.avsi")
    
    
    
    ####Source=mpeg2source("D:\Paulo Medeiros Junior  19-7-18\dvd\17 dvd e 09 8mm.d2v")
    ####Source=AVISource("D:\Bolshoi\Lote 02\L02-18 4capt V7800LGPANSVHDMI c TBC Ok.avi")
    
    ####Source=DirectShowSource("D:\Valdir Steglich 21.2.22\08 Valdir vhs  V17JVCES10 Ok.m2t")
    
    v = LSMASHVideoSource("D:\Bolshoi\Lote 02\L02-45 2capt V19LGPANSVHDMI.mp4", track=0, threads=0, seek_mode=0,  
    \                 seek_threshold=10, dr=False, fpsnum=0, fpsden=1, 
    \                 format="YUV420P8", decoder="", prefer_hw=0, ff_loglevel=0)
    a = LSmashAudioSource("D:\Bolshoi\Lote 02\L02-45 2capt V19LGPANSVHDMI.mp4")
    Source=AudioDub(v,a)
    
     
    #Source=DirectShowSource("E:\Carol 18.11.20 - Fazer\03 CA V17JVCES10.mp4", fps = 25, ConvertFPS = True ) #.Crop(0,0-0,-30,true) # para AVI encapsulado AVI Xvid da Avermidia
    #Source=DirectShowSource ("E:\Pricilla 3.9.20 - Fazer CM\01 PR V17JVCES10.mp4", fps = 25, ConvertFPS = True )
    ##Source=DirectShowSource("E:\Decio 1.3.21 - Fazer\02 Decio 6 capt VPAN2JVCES10DV.avi")
    
    SetFilterMTMode("DEFAULT_MT_MODE", 2)
    
    
    #Conditionalmedian(source,mthres=16,mwidth=7,mheight=5,mp=11,interlaced=true) 
    #ConditionalDenoise(source,mthres=16,mwidth=7,mheight=5,mp=11,p1=24,p2=12,interlaced=true) 
    #bob(0,0.5)
    
    chroma=source.Cnr2("oxx",8,16,191,100,255,32,255,false) #VHS
    output=MDegrain2i2(chroma,8,2,0)
    
    stackhorizontal(source,output)
    
    return output
    
    #-------------------------------
    
    function MDegrain2i2(clip source, int "blksize", int "overlap", int "dct") 
    {
      Vshift=0 # 2 lines per bobbed-field per tape generation (PAL); original=2; copy=4 etc
      Hshift=0 # determine experimentally 
      overlap=default(overlap,4) # overlap value (0 to 4 for blksize=8)
      dct=default(dct,0) # use dct=1 for clip with light flicker
    
      fields=source.SeparateFields() # separate by fields
    
      #This line gets rid of vertical chroma halo. Don't use unless you have the problem
      #fields=MergeChroma(fields,crop(fields,Hshift,Vshift,0,0).addborders(0,0,Hshift,Vshift))
    
      super = fields.MSuper(pel=2, sharp=1)
      backward_vec2 = super.MAnalyse(isb = true, delta = 2, blksize=blksize, overlap=overlap, dct=dct)
      forward_vec2 = super.MAnalyse(isb = false, delta = 2, blksize=blksize, overlap=overlap, dct=dct)
      backward_vec4 = super.MAnalyse(isb = true, delta = 4, blksize=blksize, overlap=overlap, dct=dct)
      forward_vec4 = super.MAnalyse(isb = false, delta = 4, blksize=blksize, overlap=overlap, dct=dct)
    
      #Increase thSAD for more denoising. Won't do much beyone about 1500
      MDegrain2(fields,super, backward_vec2,forward_vec2,backward_vec4,forward_vec4,thSAD=1500) 
    Prefetch(16)
      Weave()
    }


    Thank you so much!
    Quote Quote  
  2. sorry, I guess wrong tip
    Quote Quote  
  3. The script itself looks fine and doesn't change the length here at all.
    My guess is either the time codes of your input are broken or audio is way longer than the video.
    So, I would suggest to try:
    a. remuxing the file while dropping the time stamps and processing the new file.
    b. only processing the video and check the output length.
    c. try using LWLibavVideoSource instead of LSMASHVideoSource

    Cu Selur
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  4. Member
    Join Date
    Sep 2014
    Location
    Italy
    Search PM
    Originally Posted by Selur View Post
    The script itself looks fine and doesn't change the length here at all.
    My guess is either the time codes of your input are broken or audio is way longer than the video.
    So, I would suggest to try:
    a. remuxing the file while dropping the time stamps and processing the new file.
    b. only processing the video and check the output length.
    c. try using LWLibavVideoSource instead of LSMASHVideoSource

    Cu Selur


    Hi Selur, I followed your recommendation and made the following change to my script:

    Code:
    v = LWLibavVideoSource("D:\Bolshoi\Lote 02\L02-23 3capt V7800LGPANSVHDMI.mp4", format="YUV420P8", fpsnum=0)  
    #\ cache=true, cachefile="source.lwi" seek_mode=0, seek_threshold=10,
    #\ dr=false, fpsnum=0, fpsden=1, repeat=false, dominance=0,
    #\ format="YUV420P8", decoder="", prefer_hw=0, ff_loglevel=0)
    
    a = LWLibavAudioSource("D:\Bolshoi\Lote 02\L02-23 3capt V7800LGPANSVHDMI.mp4", stream_index=-1, cache=true,
    \ av_sync=false, layout="FL+FR", rate=0, decoder="")
    Source=AudioDub(v,a)


    It had a small audio delay during the whole video. But it ran with the correct time of 1 hour and 42 minutes.

    I believe I am not adjusting the settings correctly for my video, so I will share below the MediaInfo with more information. Thank you so much for the recommendation and help!


    General
    Complete name : D:\Bolshoi\Lote 02\L02-23 3capt V7800LGPANSVHDMI.mp4
    Format : MPEG-4
    Format profile : Base Media / Version 2
    Codec ID : mp42 (mp42/isom)
    File size : 3.61 GiB
    Duration : 1 h 42 min
    Overall bit rate mode : Variable
    Overall bit rate : 5 052 kb/s
    Encoded date : UTC 2023-03-06 13:06:32
    Tagged date : UTC 2023-03-06 13:06:32

    Video
    ID : 2
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : Main@L3
    Format settings : 2 Ref Frames
    Format settings, CABAC : No
    Format settings, Reference : 2 frames
    Format settings, GOP : M=3, N=30
    Codec ID : avc1
    Codec ID/Info : Advanced Video Coding
    Duration : 1 h 42 min
    Source duration : 1 h 42 min
    Bit rate mode : Variable
    Bit rate : 4 725 kb/s
    Maximum bit rate : 5 000 kb/s
    Width : 720 pixels
    Height : 480 pixels
    Display aspect ratio : 4:3
    Frame rate mode : Variable
    Frame rate : 59.529 FPS
    Minimum frame rate : 4.286 FPS
    Maximum frame rate : 60.000 FPS
    Original frame rate : 60.000 FPS
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Progressive
    Bits/(Pixel*Frame) : 0.230
    Stream size : 3.37 GiB (94%)
    Source stream size : 3.37 GiB (94%)
    Language : English
    Encoded date : UTC 2023-03-06 13:06:32
    Tagged date : UTC 2023-03-06 13:06:32
    mdhd_Duration : 6130584
    Codec configuration box : avcC

    Audio
    ID : 1
    Format : AAC LC
    Format/Info : Advanced Audio Codec Low Complexity
    Codec ID : mp4a-40-2
    Duration : 1 h 42 min
    Source duration : 1 h 42 min
    Bit rate mode : Constant
    Bit rate : 320 kb/s
    Nominal bit rate : 128 kb/s
    Channel(s) : 2 channels
    Channel layout : L R
    Sampling rate : 48.0 kHz
    Frame rate : 46.875 FPS (1024 SPF)
    Compression mode : Lossy
    Stream size : 234 MiB (6%)
    Source stream size : 234 MiB (6%)
    Language : English
    Encoded date : UTC 2023-03-06 13:06:32
    Tagged date : UTC 2023-03-06 13:06:32
    mdhd_Duration : 6130594
    Last edited by NLP; 7th Mar 2023 at 20:16.
    Quote Quote  
  5. Variable frame rate is your problem. It must be converted to constant frame rate for AviSynth. Try:

    Code:
    v = LWLibavVideoSource("D:\Bolshoi\Lote 02\L02-23 3capt V7800LGPANSVHDMI.mp4", format="YUV420P8", fpsnum=60000, fpsden=1001)
    Step through the video frame by frame. If you see every frame twice change fpsnum=60000 to fpsnum=30000.
    Quote Quote  
  6. Member
    Join Date
    Sep 2014
    Location
    Italy
    Search PM
    Originally Posted by jagabo View Post
    Variable frame rate is your problem. It must be converted to constant frame rate for AviSynth. Try:

    Code:
    v = LWLibavVideoSource("D:\Bolshoi\Lote 02\L02-23 3capt V7800LGPANSVHDMI.mp4", format="YUV420P8", fpsnum=60000, fpsden=1001)
    Step through the video frame by frame. If you see every frame twice change fpsnum=60000 to fpsnum=30000.


    Hi Jagabo,

    When I run the script in 30,000 it works with the old LSMASHSource.dll version of 07/20/2020 but with the new version of 02/19/2023, it does not work.

    Unfortunately, I have to use 60,000 as my various VHS tapes are very oxidized and they have many horizontal lines.

    Moreover, I'm using 60,000 because the tracking of the image has better quality and especially because the speed of the video images is fast. I mean, the videos show people moving a lot cause they are all about ballerinas dancing in dance events.

    Thanks in advance for your help!

    Code:
    v = LWLibavVideoSource("D:\Bolshoi\Lote 02\L02-23 3capt V7800LGPANSVHDMI.mp4", format="YUV420P8", fpsnum=0)
    #\ cache=true, cachefile="source.lwi" seek_mode=0, seek_threshold=10,
    #\ dr=false, fpsnum=0, fpsden=1, repeat=false, dominance=0)
    #\ format="YUV420P8", decoder="", prefer_hw=0, ff_loglevel=0)
    
    a = LWLibavAudioSource("D:\Bolshoi\Lote 02\L02-23 3capt V7800LGPANSVHDMI.mp4", stream_index=-1, cache=true,
    \av_sync=false, layout="", rate=0, decoder="")
    AudioDub(v,a)


    MediaInfo details of the last video:

    General
    Complete name : D:\Bolshoi\Lote 02\L02-23 3capt V7800LGPANSVHDMI AVDPTL.avi
    Format : AVI
    Format/Info : Audio Video Interleave
    Format profile : OpenDML
    File size : 38.9 GiB
    Duration : 1 h 41 min
    Overall bit rate : 54.9 Mb/s
    Writing library : VirtualDub2 build 44282/release

    Video
    ID : 0
    Format : Lagarith
    Codec ID : LAGS
    Duration : 1 h 41 min
    Bit rate : 53.4 Mb/s
    Width : 720 pixels
    Height : 480 pixels
    Display aspect ratio : 3:2
    Frame rate : 60.000 FPS
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Bits/(Pixel*Frame) : 2.574
    Stream size : 37.8 GiB (97%)

    Audio
    ID : 1
    Format : PCM
    Format settings : Little / Signed
    Codec ID : 1
    Duration : 1 h 41 min
    Bit rate mode : Constant
    Bit rate : 1 536 kb/s
    Channel(s) : 2 channels
    Sampling rate : 48.0 kHz
    Bit depth : 16 bits
    Stream size : 1.09 GiB (3%)
    Alignment : Aligned on interleaves
    Interleave, duration : 17 ms (1.00 video frame)
    Interleave, preload duratio : 500 ms
    Last edited by NLP; 10th Mar 2023 at 10:11.
    Quote Quote  
  7. So, what's the problem?
    Quote Quote  
  8. Member
    Join Date
    Sep 2014
    Location
    Italy
    Search PM
    Originally Posted by jagabo View Post
    So, what's the problem?
    So, when I run the script using the configuration above it creates a delay in the audio of 1.5 or 2.5 seconds on average.

    It delays the audio.


    Thanks!
    Last edited by NLP; 10th Mar 2023 at 11:39.
    Quote Quote  
  9. You can use AudioTrim() to advance the audio before joining the audio and video, or Loop() to delay the video:

    Code:
    AudioDub(v, a.AudioTrim(1.5, 0)) # remove 1.5 seconds of audio
    There's also DelayAudio() which can advance the audio with a negative value.

    Code:
    AudioDub(v, a.DelayAudio(1.5)) # delay audio by 1.5 seconds

    You can use Loop() to delay the video:

    Code:
    AudioDub(v.Loop(int(1.5 * v.framerate),0,0), a) # repeat frame 0 for 1.5 seconds
    Last edited by jagabo; 10th Mar 2023 at 13:44.
    Quote Quote  



Similar Threads

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