[Libav-user] mp2/mp3 missing header at decoding of mpegts file, but only in OS X

Kalileo kalileo at universalx.net
Wed Mar 7 06:08:29 CET 2012


This is driving me nuts:
I'm decoding mpegts files, with h264 and either mp2, mp3, or aac audio. The mpegts files are cut out from mpegts streams from several different sources, and saved as file.

The decoding containsothing unusual, the standard procedure as in any example.

Works fine on windows (with any of these files), however on OS X Lion audio is broken (with every of these files). Depending on the audio codec used decoding succeeds for 50-90% of the audio frames, but for the other 10-50%:

 [mp3 @ 0x10a001400] Header missing
or 
 [mp2 @ 0x105816200] Header missing
or
 [aac @ 0x105368800] channel element 0.0 is not allocated

As said, no such messages on windows (exactly the same code) for exactly the same files, on windows it plays fine.

Examination in a hex editor shows that the mp2/mp3 or aac (adts) frame headers are there in the source file. 

ffplay plays the files on os x without any error.

I see this for the last 3 or 4 months already, and have downloaded and compiled the latest ffmpeg snapshot several times, replaced all deprecated functions (such as   avcodec_decode_audio3() =>  avcodec_decode_audio4() ), no change.


# ffmpeg -i testfile.ts
ffmpeg version 0.9.1.git-2af8f2c Copyright (c) 2000-2012 the FFmpeg developers
  built on Mar  5 2012 07:48:29 with clang 2.1 (tags/Apple/clang-163.7.1)
  configuration: --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libx264 --enable-hardcoded-tables --enable-shared --enable-pthreads --disable-indevs --cc=clang
  libavutil      51. 41.100 / 51. 41.100
  libavcodec     54.  8.100 / 54.  8.100
  libavformat    54.  2.100 / 54.  2.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 63.100 /  2. 63.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  7.100 /  0.  7.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, mpegts, from '2-13310954950020090.asf':
  Duration: 00:00:04.64, start: 1418.970000, bitrate: 1311 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, s16, 68 kb/s
    Stream #0:1[0x101]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 720x576 [SAR 64:45 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
At least one output file must be specified

The only difference between the windows and the OS X versions is that the windows versions of ffmpeg are the pre-compiled versions, while on OS X I have compiled ffmpeg myself.

I went through the code hundreds of times, and i cannot see any reason for this error on OS X. Any idea or hint how to fix this is very much appreciated!



More information about the Libav-user mailing list