Adisak
Adisak

Reputation: 6926

Use ffmpeg to time-dilate and resample audio without changing frequencies

I have some audio (wave file) that is sampled at a rate of 48000 samples per second.

This audio was created to match a 30 FPS video. However, the video actually plays back on the target at the NTSC framerate of 29.97 (30 X 1000/1001).

This means that I need to time-dilate the audio so that there are 48048 samples where there were previously 48000 samples (it plays back 1.001 times slower) but still maintains that the final audio file's rate is 48000 samples per second.

Ideally, also, I'd like to do this resample using the sox library option for FFMPEG since I hear it has much higher quality.

Can anyone help me with the command line necessary to process a file in this manner?

Upvotes: 1

Views: 2682

Answers (1)

Gyan
Gyan

Reputation: 93261

Basic command is

ffmpeg -i in.wav -af asetrate=47952,aresample=48000:resampler=soxr out.wav

This assumes that libsoxr is linked.

Upvotes: 2

Related Questions