[vlc-devel] commit: When specifying --sout-transcode-samplerate and --sout-transcode-channel, set the OUTPUT format instead of the INPUT ( Rafaël Carré )

git version control git at videolan.org
Tue Apr 8 16:02:07 CEST 2008


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Tue Apr  8 16:00:22 2008 +0200| [79bd720139a011cd603efed8b6f7be297e6d55ce]

When specifying --sout-transcode-samplerate and --sout-transcode-channel, set the OUTPUT format instead of the INPUT

Fix resampling when using mp4a (faac is the only option atm)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=79bd720139a011cd603efed8b6f7be297e6d55ce
---

 modules/codec/ffmpeg/encoder.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/modules/codec/ffmpeg/encoder.c b/modules/codec/ffmpeg/encoder.c
index 49960e6..8b9ffed 100644
--- a/modules/codec/ffmpeg/encoder.c
+++ b/modules/codec/ffmpeg/encoder.c
@@ -565,15 +565,20 @@ int E_(OpenEncoder)( vlc_object_t *p_this )
             p_enc->fmt_in.audio.i_channels = 2;
 
         p_enc->fmt_in.i_codec  = AOUT_FMT_S16_NE;
-        p_context->sample_rate = p_enc->fmt_in.audio.i_rate;
-        p_context->channels    = p_enc->fmt_in.audio.i_channels;
+        p_context->sample_rate = p_enc->fmt_out.audio.i_rate;
+        p_context->channels    = p_enc->fmt_out.audio.i_channels;
 
+        if ( p_enc->fmt_out.i_codec == VLC_FOURCC('m','p','4','a') )
+        {
+            /* XXX: FAAC does resample only when setting the INPUT samplerate
+             * to the desired value (-R option of the faac frontend) */
+            p_enc->fmt_in.audio.i_rate = p_context->sample_rate;
 #if LIBAVCODEC_VERSION_INT >= ((51<<16)+(40<<8)+4)
         /* Ignore FF_PROFILE_UNKNOWN */
-        if( ( p_sys->i_aac_profile >= FF_PROFILE_AAC_MAIN ) && 
-            ( p_enc->fmt_out.i_codec == VLC_FOURCC('m','p','4','a') ) )
+        if( p_sys->i_aac_profile >= FF_PROFILE_AAC_MAIN )
             p_context->profile = p_sys->i_aac_profile;
 #endif
+        }
     }
 
     /* Misc parameters */




More information about the vlc-devel mailing list