VideoHelp Forum
+ Reply to Thread
Results 1 to 10 of 10
Thread
  1. Member
    Join Date
    Jun 2017
    Location
    Australia
    Search Comp PM
    Hi all, I'm attempting to get back into my VHS capture projects and am looking for some advice on how to best setup my AviSynth script to suit my needs.

    Currently I have no issues with my capture setup, the raw capture I am getting through virtual dub is flawless: no frame drops sync issues etc.

    I did a full capture of a new tape recently and tried to encode / de-interlace with StaxRip (as I have managed to do successfully in the past on an older version of StaxRip), however ran into issues with the final video being completely out of sync with the audio alongside what i believe to be errors with the implementation of Nvenc and hardware acceleration in the process.

    Regardless that was all on my old i7 3770k system which for a start already had issues with the standard DLLs in the new version of StaxRip, although i overcame those I got a sense this hardware was beginning to become unsuitable for these purposes due to age.

    I have now upgraded the system to an AMD Ryzen 9 3950x which included with my RTX 2080 Ti, is undoubtedly better suited for this task.

    My question is, would anyone be able to suggest an AviSynth script (that i can then implement in the current version of StaxRip) that will work with my hardware to do the following:

    - Trim the final video to delete early and late frames from the capture (Will use the StaxRip interface, but need to know where in the process this needs to be done)
    - De-Interlace using QTGMC Slow preset
    - Convert PCM Audio to 320kbps MP3
    - H.264 or H.265 (whichever suits the process best) Nvenc hardware accelerated encoding to achieve the best picture to file size ratio.
    - Any other related lines to ensure all 16 CPU cores are being utilized throughout the process.

    The reason for this post is I spent various hours tinkering with StaxRip settings on the old hardware and got nowhere, I'm hoping someone with a bit more experience can get me started with something that works and I can then modify as required to suit my needs.

    Any help greatly appreciated.
    Quote Quote  
  2. I don't use StaxRip but the basic AviSynth+ script would look like:

    Code:
    (whatever source filter)
    AssumeTFF() # or AssumeBFF()
    Trim(start_frame, end_frame) # remove frames before start_frame, and after end_frame
    QTGMC(preset="slow")
    Prefetch(48) # play with the number to get max throughput
    Encoding of audio and video are not done by AviSynth.
    Quote Quote  
  3. Member
    Join Date
    Jun 2017
    Location
    Australia
    Search Comp PM
    Originally Posted by jagabo View Post
    I don't use StaxRip but the basic AviSynth+ script would look like:

    Code:
    (whatever source filter)
    AssumeTFF() # or AssumeBFF()
    Trim(start_frame, end_frame) # remove frames before start_frame, and after end_frame
    QTGMC(preset="slow")
    Prefetch(48) # play with the number to get max throughput
    Encoding of audio and video are not done by AviSynth.
    Understood, now there was a few quirks i ran into when i was playing around beforehand. One thing I'd like to clear up, as my raw capture is in YUV 4:2:2, do I need to convert the colourspace before De-Interlacing?

    Also any suggestions of Nvenc encoding settings to use in StaxRip would be greatly appreciated, my workflow being 720x576i capture at 25fps. I'm hoping the issues i was running into before was more to do with Hardware / Software issues, will try and run a few tests on the new gear with these basic settings.

    EDIT - Just did a quick encode with the following settings:

    Code:
    tcFile = "*" # timestamps file path
    Exist(tcFile) ? FFVideoSource("*", timecodes=tcFile) : FFVideoSource("*", cachefile="*")
    ConvertToYUV420()
    AssumeTFF()
    Trim(10400, 14904)
    QTGMC(preset="Slow", InputType=0, sourceMatch=3, sharpness=0.2, tr2=2, ediThreads=8)
    Prefetch(48)
    The resulting video file contains the audio from the trimmed section however the footage is that from later in the source file, it doesn't appear to correlate with anything in the settings. This is the same issue i was having previously and could not work out, as I recall changing the encoder also made no difference.
    Last edited by Polsom; 22nd Mar 2022 at 08:14.
    Quote Quote  
  4. Originally Posted by Polsom View Post
    One thing I'd like to clear up, as my raw capture is in YUV 4:2:2, do I need to convert the colourspace before De-Interlacing?
    Modern QTGMC will work with YUV422 but YUV420 is more traditional (some encoders and players may not work with 422). Note that you need to specify interlaced=true if you perform the conversion before QTGMC -- ConvertToYV12(interlaced=true).

    Originally Posted by Polsom View Post
    Also any suggestions of Nvenc encoding settings to use in StaxRip would be greatly appreciated, my workflow being 720x576i capture at 25fps. I'm hoping the issues i was running into before was more to do with Hardware / Software issues, will try and run a few tests on the new gear with these basic settings.
    I don't know much about Nvenc.

    Originally Posted by Polsom View Post
    EDIT - Just did a quick encode with the following settings:

    Code:
    tcFile = "*" # timestamps file path
    Exist(tcFile) ? FFVideoSource("*", timecodes=tcFile) : FFVideoSource("*", cachefile="*")
    ConvertToYUV420()
    AssumeTFF()
    Trim(10400, 14904)
    QTGMC(preset="Slow", InputType=0, sourceMatch=3, sharpness=0.2, tr2=2, ediThreads=8)
    Prefetch(48)
    The resulting video file contains the audio from the trimmed section however the footage is that from later in the source file, it doesn't appear to correlate with anything in the settings. This is the same issue i was having previously and could not work out, as I recall changing the encoder also made no difference.
    That script doesn't deal with audio so Staxrip must be handling the audio separately. If you can disable that audio handling you can handle the audio in the script:

    Code:
    aud = FFAudioSource("filename.ext")
    vid = FFVideoSource("filename.ext")
    AudioDub(vid, aud)
    Quote Quote  
  5. Member
    Join Date
    Jun 2017
    Location
    Australia
    Search Comp PM
    Originally Posted by jagabo View Post

    That script doesn't deal with audio so Staxrip must be handling the audio separately. If you can disable that audio handling you can handle the audio in the script:

    Code:
    aud = FFAudioSource("filename.ext")
    vid = FFVideoSource("filename.ext")
    AudioDub(vid, aud)
    OK, so if I were to handle the audio in the script how would I go about converting the PCM audio to 320Kbps MP3?

    You're right that StaxRip handles audio encoding same as video as a separate process after the AviSynth script.
    Quote Quote  
  6. Originally Posted by Polsom View Post
    Originally Posted by jagabo View Post

    That script doesn't deal with audio so Staxrip must be handling the audio separately. If you can disable that audio handling you can handle the audio in the script:

    Code:
    aud = FFAudioSource("filename.ext")
    vid = FFVideoSource("filename.ext")
    AudioDub(vid, aud)
    OK, so if I were to handle the audio in the script how would I go about converting the PCM audio to 320Kbps MP3?
    If Staxrip has an option to handle the audio within the script you should just be able to se the audio codec and parameters there.
    Quote Quote  
  7. Member
    Join Date
    Jun 2017
    Location
    Australia
    Search Comp PM
    Originally Posted by jagabo View Post
    Originally Posted by Polsom View Post
    OK, so if I were to handle the audio in the script how would I go about converting the PCM audio to 320Kbps MP3?
    If Staxrip has an option to handle the audio within the script you should just be able to se the audio codec and parameters there.
    I believe due to the nature of StaxRip handling audio and video separately that it is not possible (or designed) for these to be handled within the AVS Filters section.

    I have come across some other threads relating to this issue on Doom9 and it may relate to the unstable frame rate of the source file and which video source is used to load it.

    Despite that I believe this was the path I was going down prior to switching hardware and came to no real solution. At least now I'm more certain the issue is software / script related and will have to wait until more advice becomes available or I find out how to get around this issue.

    Given I did have success with StaxRip in the past with *different* captures, it's entirely possible this tape is what is causing the issues and it's simply a matter of ironing out the script to vet all possible discrepancies with the raw capture file.
    Quote Quote  
  8. Member
    Join Date
    Jun 2017
    Location
    Australia
    Search Comp PM
    Upon further investigation it would appear that I had already done a dub of this same tape in the past, obviously my eyes aren't up to scratch as there are clear A/V Sync issues with the most recent capture. I thought this may have been causing issues with the encoder output however going back and processing the original (good) capture with StaxRip returns the same result. So not only do I have an issue with StaxRip but my Virtual Dub settings require attention also.

    With both captures the video that is encoded is not what is selected in the cutting preview window (or defined in the "Trim" command), although the audio appears to be from the selected section.

    So I've determined the final encoding problems are still related directly to StaxRip / AviSynth settings however I have no idea what's causing the issues.

    EDIT: Problem is a direct result of where cutting is placed in the script, you must have the Trim command after QTGMC Processing, for whatever reason this fixes the issue and the resulting encode is the correct section of footage with matching audio. I can now continue with what I have and modify the script as required.
    Last edited by Polsom; 24th Mar 2022 at 06:16.
    Quote Quote  
  9. Originally Posted by Polsom View Post
    EDIT: Problem is a direct result of where cutting is placed in the script, you must have the Trim command after QTGMC Processing, for whatever reason this fixes the issue and the resulting encode is the correct section of footage with matching audio. I can now continue with what I have and modify the script as required.
    Keep in mind that after QTGMC there are twice as many frames. If you determined the frame numbers by looking at the video after QTGMC you need to Trim with those numbers after QTGMC. If you determined the frame numbers without using QTGMC you should call Trim before calling QTGMC.
    Quote Quote  
  10. Member
    Join Date
    Jun 2017
    Location
    Australia
    Search Comp PM
    Originally Posted by jagabo View Post
    Originally Posted by Polsom View Post
    EDIT: Problem is a direct result of where cutting is placed in the script, you must have the Trim command after QTGMC Processing, for whatever reason this fixes the issue and the resulting encode is the correct section of footage with matching audio. I can now continue with what I have and modify the script as required.
    Keep in mind that after QTGMC there are twice as many frames. If you determined the frame numbers by looking at the video after QTGMC you need to Trim with those numbers after QTGMC. If you determined the frame numbers without using QTGMC you should call Trim before calling QTGMC.
    Well it seems odd as the preview window in StaxRip is only referencing the raw capture, the video has yet to be processed with QTGMC. So it would seem from what you're saying the frames I'm selecting at the start would be different after being processed with QTGMC yet what is actually happening is the opposite.
    Quote Quote  



Similar Threads

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