HydrogenAudio

Hydrogenaudio Forum => General Audio => Topic started by: FedeFrede on 2010-03-01 22:37:16

Title: Resample quality of FFMPEG?
Post by: FedeFrede on 2010-03-01 22:37:16
I ran across: http://src.infinitewave.ca/ (http://src.infinitewave.ca/) and realized the difference in quality looking across various SRC.
I use FFMPEG to downsample audio usually from 48Kz to 44.1Khz. Does anyone know how well FFMPEG downsamples in relation to aliasing?

Regards,

Frederik
Title: Resample quality of FFMPEG?
Post by: FedeFrede on 2010-03-02 10:30:42
I made my own little investigation and found that FFMPEG kills alot of the higher frequencies due to a lowpass filter not being steep enough.
FFMPEG does however seem to have a sufficient attenuation before Nyquist and therefore don't seem to introduce aliasing.
SSRC on the other hand is much better and preserve the high frequencies due to the extreme steep low pass filter, so that will be my choice from now on

I used a sweep signal taken from http://src.infinitewave.ca/ (http://src.infinitewave.ca/) and did a resample from 96KHz to 44.1 KHz, the result can be seen here:
http://img442.imageshack.us/i/sweep.png/ (http://img442.imageshack.us/i/sweep.png/)
The first waveform is the original, the second is FFMPEG and the third is SSRC shown in Audacity.

here are the respective spectrum plots:
Original: http://img692.imageshack.us/i/originalh.png/ (http://img692.imageshack.us/i/originalh.png/)
FFMPEG: http://img202.imageshack.us/i/ffmpeg.png/ (http://img202.imageshack.us/i/ffmpeg.png/)
SSRC: http://img4.imageshack.us/i/ssrc.png/ (http://img4.imageshack.us/i/ssrc.png/)

/Frederik
Title: Resample quality of FFMPEG?
Post by: Arnold B. Krueger on 2010-03-02 19:54:48
I made my own little investigation and found that FFMPEG kills alot of the higher frequencies due to a lowpass filter not being steep enough.
FFMPEG does however seem to have a sufficient attenuation before Nyquist and therefore don't seem to introduce aliasing.
SSRC on the other hand is much better and preserve the high frequencies due to the extreme steep low pass filter, so that will be my choice from now on

I used a sweep signal taken from http://src.infinitewave.ca/ (http://src.infinitewave.ca/) and did a resample from 96KHz to 44.1 KHz, the result can be seen here:
http://img442.imageshack.us/i/sweep.png/ (http://img442.imageshack.us/i/sweep.png/)
The first waveform is the original, the second is FFMPEG and the third is SSRC shown in Audacity.

here are the respective spectrum plots:
Original: http://img692.imageshack.us/i/originalh.png/ (http://img692.imageshack.us/i/originalh.png/)
FFMPEG: http://img202.imageshack.us/i/ffmpeg.png/ (http://img202.imageshack.us/i/ffmpeg.png/)
SSRC: http://img4.imageshack.us/i/ssrc.png/ (http://img4.imageshack.us/i/ssrc.png/)

/Frederik


Your ssrc plot does not make sense to me. The ffmpeg shows the relatively gentle slope you mentioned,
Title: Resample quality of FFMPEG?
Post by: FedeFrede on 2010-03-02 22:04:54
Quote
Your ssrc plot does not make sense to me. The ffmpeg shows the relatively gentle slope you mentioned,

Compare FMPEG with the two others and look at the axis. It shows that FFMPEG is not a good choice when it comes to resampling and
it's indeed audible.
Title: Resample quality of FFMPEG?
Post by: FedeFrede on 2012-08-06 21:43:21
For further reading, read my blogpost on the topic:
http://transcoding.wordpress.com/2011/11/1...g-using-ffmpeg/ (http://transcoding.wordpress.com/2011/11/16/careful-with-audio-resampling-using-ffmpeg/)
Title: Resample quality of FFMPEG?
Post by: bandpass on 2012-08-07 08:59:29
Perhaps you could submit the ffmpeg results to infinite-wave (according to their instructions on the web-page) and let them run their analysis; this way, we can be sure we're comparing like with like.

AFAIK, SSRC is not maintained and may be buggy: see the first upsampling graph at http://www.hydrogenaudio.org/forums/index....st&p=803756 (http://www.hydrogenaudio.org/forums/index.php?s=&showtopic=96151&view=findpost&p=803756)

Remember that the audio band is 20Hz to 20kHz; 44/48kHz audio is slightly oversampled to allow for transition-band roll-off. And there's little point in preserving audio above 20k in files when your DAC is going to throw it away during playback anyway.  Furthermore, steep filters are likely to produce undesirable effects such as more clipping and ringing. So the ideal response (leaving aside the question of aliasing) should probably look something like (the green line):
(http://src.infinitewave.ca/images/Transition/Sonar85.png)
Title: Resample quality of FFMPEG?
Post by: FedeFrede on 2012-08-07 09:54:17
Michael Niedermayer made a comment last night on my blogpost stating that you can tweak the filter because of the audio filter options which weren't present when I wrote the original post 2,5 years ago:
http://transcoding.wordpress.com/2011/11/1...g-using-ffmpeg/ (http://transcoding.wordpress.com/2011/11/16/careful-with-audio-resampling-using-ffmpeg/)
Title: Resample quality of FFMPEG?
Post by: smok3 on 2012-08-07 09:58:56
any wild guesses why this ffmpeg default is done the way it is?