VideoHelp Forum
+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 32
Thread
  1. Member
    Join Date
    Aug 2023
    Location
    USA
    Search PM
    I am having problems with Avisynth+ where the audio sync gets worse the farther into the video it plays.

    I am working with NTCS VHS captures from Lagarith in AmarecTV, to a lossless avi 720x480 yuv422p. Running through a TBC or not made no difference.

    Weird thing is that the lossless video plays just fine in VLC. Moreover, merely playing the video from AvsPmod without any processing or cropping of any kind manifests the audio sync issue.

    Both AviSource and FFMPEGSource2 manifest the same problem.

    Any thoughts?
    Quote Quote  
  2. Check the avs script sync by playing it back in MPCHC
    Quote Quote  
  3. Member
    Join Date
    Aug 2023
    Location
    USA
    Search PM
    Yeah, AvsPmod isn't a player, but it provides realtime preview output of a script. I've run the scripts on the full video and the output matches what is going on in the AvsPmod preview
    Quote Quote  
  4. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    Perhaps you should put up a mediainfo report (text view) of your source file
    Quote Quote  
  5. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    Originally Posted by Forenzik View Post
    Yeah, AvsPmod isn't a player, but it provides realtime preview output of a script.
    Then use it as such, i.e. to check the filtered output video frame, not to play.

    Originally Posted by Forenzik View Post
    I've run the scripts on the full video and the output matches what is going on in the AvsPmod preview
    I do not understand what you mean. "Scripts" -> How many?; "On the full video" -> What does it mean in this contest?; "the output matches what is going on in the AvsPmod preview" -> Do you mean the video/audio are not in synch when played in MPCHC as suggested? If you have some filtering it is normal to do not have a real time rendering (many of my scripts run at 0.1 frame per second)
    Quote Quote  
  6. Member
    Join Date
    Aug 2023
    Location
    USA
    Search PM
    Ok, so in MPCHC, the AVI capture plays with audio synced, but then when i deinterlace it using an Avisynth+ script (QTGMC in AvsPmod), the resulting AVI file is out of sync in MPCHC. Below are is the media info output for each file.

    Here is the info of the captured AVI:
    Format : AVI
    Format/Info : Audio Video Interleave
    Format settings : WaveFormatEx
    File size : 48.4 GiB
    Duration : 2 h 2 min
    Overall bit rate : 56.5 Mb/s
    Frame rate : 29.970 FPS

    Video
    ID : 0
    Format : Lagarith
    Codec ID : LAGS
    Duration : 2 h 2 min
    Bit rate : 52.8 Mb/s
    Width : 720 pixels
    Height : 480 pixels
    Display aspect ratio : 3:2
    Frame rate : 29.970 (30000/1001) FPS
    Standard : NTSC
    Bits/(Pixel*Frame) : 5.093
    Stream size : 45.2 GiB (93%)

    Audio
    ID : 1
    Format : PCM
    Format settings : Little / Signed
    Codec ID : 1
    Duration : 2 h 2 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.32 GiB (3%)
    Alignment : Aligned on interleaves



    Here is the info of the AVI after it was run through AvsPmod:

    Format : AVI
    Format/Info : Audio Video Interleave
    Format profile : OpenDML
    Format settings : BitmapInfoHeader / PcmWaveformat
    File size : 379 GiB
    Duration : 2 h 2 min
    Overall bit rate : 442 Mb/s
    Frame rate : 59.769 FPS
    Writing library : VirtualDub2 build 44282/release

    Video
    ID : 0
    Format : RGB
    Codec ID : 0x00000000
    Codec ID/Info : Basic Windows bitmap format. 1, 4 and 8 bpp versions are palettised. 16, 24 and 32bpp contain raw RGB samples
    Duration : 2 h 2 min
    Bit rate : 441 Mb/s
    Width : 640 pixels
    Height : 480 pixels
    Display aspect ratio : 4:3
    Frame rate : 59.769 FPS
    Color space : RGB
    Bit depth : 8 bits
    Bits/(Pixel*Frame) : 24.000
    Stream size : 377 GiB (100%)

    Audio
    ID : 1
    Format : PCM
    Format settings : Little / Signed
    Codec ID : 1
    Duration : 2 h 2 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.32 GiB (0%)
    Alignment : Aligned on interleaves
    Interleave, duration : 17 ms (1.00 video frame)
    Interleave, preload duration : 500 ms
    Quote Quote  
  7. 1) something wrong with the exported uncompressed RGB framerate
    Frame rate : 59.769 FPS
    But the source was
    Frame rate : 29.970 (30000/1001) FPS
    So you'd expect it to say 59.94(60000/1001) FPS after QTGMC

    Maybe a source filter error

    Add Info() to the script, with only the source filter, what does it say ?

    Post full script, add info() to the end, what does it say ?


    2) Are you certain that your system is fast enough to play uncompressed SD RGB @59.94 ? (or the messed up 59.769 FPS) . Try using compression to rule out a playback issue. Post your computer specs
    Quote Quote  
  8. Member
    Join Date
    Aug 2023
    Location
    USA
    Search PM
    Thank you for the Info() suggestion.

    If I just read the source in the script, it's interesting. If I read it using FFMPEGSource2, its saying the FPS is 29.8846 , but if i read it using AviSource, it says the FPS is 29.9700

    When using FFMPEGSource2, i can force it to 29.97 with AssumeFPS(29.97). While if i do this, the sync is still off in AvsPmod, I can try running it fully through maybe.

    I wonder if this is a FFMPEG problem as I saw someone else with a similar issue. AviSource runs a lot slower, but maybe this is what I have to do for these particular videos (I have convereted dozens of other videos without this sync problem).
    *
    Yes, super fast system NVM.e drive, new cpu. Regardless, the problem does continue on if I encode it into a mp4.
    Image Attached Thumbnails Click image for larger version

