VideoHelp Forum

Our website is made possible by displaying online advertisements to our visitors.
Please consider supporting us by disabling your ad blocker or buy a VSO converter software :)
+ Reply to Thread
Results 1 to 3 of 3
Thread
  1. I created this script as a way to more easily change the audio duration by non standard amounts (other than PAL speedup or slowdown etc), and thought I'd share in case someone else finds it useful. If you do use it, please report any bugs you might find (there shouldn't be any, but you never know).
    It has no effect on the video. To change the video frame rate in combination with AudioSpeed() use AssumeFPS() or ConvertFPS() etc.

    AudioSpeed 2017-09-14.zip
    (20kB. The TimeStretch plugin is included)

    AudioSpeed(clip c, val "Num1", val "Num2", int "Delay", int "Output", bool "PitchCorrect", bool "Norm", bool "Info")

    Num1 and Num2 can be entered as numerator and denominator, but I didn't label them that way as only Num1 is required. In order to ensure fractions are applied correctly, Num1 (and Num2 if specified) must be entered as float (if not it'll result in an error). Examples for applying NTSC to PAL speedup:

    AudioSpeed(25.0, 23.976) # Specifying Num1 and Num2
    or
    AudioSpeed(25.0, 24.0/1.001) # Specifying Num1 and Num2
    or
    AudioSpeed(25.0/24.0*1.001) # Specifying Num1 only
    or
    AudioSpeed(1.042708334) # Specifying Num1 only

    Of course you can specify any ratio. For example, if you have audio that runs for 29 minutes and you want to change the duration to 30 minutes, you could express the two durations in seconds. ie
    AudioSpeed(1740.0, 1800.0)
    or as a percentage
    AudioSpeed(0.96666667)

    The script attempts to resample the audio with SSRC and if that fails (SSRC can't resample to/from arbitrary rates) it uses Avisynth's ResampleAudio() function, unless PitchCorrect=True, in which case it uses the TimeStretch plugin, which is therefore required.

    Delay: Specify a positive or negative delay in ms (before the duration is changed).
    Output: Specify 32, 24 or 16 for the output bitdepth. 32 is float and 24 and 16 are integer. The default is 32.
    PitchCorrect: Normally when PAL/NTSC speedup/slowdown is applied the pitch isn't corrected, so generally you'd not want to correct the pitch for PAL/NTSC conversions as it's one time two wrongs do make a right, but PitchCorrect=true will keep the original pitch.
    Norm: Applies peak normalisation. It's disabled by default as the entire audio must be decoded (making it slow to open). Norm=true enables it.
    Info: Info=true displays the information required to "visually" see what changes are being applied and the effect they have. It's overlaid on the video if the source contains video, and if the source is "audio only", a blank clip is created.

    Info=true looks something like this (the video frame rate and duration are displayed as a reference, but AudioSpeed has no effect on video):

    AudioSpeed(25.0, 23.976, Delay=-113, Info=true)

    Last edited by hello_hello; 13th Sep 2017 at 13:29.
    Quote Quote  
  2. I've updated the link in the opening post with a new version (2017-09-14). The only change is if the source contains no video, instead of creating a blank 10 second clip when Info=true is specified, the blank clip created will have the same duration as the audio (give or take a few ms).
    Quote Quote  
  3. While I'm here, this is another little script that might come in handy for someone. All it does is display the audio levels over the top of the video. It's exactly the same as using Histogram("audiolevels") in a script that contains video, but if the source is "audio only" it'll create a blank clip to display the output meters.
    There's no options.

    AudioMeter() overlays the meters on the video (or creates a blank clip)
    AudioMeterR() displays the output meters to the right of the video
    AudioMeterT() displays the output meters above the video

    The latter two simply reduce the width or height of the video by half to display the meters at the right or top without changing the over-all resolution.

    AudioMeter 2017-09-14.avsi

    Quote Quote  



Similar Threads