Log in

View Full Version : PAL Pitchers


jay123210599
29th October 2024, 22:00
I don't live in a PAL region, but I was wondering if there was I can create PAL pitched videos from NTSC videos. Well, is there?

For example, I want this video (https://www.youtube.com/watch?v=Ya3Q9OLk25g) to sound like this video (https://www.youtube.com/watch?v=Meu_KEQMd0U).

FranceBB
30th October 2024, 00:20
What you're referring to is the classic PAL Speedup.
Essentially, when you have a 23,976fps content and you have to go to PAL you need to perform a 4% speed up so that it reaches 25fps. When you do that, you're making the overall length of the content slightly shorter and you're also changing the sampling (from 48000Hz you get around 50000Hz).

This is the 4% PAL speed up with resampling but without pitch adjustment:

ResampleAudio(48000)
AssumeFPS(25, 1, true)
SSRC(48000)

This is with pitch adjustment

ResampleAudio(48000)
AssumeFPS(25, 1, false)
TimeStretch(tempo=100.0*25.0/(24000.0/1001.0))
SSRC(48000)

In the pitch adjustment example above AssumeFPS() is leaving the audio alone at the original length as it only speeds up the video. The audio speed up + pitch adjustment is performed by TimeStretch(), however you could also technically use AssumeFPS() to also speed up the audio without pitch correcting it and then only correct it with TimeStretch in the same filterchain so that you don't have two different functions speeding up the video and the audio independently:

ResampleAudio(48000)
ConvertAudioToFloat()
AssumeFPS(25, 1, true)
TimeStretch(pitch=96)
ResampleAudio(48000)
ConvertAudioTo24bit()


If you have performed the speed up in a different software instead of Avisynth (like in a NLE) and you only want to apply the pitch adjustment in Avisynth, then:

ResampleAudio(48000)
ConvertAudioToFloat()
TimeStretch(pitch=96)
ResampleAudio(48000)
ConvertAudioTo24bit()


I regularly perform pal speedups pretty much every day and of course I also pitch adjust with TimeStretch which leverages on the SoundTouch library.

jay123210599
30th October 2024, 03:27
All right, are these for AviSynth scripts? Where do I input my video?

FranceBB
30th October 2024, 07:56
Yes, those are Avisynth scripts.
Avisynth is a frameserver which means that you need to index a video with an indexer which creates an uncompressed A/V stream living in RAM that you can work on.
There are many indexers, but the most used general purpose one is libav:

video=LWLibavVideoSource("source.mxf")
audio=LWLibavAudioSource("source.mxf")
AudioDub(video, audio)

You can find the documentation here in the wiki http://avisynth.nl/index.php/LSMASHSource/LWLibavVideoSource

The builds are here: https://github.com/HomeOfAviSynthPlusEvolution/L-SMASH-Works/releases/

You need to put the plugins in the relative plugins64+ folder in C:/Program Files (x86)/Avisynth
As for the scripts, you can use AVSPmod mod to create them and preview them https://forum.doom9.org/showthread.php?t=175823 the builds are here https://github.com/gispos/AvsPmod/releases
Once you create the AVS Script.avs then you can use it to encode with any program that supports Avisynth as an input like x262, x264, ffmpeg, VirtualDub etc.

If you need a ready to use BAT + exe let me know and I'll upload it.

Oh, I almost forgot, make sure you get the latest stable Avisynth version from here https://github.com/AviSynth/AviSynthPlus/releases and install the latest Microsoft C++ Redistributable (I suggest the AIO package from here https://github.com/abbodi1406/vcredist/releases/

jay123210599
30th October 2024, 17:07
I tried out all the scripts you gave me and none of them got the pitch right in VirtualDub2.

Video here:
https://www.mediafire.com/file/v0wyotmihxjbsph/sample.webm/file

FranceBB
30th October 2024, 21:02
I tried out all the scripts you gave me and none of them got the pitch right in VirtualDub2.

Video here:
https://www.mediafire.com/file/v0wyotmihxjbsph/sample.webm/file

I've got the source and I know why now.
The source you have is a 25fps source which has been converted to PAL without the speed up and it lasts 30 seconds, basically as long as the original 23,976fps master. The other video you pointed to lasts 28 seconds and went through the 4% PAL speedup (in fact it's shorter) but without pitch adjustment, which is why the sound is high-pitched.

What you're trying to do here is to take the 30 seconds 25fps clip and raise (screw up) the pitch as if it went through the speed up without pitch adjustment to make it match the 28 seconds one, which is... fine, I guess. Here:

FFMpegSource2("D:\sample.webm", atrack=-1)

ConvertAudioToFloat()
TimeStretch(pitch=104)


It will still not sound exactly the same 'cause one video is faster than the other, but that will get you pretty close. ;)


Pitch modified video here: https://we.tl/t-4tPlGXOX6H
(link valid for 3 days)

kolak
21st November 2024, 14:50
It's better not to do pitch correction than do crappy/average one.
Only top algorithms are worth considering in my opinion.