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

Kalileo kalileo at universalx.net
Thu Mar 8 05:31:16 CET 2012


On Mar 8, 2012, at 02:50 , Carl Eugen Hoyos wrote:

> Kalileo <kalileo at ...> writes:
> 
>> I tested it now with 
>> 
>> ./configure --cc=clang 
>> and with
>> ./configure --cc=clang --disable-optimizations --disable-asm 
>> --disable-yasm --enable-shared
> 
> Please also test ./configure --cc=clang && make

I tried that, but then I cannot link the application, the linker reports errors referencing _kCVPixelBufferIOSurfacePropertiesKey and a lot of other stuff with is in libavcodec/vda.c. These linker errors do not occur when I add "--enable-shared".

Thus, instead of 
 ./configure --cc=clang && make
I had to use 
 ./configure --cc=clang --enable-shared && make

recompiling and linking the application using the so created ffmpeg libraries shows the same errors when decoding aac or mp2/mp3 on OS X Lion. 

> and please 
> provide complete, uncut console output for the failing case.

there are only the error messages form aac (if the file has aac audio) or mp2/mp3 (if the file has mp2/mp3 audio.
> 
> If the problem is not reproducible with ffmpeg (the application) 
> it would be nice if you would mention that.

in order to reproduce the problem with ffmpeg I tried playing the files with ffplay, which works perfectly, also on OS X Lion.

In order to run the files though ffmpeg I had ffmpeg converting the files, which works, and the resulting files play fine in ffplay.

Example with -v debug shows no errors. Here is the complete and uncut console output of one such conversions:

$ /usr/local/bin/ffmpeg -v debug -f mpegts  -i test-0.ts -vcodec copy -acodec aac -strict experimental test-0.mp4
ffmpeg version 0.9.1.git-1eabd71 Copyright (c) 2000-2012 the FFmpeg developers
  built on Mar  8 2012 01:05:54 with clang 2.1 (tags/Apple/clang-163.7.1)
  configuration: --cc=clang --disable-optimizations --disable-asm --disable-yasm --enable-shared
  libavutil      51. 42.100 / 51. 42.100
  libavcodec     54. 10.100 / 54. 10.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
[mpegts @ 0x7fd9c403d800] stream=0 stream_type=1b pid=100 prog_reg_desc=
[mpegts @ 0x7fd9c403d800] stream=1 stream_type=3 pid=101 prog_reg_desc=
[mpegts @ 0x7fd9c403d800] max_analyze_duration 5000000 reached at 5000000
Input #0, mpegts, from 'test-0.ts':
  Duration: 00:02:15.96, start: 9479.567267, bitrate: 1136 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100], 127, 1/90000: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 1/50, 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x101], 209, 1/90000: Audio: mp2 ([3][0][0][0] / 0x0003), 48000 Hz, 2 channels, s16, 128 kb/s
Incompatible sample format 's16' for codec 'aac', auto-selecting format 'flt'
Output #0, mp4, to 'test-0.mp4':
  Metadata:
    encoder         : Lavf54.2.100
    Stream #0:0, 0, 1/90000: Video: h264 (![0][0][0] / 0x0021), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 1/90000, q=2-31, 25 fps, 90k tbn, 90k tbc
    Stream #0:1, 0, 1/48000: Audio: aac (@[0][0][0] / 0x0040), 48000 Hz, 2 channels, flt, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (mp2 -> aac)
Press [q] to stop, [?] for help
frame= 3400 fps=431 q=-1.0 Lsize=   17030kB time=00:02:15.96 bitrate=1026.1kbits/s    
video:14938kB audio:2016kB global headers:0kB muxing overhead 0.449123%

=======

After all this testing I think that the problem might be in the way I allocate the buffer for the audio decoding. I remember that that was always a big hassle with the memory alignment, but now with avcodec_decode_audio4() that is all done in avcodec_alloc_frame(). Here are some code snippets (as said, works perfectly under windows).

… the frame pointer:

 AVFrame *decoded_frame = NULL;

… and then in a loop:

	if (!decoded_frame) {
		if (!(decoded_frame = avcodec_alloc_frame())) 
			return -1;
	} else {
		avcodec_get_frame_defaults(decoded_frame);  // reuse the already allocated frame
	}
	len1 = avcodec_decode_audio4(pAudioCodecCtx, decoded_frame, &got_frame, &pkt1);

	… process decoded frame

 	if (decoded_frame)
		av_free(decoded_frame);
… end of loop

Could there be something special to do under OS X Lion, or might avcodec_alloc_frame() behave differently due to the fact that wee have to use a different compiler with Lion (--cc=clang)?




More information about the Libav-user mailing list