[Libav-user] Conversion from mp3 to aac/mp4 container problem

Taha Ansari mtaha.ansari at gmail.com
Fri Jun 21 12:28:38 CEST 2013


On Fri, Jun 21, 2013 at 3:06 PM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:

> Taha Ansari <mtaha.ansari at ...> writes:
>
> > I have run this application with existing mp4
> > files as input, and it properly extracts audio,
> > and encodes to mp4 (audio only:AAC), or even
> > directly in AAC format (i.e. test.aac also
> > works). But when I tried running it on mp3
> > files, output clip plays faster than it should
> > be (a clip of 1:12 seconds plays back till
> > 1:05 seconds only, and is also noisy).
>
> I did not look at your code but did you consider
> that the AAC decoder outputs AV_SAMPLE_FMT_FLTP
> and the MP3 decoder signed 16 bit values (I
> believe you can request planar or not)?
>
> Carl Eugen
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>

Hi Carl!

As a matter of fact, I never knew about this, till now. In fact, when I was
probing the two files, I got s16 indication, so I thought they were
similar, maybe:

----------------------------------------------------------------------------------------------------
FFprobe from test.mp3 (input file):
----------------------------------------------------------------------------------------------------
ffprobe version N-47062-g26c531c Copyright (c) 2007-2012 the FFmpeg
developers
  built on Nov 25 2012 12:23:20 with gcc 4.7.2 (GCC)
  configuration: --disable-static --enable-shared --enable-gpl
--enable-version3
 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth
--enable-bzlib
--enable-frei0r --enable-libass --enable-libopencore-amrnb
--enable-libopencore-
amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame
--enable-libnut -
-enable-libopenjpeg --enable-libopus --enable-librtmp
--enable-libschroedinger -
-enable-libspeex --enable-libtheora --enable-libutvideo
--enable-libvo-aacenc --
enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264
--enab
le-libxavs --enable-libxvid --enable-zlib
  libavutil      52.  9.100 / 52.  9.100
  libavcodec     54. 77.100 / 54. 77.100
  libavformat    54. 37.100 / 54. 37.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 23.102 /  3. 23.102
  libswscale      2.  1.102 /  2.  1.102
  libswresample   0. 17.101 /  0. 17.101
  libpostproc    52.  2.100 / 52.  2.100
[mp3 @ 007b2a60] max_analyze_duration 5000000 reached at 5015510
Input #0, mp3, from 'test.mp3':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf54.37.100
  Duration: 00:01:12.67, start: 0.000000, bitrate: 128 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16, 128 kb/s
----------------------------------------------------------------------------------------------------

----------------------------------------------------------------------------------------------------
FFprobe from test.mp4 (converted file):
----------------------------------------------------------------------------------------------------

ffprobe version N-47062-g26c531c Copyright (c) 2007-2012 the FFmpeg
developers
  built on Nov 25 2012 12:23:20 with gcc 4.7.2 (GCC)
  configuration: --disable-static --enable-shared --enable-gpl
--enable-version3
 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth
--enable-bzlib
--enable-frei0r --enable-libass --enable-libopencore-amrnb
--enable-libopencore-
amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame
--enable-libnut -
-enable-libopenjpeg --enable-libopus --enable-librtmp
--enable-libschroedinger -
-enable-libspeex --enable-libtheora --enable-libutvideo
--enable-libvo-aacenc --
enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264
--enab
le-libxavs --enable-libxvid --enable-zlib
  libavutil      52.  9.100 / 52.  9.100
  libavcodec     54. 77.100 / 54. 77.100
  libavformat    54. 37.100 / 54. 37.100
  libavdevice    54.  3.100 / 54.  3.100
  libavfilter     3. 23.102 /  3. 23.102
  libswscale      2.  1.102 /  2.  1.102
  libswresample   0. 17.101 /  0. 17.101
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf54.37.100
  Duration: 00:01:04.62, start: 0.000000, bitrate: 129 kb/s
    Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo,
s16, 128
 kb/s
    Metadata:
      handler_name    : SoundHandler
----------------------------------------------------------------------------------------------------

Hence the reason I was supplying:

c->sample_fmt  = AV_SAMPLE_FMT_S16; (in add_audio_stream() function).

If I'm not wasting too much of your time, can you please guide how I can co
relate the two formats, pragmatically?

Thanks for your time!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20130621/1d83d79a/attachment.html>


More information about the Libav-user mailing list