[FFmpeg-user] Possible to change pitch of audio in a downloaded mp4 file?

Michael Koch astroelectronic at t-online.de
Wed Apr 28 12:35:47 EEST 2021


Am 28.04.2021 um 10:53 schrieb Bo Berglund:
> On Wed, 28 Apr 2021 09:03:26 +0200, Michael Koch <astroelectronic at t-online.de>
> wrote:
>
>> Am 28.04.2021 um 08:51 schrieb Bo Berglund:
>>> Sometimes when I download a video it turns out to have some issues that has
>>> raised the audio pitch of the video making it not so enjoyable to watch/hear.
>>> So I wonder if there is an ffmpeg command that can modify the pitch of the audio
>>> without changing the playback speed or lipsync?
>> Yes, this is possible with a combination of asetrate, atempo and
>> aresample filters.
>> See chapter 3.4 in my book:
>> http://www.astro-electronic.de/FFmpeg_Book.pdf
>>
> Thanks for the book! It has many useful items.
>
> But chapter 3.4 seems to deal only in modifying an audio file whereas I am
> talking about an mp4 video with both audio and video content.
> I had tested this (which I found by googling) before I posted:
>
> ffmpeg -i input20.mp4 -filter:a "atempo=1.25" -vn output20.mp4
>
> There were no errors displayed but the resulting file *ONLY* contains the audio
> part, I neeed both and the audio change must not change the length or lipsync of
> the file.

Sure, that's because -vn means "no video output". Just remove this 
option and then your output file will contain audio and video.


> I already have a script to change lipsync using ffmpeg this way (shifting audio
> 350 ms here):
>
> ffmpeg -hide_banner  -i input.mp4 -itsoffset -0.35 -i input.mp4 -map 1:v -map
> 0:a -c copy output.mp4
>
> Is this basically what one has to do, specifying the input twice?
> I am not really understanding how all the ffmpeg arguments do work...

Alternatively you could also use the adelay filter.

Michael



More information about the ffmpeg-user mailing list