[MPlayer-dev-eng] audio resampling

Anders Johansson ajh at atri.curtin.edu.au
Sun Jan 20 10:26:58 CET 2002


Hi,

> Hoi Anders,
> 
> On Tue, 15 Jan 2002 22:04:23 +0800
> Anders Johansson <ajh at atri.curtin.edu.au> wrote:
> 
> > I have solved the sync problem with fractional audio resampling. This
> > means that people with old (max 44.1kHz) or fix frequency soundcards
> > can watch movies regardless of sample frequency. I will document the
> > audio plugins now when this works. Please test the plugin if you have
> > time, it is enabled as follows:
> 
> I have such an old sound card (sb16), never had sync problems

I meant 44.1kHz to 48kHz downsampling - seems like the oss drivers
differs slightly the errors people get are inconsistent.

> > One unfortunate thing with this plugin is that the sound output level
> > is divided by 2 (this reduces the SNR which sucks). I could fix this
> > but in that case I can not fix the problem with the sample frequency
> > (since it requires filters designed off line). My guess is that getting
> > exact sample frequency is more important especially if one wants to
> > use this plugin with mencoder -- comments?
> 
> Yes, that's something that we can live with mplayer, but with
> mencoder normalized sound is necessary. What is the exact problem with
> SNR ? Sure, resampling adds noise, but is it that bad ?
> 
> 			Attila Kinali

By dividing by 2 one changes the resolution from 16 to 15 bits which
means a reduction of the theoretical SNR from 96 to 90 db. With good
enough soundcard (the ones with 24 bit DAs) and good speakers one can
hear this (the sound becomes less "clear"). I could design fix filters
that doesn't require the level to be divided by 2 but in that case I
need to use genetic algorithms to do the design. This design takes a
day or so to run so it can't be done every time one starts a new
movie. The problem with fix filters however is that if one wants exact
resampling in frequency one have to design one filter for every pair of
frequencies one wants to convert to and from (to avoid frequency
errors). Example: if a filter is designed to sample from 44.1kHz to
32kHz it will give a small frequency offset if it is used to sample
from 12kHz to 44.1kHz. 

One tradeoff I have been thinking of is to design fix filters for the
most common fin/fout pairs and one generic filter to be used with more
unusual frequencies (just print a message and live with the error).
This will work fine for listening but it would require mencoder to do
frame dropping or inserting (like +/-1 frame every 10 seconds or so),
for movies with unusual input or output frequency. Another problem
with fix filters is that they increase the size of the executable
(well I could load them from disk... but that would mean another 
binary file to be included in the dist).

//Anders



More information about the MPlayer-dev-eng mailing list