Re: [Libav-user] mp2/mp3 missing header at decoding of mpegts file, but only in OS X
On Mar 7, 2012, at 14:15 , Carl Eugen Hoyos wrote: Kalileo kalileo@... writes: Works fine on windows (with any of these files), however on OS X Lion audio is broken (with every of these files). (Complete, uncut console output when failing missing.) Please try with ./configure --cc=clang (removing the other options), and please try with things like --disable-optimizations or --disable-asm / yasm. Carl Eugen Thank you Carl-Eugen, that helped a lot already. I downloaded new snapshots of ffmpeg, libx264 and lame, and, as you proposed, I compiled ffmpeg with $ CLFAGS=-DHAVE_LRINTF ./configure --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 --disable-optimizations --disable-asm --disable-yasm There are still errors with aac, such as: [aac @ 0x10e804200] Number of bands (41) exceeds limit (36). [aac @ 0x10e804200] Error decoding AAC frame header. [aac @ 0x10e804200] channel element 2.8 is not allocated and [aac @ 0x10e804200] invalid band type [aac @ 0x10e804200] channel element 2.8 is not allocated [aac @ 0x10e804200] channel element 2.8 is not allocated [aac @ 0x10e804200] Number of bands (37) exceeds limit (36). [aac @ 0x10e804200] channel element 0.0 is not allocated but just about 10% of the error volume before. With mp3/mp2 unfortunately no change, same amount of errors. To avoid any misunderstandings, this is happening when using the standard libavformat/libavcodec functions in custom code on OS X Lion. The same code works without any error on windows. Also the same source files play without any error using ffplay, also on OS X. IIRC I have not seen these errors before the upgrade from OS X Snow Leopard to Lion. Could this be something Lion specific? Here is what ffmpeg -i says about a source file: $ /usr/local/bin/ffmpeg -i test-1.ts ffmpeg version 0.9.1.git-1eabd71 Copyright (c) 2000-2012 the FFmpeg developers built on Mar 7 2012 21:50:55 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 --disable-optimizations --disable-asm --disable-yasm libavutil 51. 42.100 / 51. 42.100 libavcodec 54. 10.100 / 54. 10.100 libavformat54. 2.100 / 54. 2.100 libavdevice53. 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 libpostproc52. 0.100 / 52. 0.100 [mpegts @ 0x7fbafa83d800] max_analyze_duration 500 reached at 500 Input #0, mpegts, from 'test-1.ts': Duration: 00:19:27.00, start: 37862.57, bitrate: 212 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, 64 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 ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] mp2/mp3 missing header at decoding of mpegts file, but only in OS X
On Mar 7, 2012, at 23:25 , Carl Eugen Hoyos wrote: Kalileo kalileo@... writes: I downloaded new snapshots of ffmpeg, libx264 and lame Please first test ./configure --cc=clang make. I tested it now with ./configure --cc=clang --enable-shared and with ./configure --cc=clang --disable-optimizations --disable-asm --disable-yasm --enable-shared Same result as before, no difference noticeable between the 2 variants, - with mp2 still a lot of errors, audio is garbled, and - with aac not so many errors, audio is ok most of the time, just a few errors every other second. I had to include --enable-shared because otherwise the application would not link, reference errors to _kCVPixelBufferIOSurfacePropertiesKey and other stuff from libavcodec/vda.c. And please add complete, uncut output that shows the problem. The only console output are the errors, with mp2 a lot of the same missing header errors: [mp2 @ 0x105002800] Header missing [mp2 @ 0x105002800] Header missing [mp2 @ 0x105002800] Header missing [mp2 @ 0x105002800] Header missing [mp2 @ 0x105002800] Header missing [mp2 @ 0x105002800] Header missing [mp2 @ 0x105002800] Header missing [mp2 @ 0x105002800] Header missing [mp2 @ 0x105002800] Header missing [mp2 @ 0x105002800] Header missing [mp2 @ 0x105002800] Header missing [mp2 @ 0x105002800] Header missing [mp2 @ 0x105002800] Header missing [mp2 @ 0x105002800] Header missing … and so on and on, about 50% of all audio frames are concerned. With aac : [aac @ 0x1051b3c00] Error decoding AAC frame header. [aac @ 0x1051b3c00] channel element 0.0 is not allocated -after 1-5 seconds it continues- [aac @ 0x1051b3c00] Error decoding AAC frame header. [aac @ 0x1051b3c00] channel element 0.0 is not allocated -after 1-5 seconds it continues- [aac @ 0x1051b3c00] channel element 0.2 is not allocated -after 1-5 seconds it continues- [aac @ 0x1051b3c00] channel element 3.13 is not allocated -after 1-5 seconds it continues- [aac @ 0x1051b3c00] Error decoding AAC frame header. [aac @ 0x1051b3c00] Number of bands (47) exceeds limit (36). -after 1-5 seconds it continues- [aac @ 0x1051b3c00] channel element 0.0 is not allocated [aac @ 0x1051b3c00] channel element 0.0 is not allocated [aac @ 0x1051b3c00] Error decoding AAC frame header. - and so on. There is no other console output. ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] mp2/mp3 missing header at decoding of mpegts file, but only in OS X
Kalileo kalileo@... writes: I tested it now with ./configure --cc=clang --enable-shared and with ./configure --cc=clang --disable-optimizations --disable-asm --disable-yasm --enable-shared Please also test ./configure --cc=clang make and please provide complete, uncut console output for the failing case. If the problem is not reproducible with ffmpeg (the application) it would be nice if you would mention that. Carl Eugen ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
Re: [Libav-user] mp2/mp3 missing header at decoding of mpegts file, but only in OS X
On Mar 8, 2012, at 02:50 , Carl Eugen Hoyos wrote: Kalileo kalileo@... 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 libavformat54. 2.100 / 54. 2.100 libavdevice53. 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 500 reached at 500 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/9: 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/9: 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/9: Video: h264 (![0][0][0] / 0x0021), yuv420p, 720x576 [SAR 16:15 DAR 4:3], 1/9, 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)? ___ Libav-user mailing list Libav-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user