[FFmpeg-devel] Simplify use of audio_resample

Michael Niedermayer michaelni at gmx.at
Tue Oct 25 15:01:57 CEST 2011

On Tue, Oct 25, 2011 at 10:38:13AM +0200, Clément Bœsch wrote:
> On Tue, Oct 18, 2011 at 12:42:13PM +0200, Michael Niedermayer wrote:
> > On Tue, Oct 18, 2011 at 10:17:57AM +0200, Clément Bœsch wrote:
> > > Hi,
> > > 
> > > I'm not sure to understand the motive of having some audio_resample heuristics
> > > in transcode_init() and more in do_audio_out() (with some duplicates); if there
> > > is no particular reason for this, the first patch is meant to regroup the
> > > audio_resample R/W into do_audio_out() only.
> > > 
> > > Then the flag is just removed from OutputStream in the second patch since it
> > > does not seem needed anymore.
> > > 
> > > I guess more simplifications could be done, but before I eventually try that I'd
> > > like to know if I'm not missing any particular special cases since that part of
> > > the code isn't quite obvious.
> > > 
> > > fate seems ok, but I'm not sure there are some tests for this.
> > 
> > please test with some file that changes its audio parameters mid stream
> > it should work to just concatenate 2 mp3 or mpeg-ps with diffenrent
> > parameters
> Given two mp3 with 1 minute length, one at 44100Hz and the other at
> 8000Hz, the outputs of the following command differ:
>   ffmpeg -i 'concat:sample-1min-44100Hz.mp3|sample-1min-8000Hz.mp3' -y out.wav
> With ffmpeg/master, the resample is not done for the second part (so the
> second audio part sounds insane), even with -ar 44100. Does it make any
> sense to do so, even for lossless purpose? Also note, the duration of the
> output is 1min10.

theres a bug in the code, it works when the -ar value differs from the input
thus with 44100+8000 -ar 48000 would for example work.

> After the patches, the resampling flag being set when the frequency
> change, the output is 2min long, with the second part in good shape.
> So what is the intended behaviour?

The ideal behavior is that specifiying the -ar flag resamples and not
specifying leaves the sample rates intact when the output supports it
and resamples as well when the output does not support it
This is not implemented and what is implemented does not seem to fully
Thus if you prefer we could drop that half working stuff, its simply
a question, if we have a volunteer to fully implement this and if we
actually have users that would want it.

[... ]

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is what and why we do it that matters, not just one of them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20111025/40445f55/attachment.asc>

More information about the ffmpeg-devel mailing list