Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
22nd May 2022, 00:17 | #1 | Link |
Registered User
Join Date: Nov 2021
Posts: 2
|
Change FPS so audio and video durations match?
Hello experts,
I have an AVI file with audio out of sync due to a gradual drift during the capture. In VirtualDub there is an option under Video menu to adjust FPS so that video and audio durations match. This fixes the audio out of sync problem. IS there a way to do the same in AVISynth? Another question: What about changing the sample rate instead of FPS. That should accomplish the same result. I would need to find out what the sample rate should be in order to match the duration of the video and then just call AssumeSampleRate(clip clip, samplerate int) function with that sample rate. But again, is there a script or a function that can calculate the correct sample rate. TIA Last edited by ACSignal; 22nd May 2022 at 00:20. |
22nd May 2022, 12:22 | #2 | Link |
Anime addict
Join Date: Feb 2009
Location: Spain
Posts: 673
|
Total milisecond audio out sync = T_out [ms] @samplerate_s1 (Hz)
Total milisecond audio in sync = T_in [ms] @samplerate_s2 (Hz) s1/T_out = s2/T_in => s2 = s1·T_in/T_out Example codes conversion audio: PAL a NTSC: 48000*25/(24000/1001)= 50050 [Hz] "SlowDown 25 -> 23.976" SSRC(50050).AssumeSampleRate(48000) "SpeedUp 23.976 -> 25" AssumeSampleRate(50050).SSRC(48000) However, I prefer to modify the framerate of the audio and not subject the audio to a destructive process. I assume that virtualdub will make use of convertfps along with assumefps.
__________________
Intel i7-6700K + Noctua NH-D15 + Z170A XPower G. Titanium + Kingston HyperX Savage DDR4 2x8GB + Radeon RX580 8GB DDR5 + ADATA SX8200 Pro 1 TB + Antec EDG750 80 Plus Gold Mod + Corsair 780T Graphite |
22nd May 2022, 12:50 | #3 | Link |
Moderator
Join Date: Feb 2005
Location: Spain
Posts: 6,915
|
It is not recommended change video FPS because must be fixed standard values: ...,23.976,24,25,...
Also it is not recommended change the audio samplerate because also must be fixed standard values ...,44100,48000,... But we have a internal AviSynth function to change the audio duration to match the video duration with: VideoDuration = FrameCount/FrameRate factor = 100.0*VideoDuration/AudioDuration TimeStretch(tempo=factor) or TimeStretch(rate =factor) where ■ tempo adjusts speed while maintaining the original pitch. ■ rate adjusts playback rate that affects both tempo and pitch at the same time. the rate method is equivalent to SSRC().AssumeSampleRate showed before but SSRC don't work for any value, only for NTSC <-> PAL rate Of course that not solve always async problems with bad captures.
__________________
BeHappy, AviSynth audio transcoder. Last edited by tebasuna51; 22nd May 2022 at 13:07. |
Thread Tools | Search this Thread |
Display Modes | |
|
|