[vlc-devel] FIXED!!! Re: mp3 transcoding creates slow audio

Rov Juvano rovjuvano at users.sourceforge.net
Wed Jul 9 12:20:15 CEST 2008

On Tue, Jul 08, 2008 at 11:36:47PM +0300, Rémi Denis-Courmont wrote:
> Le mardi 8 juillet 2008 21:28:03 Dave Still, vous avez écrit :
> > > With the following patch, transcode keeps the pitch when
> > > resampling to an mp3.  I had to specify acodec=mpga to find
> > > an encoder.
> >
> > This fixed it!  Thank you!  I had to modify your patch slightly to
> > include mp3, but now mp3 transcoding pitch is working!  For some
> > reason I couldn't get this to work back in April when funman suggested
> > the same fix, so thank you!  I've attached the updated patch that
> > works with acodec=mp3.
> And that's what looks very wrong with this patch, to me as a transcode 
> non-expert. In the past, codec-specific transcoding hacks have already proven 
> harmful.

Yep, and that's just what caused it in the first.

Upon further investigation, the commit I had identified broke
what was already broken.

    commit ddac67aaf2bde4179f695bb26033488e8e7c35cc
    Date:   Wed Jan 2 09:50:41 2008 +0000
    Special case for fourcc samr and sawb in transcode_audio_new()

Before this commit, transcode would resample the audio to the
sample rate given on the command line.  After this commit,
transcode ignores the sample rate given on the command line.

The following patch reverts what's left of this commit.

I've tested this with mpga, a52, and vorbis.

-------------- next part --------------
diff --git a/modules/stream_out/transcode.c b/modules/stream_out/transcode.c
index 2662e6c..a1deba6 100644
--- a/modules/stream_out/transcode.c
+++ b/modules/stream_out/transcode.c
@@ -1146,7 +1146,7 @@ static int transcode_audio_new( sout_stream_t *p_stream,
                     id->p_decoder->fmt_out.i_codec );
     id->p_encoder->fmt_in.audio.i_format = id->p_decoder->fmt_out.i_codec;
-    id->p_encoder->fmt_in.audio.i_rate = fmt_last.audio.i_rate;//id->p_encoder->fmt_out.audio.i_rate;
+    id->p_encoder->fmt_in.audio.i_rate = id->p_encoder->fmt_out.audio.i_rate;
     id->p_encoder->fmt_in.audio.i_physical_channels =
     id->p_encoder->fmt_in.audio.i_original_channels =

More information about the vlc-devel mailing list