Name:	screencap.JPG
Views:	5
Size:	37.5 KB
ID:	74909  

    Quote Quote  
  9. AVI doesn't support variable frame rate, as far as I know, so it might contain "null frames" due to dropped frames while the video was being captured, which I think would be skipped by default and the output would be the average frame rate, hence it being slightly lower then expected.

    If you decode the video this way, hopefully it will fix the problem. Any null frames will be replaced with a duplicate frame.
    If you use Info() as suggested and compare the output with and without FPSNum/Den and the frame rate and total number of frames changes, then with FPSNum/Den the A/V sync should be fine.

    FFMPEGSource("video.avi", FPSNum=30000, FPSDen=1001)

    If that is the problem AssumeFPS probably won't fix it, as that'll move every frame to a new position relative to the video, whereas frame rate conversion while decoding will leave them where they should be and fill in the gaps.
    I'd also consider remuxing the AVI as an MKV with MKVToolNix and using the MKV as the source file instead.

    AVISource should fill in the missing frames by default, as far as I know, so if it appears to be outputting the correct frame rate I'm not sure why the A/V sync isn't okay, unless it's because you're navigating back and forth in AvsPmod and AVISource isn't being very frame accurate.
    Last edited by hello_hello; 16th Nov 2023 at 20:34.
    Quote Quote  
  10. Does your video use lagarith with null frames option enabled ? Not sure of the current situation, but only AVISource with the official lagarith decoder used to work correctly with null frames . Libavcodec (in ffmpeg, libav and their derivatives) did not support lagarith null frames. Lagarith null frames help with compression in that pure duplicates, triplicates etc... are not encoded and stored to save space - they are only displayed at decompression time. Not sure if ffms2 with fpsden,fpsnum or any other CFR framerate fix will insert at the correct times. Lagarith official should

    But earlier you reported AVISource and FFMS2 had the same problem... so there might be something else going on
    Quote Quote  
  11. Member
    Join Date
    Aug 2023
    Location
    USA
    Search PM
    Null frames are not enabled.
    Image Attached Thumbnails Click image for larger version

