View Single Post
Old 19th December 2018, 18:41   #2  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
I guess you could just (after Deinterlace)
Code:
Last=Deint.AssumeFPS(24000,1001,Sync_Audio=true) # play clip a bit slower, whilst keeping audio sync
Last=ReSampleAudio(Deint.AudioRate) # original sample rate
Return Last
But above will result in change in audio pitch, might wanna look up TimeStretch here on forum.
On Wiki:- http://avisynth.nl/index.php/TimeStretch

EDIT: Maybe see here:- https://forum.doom9.org/showthread.p...35#post1810135

Demo using Colorbars
Code:
Function TimeStretchTempo(clip InC,Float OutNum,Float "OutDen") { 
    # http://forum.doom9.org/showthread.ph...35#post1810135
    # Returns Timestretch() Tempo arg, to change playback tempo when changing VideoFramerate, without changing pitch: 
    Num    = InC.FrameRateNumerator      
    Den    = InC.FrameRateDenominator
    OutDen = Default(OutDen,1.0).Float
    Assert(0.0<OutNum,String(OutNum,"TempoAsPercent: 0.0 < OutNum(%f)"))
    Assert(0.0<OutDen,String(OutDen,"TempoAsPercent: 0.0 < OutDen(%f)"))
    Return 100.0 * OutNum * Den / (OutDen * Num)               # All are Coerced to Float (v2.58 Incl)    
}


InC=ColorBars
IFPS=25.0
InC=InC.AssumeFPS(IFPS)                                        # Input simulated FPS : Audio No Change
InC=InC.Trim(0,-(25*60)) # EDIT: Added, make 25 FPS 60 second clip (25*60 frames)

ONUM=24000 # More Accurate than 23.976
ODEN=1001  # Ditto

Tempo=InC.TimeStretchTempo(ONUM,ODEN)                          # Calc Required Tempo keeping same pitch as InC

OutAudio=InC.TimeStretch(tempo=Tempo).ResampleAudio(InC.AudioRate)   # Stretch and back to Original SampleRate
                                                               # SSRC() can fail with some ratios, 
                                                               # ResampleAudio() almost no different to SSRC() for some years.
                                                               
OutC=InC.AssumeFPS(ONUM,ODEN,Sync_Audio=False)                 # Output Video rate leaving Audio as was

Last=OutC.AudioDub(Outaudio)                                   # Result Explicit assign to Last (no reason)

#RT_Subtitle("InFPS=%f : OutFPS=%f : Tempo=%f%%",InC.FrameRate,FrameRate,Tempo)
Subtitle(String(InC.FrameRate,"InFPS=%.3f") + String(FrameRate," : OutFPS=%.3f") + String(Tempo," : Tempo=%f%%"))
EDIT: Removed RT_Subtitle requirement.

EDIT: NOTE, both clip and audio will change length (due to lower FPS) showing ~62.56 seconds.

EDIT: An alternative is to miss out a frame every second or so, but that would produce a jerk every second,
or interpolate to lower framerate which will likely look somewhat worse than original.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 19th December 2018 at 20:51.
StainlessS is offline   Reply With Quote