[Libav-user] Audio resampling changes slightly the speed of the music

Yurii Monakov monakov.y at gmail.com
Thu Oct 25 12:12:00 EEST 2018


Resampling can introduce additional samples in the output (because
out_samples is rounded).
You should keep track of input time and output time to calculate number of
output samples.

Yurii

ср, 24 окт. 2018 г. в 18:50, Matthieu Regnauld <mregnauld at gmail.com>:

> Hello,
>
> Thanks to FFMpeg, I manage to extract audio samples from an audio file,
> and also resample it (since my file is encoded in 44100 Hz, and my device
> expects 48000 Hz sound).
>
> The problem is: even if the sound quality is perfect, the speed is a
> little bit higher than the regular speed of the music.
>
> The difference is very small (small enough so you won't hear it), but you
> can hear it when you play the same song at the same time on a regular
> player (like VLC for example).
>
> I think it comes from the resampling, but I don't know how to fix it.
>
> Here is my code:
> https://gist.github.com/mregnauld/2538d98308ad57eb75cfcd36aab5099a
>
> How can I correct the speed of the music?
>
> Thanks for your help.
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20181025/8ac309ee/attachment.html>


More information about the Libav-user mailing list