<p>I have a lossy AAC audio file. I would like it to be slightly faster, and slightly higher pitched. I would like to avoid loosing any audio quality, such as by re-encoding the stream.</p>
<p>I am well aware that if I wanted to increase the speed without increasing the pitch, I would be SOL for avoiding a re-encode. Same for increasing the pitch without increasing the speed, because these effects require relatively complicated filters.</p>
<p>However, I want to do something a lot simpler—increase the speed <em>and</em> the pitch at the same time, by the same amount. The same as what would happen if you played a vinyl record or cassette tape too quickly.</p>
<p>My recording currently has a sample rate of 44100hz. If I could change it to 48000hz without re-encoding, I would get a ~9% speed bump, which would be perfect! However, I can't seem to find a way to do this! Ffmpeg's <code>asetrate</code> filter, for example, requires a stream copy!</p>
<p>Surely there should be a way to do this? It <em>seems</em> technically simple...</p>

CC BY-SA 4.0
2023-03-07T14:12:26.700Z
Does changing the audio and video frame rates in the metadata have any effect?  (If not, where *is* the controlling information stored?
Ray Butterworth
CC BY-SA 4.0
2023-03-10T00:33:55.007Z
@RayButterworth I don't know how to do that! GUI apps don't let you edit that field, and I don't see a way to do it with e.g. ffmpeg.
Wowfunhappy
CC BY-SA 4.0
2023-09-16T22:22:58.420Z
I think whether this is possible depends on the actual lossy codec being used. Skimming hydrogenaudio, I found threads https://hydrogenaud.io/index.php/topic,115369.0.html, https://hydrogenaud.io/index.php/topic,33993.0.html, and https://hydrogenaud.io/index.php/topic,102416.0.html.
1110101001
CC BY-SA 4.0
2023-09-16T22:23:01.107Z
They seem to imply that it might be possible by changing header data, so long as the actual lossy encoding doesn't rely on the specific sampling rate for its decoding "You might run into troubles if you change the sampling rate. AAC makes use of a sampling rate specific partition of the spectrum into scalefactor bands. Changing the sampling rate could render the AAC stream useless (I'm not 100% sure)."
1110101001
CC BY-SA 4.0
2023-09-16T22:23:43.550Z
I suppose you could just try it and see. I don't know of any off-the-shelf way to edit this data, you could probably pull up the aac format spec and use a hex editor, or modify ffmpeg to get it to write out the value you want. Also note that some container formats (like mkv) support overriding the sample rate at decode time.
1110101001
<ffmpeg><audio><sampling-frequency>
How can I change the sample rate of an audio file, without re-encoding?
Wowfunhappy
# How can I change the sample rate of an audio file, without re-encoding?

(Asked by: username_0 on 2022-04-20)

I have a lossy AAC audio file. I would like it to be slightly faster, and slightly higher pitched. I would like to avoid loosing any audio quality, such as by re-encoding the stream.

I am well aware that if I wanted to increase the speed without increasing the pitch, I would be SOL for avoiding a re-encode. Same for increasing the pitch without increasing the speed, because these effects require relatively complicated filters.

However, I want to do something a lot simpler—increase the speed *and* the pitch at the same time, by the same amount. The same as what would happen if you played a vinyl record or cassette tape too quickly.

My recording currently has a sample rate of 44100hz. If I could change it to 48000hz without re-encoding, I would get a ~9% speed bump, which would be perfect! However, I can't seem to find a way to do this! Ffmpeg's `asetrate` filter, for example, requires a stream copy!

Surely there should be a way to do this? It *seems* technically simple...

**Tags:** ffmpeg, audio, sampling-frequency

> **Comments:**
> **username_1**: Does changing the audio and video frame rates in the metadata have any effect?  (If not, where *is* the controlling information stored?  
> **username_0**: @RayButterworth I don't know how to do that! GUI apps don't let you edit that field, and I don't see a way to do it with e.g. ffmpeg.  
> **username_2**: I think whether this is possible depends on the actual lossy codec being used. Skimming hydrogenaudio, I found threads https://hydrogenaud.io/index.php/topic,115369.0.html, https://hydrogenaud.io/index.php/topic,33993.0.html, and https://hydrogenaud.io/index.php/topic,102416.0.html.  
> **username_2**: They seem to imply that it might be possible by changing header data, so long as the actual lossy encoding doesn't rely on the specific sampling rate for its decoding "You might run into troubles if you change the sampling rate. AAC makes use of a sampling rate specific partition of the spectrum into scalefactor bands. Changing the sampling rate could render the AAC stream useless (I'm not 100% sure)."  
> **username_2**: I suppose you could just try it and see. I don't know of any off-the-shelf way to edit this data, you could probably pull up the aac format spec and use a hex editor, or modify ffmpeg to get it to write out the value you want. Also note that some container formats (like mkv) support overriding the sample rate at decode time.  

---

## 0 answers