Name:	screencap.JPG
Views:	12
Size:	60.0 KB
ID:	74910  

    Last edited by Forenzik; 17th Nov 2023 at 07:41.
    Quote Quote  
  12. Member
    Join Date
    Aug 2023
    Location
    USA
    Search PM
    Image
    [Attachment 74911 - Click to enlarge]
    Here's my other setting in Amarec
    Quote Quote  
  13. Have you tried decoding with frame rate conversion?

    If you remux the AVI as an MKV and check it with MediaInfo and it shows a variable frame rate, then missing/dropped frames may still be the issue.

    The null frames option when configuring the encoder may only mean they're deliberately used in place of duplicates when the video is compressed. I'm not sure, but if a frame is dropped while the video is being captured I'd assume a null frame must still be used to ensure the A/V sync is maintained, as AVIs don't support variable frame rate (as far as I know).
    Quote Quote  
  14. Member
    Join Date
    Aug 2023
    Location
    USA
    Search PM
    Ok, I believe I confirmed it was something related to FFMpeg. While using Avisource produces an audio delay in the AvsPmod preview video, if I go ahead and process the entire file and output and play in MPCHC, the audio is syced.
    Quote Quote  
  15. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    While using Avisource produces an audio delay in the AvsPmod preview video, if I go ahead and process the entire file and output and play in MPCHC, the audio is syced.
    As expected. But properly using FFMPEG2 should produce the same results. Never mind, better use AviSource for VHS captured files.
    Quote Quote  
  16. Member
    Join Date
    Aug 2023
    Location
    USA
    Search PM
    Definitely have a lot to learn lollo, just never have enough spare time with the kids. I've used FFMPeg2 on at least 70 NTSC captures without any issues till these particular tapes. There may be something different about the tapes, literally they feel heavier. They say hi-fi stereo, mono compatible.

    AviSource is at least twice as slow than FFMPeg2, but at least it seems to be working.
    Quote Quote  
  17. Originally Posted by Forenzik View Post

    AviSource is at least twice as slow than FFMPeg2, but at least it seems to be working.
    It shouldn't be for your script. QTGMC should be the bottleneck . In fact, AVISource should be slightly faster overall, because of no added indexing time

    Are you using multithreading ?



    FFMS2 is release dependent , there are some buggy versions, and some that work better. You might try another version
    Quote Quote  
  18. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    Definitely have a lot to learn lollo
    Follow suggestions from master poisondeathray, you will not be disappointed
    Quote Quote  
  19. Member
    Join Date
    Aug 2023
    Location
    USA
    Search PM
    Yep, i'm using Prefetch(10).

    All things the same except switching from FFMPEGSource2("abcd.avi", atrack=1) to AviSource("abcd.avi") my frame processing rate goes down by about half.

    I might tinker around with the FFMS2 versions. Currently using 2.40 which i believe is current.
    Quote Quote  
  20. Originally Posted by Forenzik View Post
    Yep, i'm using Prefetch(10).

    All things the same except switching from FFMPEGSource2("abcd.avi", atrack=1) to AviSource("abcd.avi") my frame processing rate goes down by about half.
    It shouldn't - what avs+ version

    I might tinker around with the FFMS2 versions. Currently using 2.40 which i believe is current.
    2.40 is about 3 years old (Aug 22,2020)

    Newest version
    https://codeberg.org/StvG/ffms2/releases
    Quote Quote  
  21. Member
    Join Date
    Aug 2023
    Location
    USA
    Search PM
    Thanks for the newer version of FFMS2. The link showing on the avisynth wiki must not be updated.

    Avisynth is 3.7.3


    [OS/Hardware info]
    Operating system: Windows 10 (x64) (Build 19045)

    CPU: AMD Ryzen 5 5600 6-Core Processor / Ryzen 5 (Vermeer)
    MMX, MMXEXT, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, SSE4A, FMA3, RDSEED, ADX, AVX, AVX2
    6 physical cores / 12 logical cores


    [Avisynth info]
    VersionString: AviSynth+ 3.7.3 (r4003, 3.7, x86_64)
    VersionNumber: 2.60
    File / Product version: 3.7.3.0 / 3.7.3.0
    Interface Version: 10
    Multi-threading support: Yes
    Avisynth.dll location: C:\WINDOWS\SYSTEM32\avisynth.dll
    Avisynth.dll time stamp: 2023-07-16, 03:48:08 (UTC)
    PluginDir2_5 (HKLM, x64): C:\Program Files (x86)\AviSynth+\plugins64
    PluginDir+ (HKLM, x64): C:\Program Files (x86)\AviSynth+\plugins64+


    [C++ 2.6 Plugins (64 Bit)]
    C:\Program Files (x86)\AviSynth+\plugins64+\ApparentFPS_x64.dll [1.8.0.0]
    C:\Program Files (x86)\AviSynth+\plugins64+\AutoAdjust.dll [2.6.0.0]
    C:\Program Files (x86)\AviSynth+\plugins64+\ConvertStacked.dll [2023-07-16]
    C:\Program Files (x86)\AviSynth+\plugins64+\DePan.dll [2.13.1.6]
    C:\Program Files (x86)\AviSynth+\plugins64+\DePanEstimate.dll [2.10.0.4]
    C:\Program Files (x86)\AviSynth+\plugins64+\Depulse_x64.dll [1.1.0.0]
    C:\Program Files (x86)\AviSynth+\plugins64+\dfttest.dll [1.9.7.0]
    C:\Program Files (x86)\AviSynth+\plugins64+\DirectShowSource.dll [2023-07-16]
    C:\Program Files (x86)\AviSynth+\plugins64+\ffms2.dll [2020-08-22]
    C:\Program Files (x86)\AviSynth+\plugins64+\fft3dfilter.dll [2.10.0.0]
    C:\Program Files (x86)\AviSynth+\plugins64+\ImageSeq.dll [2023-07-16]
    C:\Program Files (x86)\AviSynth+\plugins64+\LoadDLL64.dll [2019-03-02]
    C:\Program Files (x86)\AviSynth+\plugins64+\masktools2.dll [2.2.30.0]
    C:\Program Files (x86)\AviSynth+\plugins64+\mvtools2.dll [2.7.45.0]
    C:\Program Files (x86)\AviSynth+\plugins64+\nnedi3.dll [0.9.4.62]
    C:\Program Files (x86)\AviSynth+\plugins64+\RgTools.dll [1.2.0.0]
    C:\Program Files (x86)\AviSynth+\plugins64+\Shibatch.dll [2023-07-16]
    C:\Program Files (x86)\AviSynth+\plugins64+\TimeStretch.dll [2023-07-16]
    C:\Program Files (x86)\AviSynth+\plugins64+\VDubFilter.dll [2023-07-16]

    [Scripts (AVSI)]
    C:\Program Files (x86)\AviSynth+\plugins64+\colors_rgb.avsi [2022-10-06]
    C:\Program Files (x86)\AviSynth+\plugins64+\MCTD_.avsi [2023-08-01]
    C:\Program Files (x86)\AviSynth+\plugins64+\QTGMC.avsi [2023-07-30]
    C:\Program Files (x86)\AviSynth+\plugins64+\Stab.avsi [2023-08-11]
    C:\Program Files (x86)\AviSynth+\plugins64+\Zs_RF_Shared.avsi [2023-07-30]

    [Uncategorized DLLs (64 Bit)]
    C:\Program Files (x86)\AviSynth+\plugins64+\FFTW3.dll [2016-07-30]
    C:\Program Files (x86)\AviSynth+\plugins64+\libfftw3f-3.dll [2016-07-30]

    [Uncategorized files]
    C:\Program Files (x86)\AviSynth+\plugins64+\colors_rgb.txt [2022-10-06]
    Quote Quote  
  22. Looks ok ; older versions of avs+ required you to specify MT_Modes using SetFilterMTMode, but it should be auto for newer avs+ versions

    Not sure why the speed difference. AVISource shouldn't be 1/2 speed , especially with QTGMC (that would be the bottleneck) . On my Intel system AVISource is ~10% faster than FFMS2 with SD Lagarith, QTGMC and Prefetch (it shouldn't be either, it should be +/- 1 or 2%)
    Quote Quote  
  23. Member
    Join Date
    Aug 2023
    Location
    USA
    Search PM
    Yeah, doesnt make sense to me. AVISource is an internal filter. FFmpeg2 is an external. maybe on these particular videos, this sync issue is the root cause. I'll maybe dabble around with some of the other captures from other tapes to see if its similar.
    Quote Quote  
  24. It doesn't matter whether or not filter is external or internal ;

    Even if a "magical" source filter had 100,000 FPS, it doesn't matter, because QTGMC is the bottleneck

    To check if audio is the culprit, disable audio for some tests, check the video only speed. If speeds are similar, then the audio is the problem

    Code:
    AVISource("video.avi", audio=false)
    vs.

    Code:
    FFVideoSource("video.avi")
    Quote Quote  
  25. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    It seems odd to me people are capturing in uncompressed RGB, that's the 3rd or 4th in the last week or two
    Quote Quote  
  26. Member
    Join Date
    Aug 2023
    Location
    USA
    Search PM
    That's easy, it's because there's so many details and scenarios and the information is so scattered across multiple sites that nobody gets is all in one gulp. I appreciate all the info ive gleaned from this site but I mean, there's not even a sticky for VHS capture. Man that would have saved me a lot of time!
    Quote Quote  
  27. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    Originally Posted by davexnet View Post
    It seems odd to me people are capturing in uncompressed RGB, that's the 3rd or 4th in the last week or two
    Where have you understood that? OP is capturing YUV Lagarith, RGB is after processing

    edit: after reading OP's reply to davexnet I may be wrong
    Quote Quote  
  28. Member
    Join Date
    Aug 2023
    Location
    USA
    Search PM
    I wasn't going to point that out, but yeah, I believe i'm capturing in YUV, and it's RGB after deinterlacing.
    Quote Quote  
  29. Originally Posted by Forenzik View Post
    I wasn't going to point that out, but yeah, I believe i'm capturing in YUV, and it's RGB after deinterlacing.
    And it shouldn't be RGB after deinterlacing, unless you used a RGB filter somewhere, or there is another problem with the script (that you didn't post)

    If you didn't use an RGB filter, you probably forgot to use vdub video=>fast recompress to bypass the conversion
    Quote Quote  



Similar Threads

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