Hi:

  My bbc_5.1_partial.ac3 file has some bad frames (please see below log),
but ffmpeg can convert it to wav format successfully.

$ ffmpeg -i bbc_5.1_partial.ac3 xxx.wav
FFmpeg version SVN-r21380, Copyright (c) 2000-2010 Fabrice Bellard, et al.
  built on Feb 19 2010 04:29:35 with gcc 4.2.4 (Ubuntu 4.2.4-1ubuntu4)
  configuration: --enable-debug=3 --enable-gpl --disable-asm
  libavutil     50. 7. 0 / 50. 7. 0
  libavcodec    52.48. 0 / 52.48. 0
  libavformat   52.47. 0 / 52.47. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libswscale     0. 9. 0 /  0. 9. 0
[ac3 @ 0x89b3b80]max_analyze_duration reached
[ac3 @ 0x89b3b80]Estimating duration from bitrate, this may be inaccurate
Input #0, ac3, from 'bbc_5.1_partial.ac3':
  Duration: 00:02:05.18, bitrate: 384 kb/s
    Stream #0.0: Audio: ac3, 48000 Hz, 5.1, s16, 384 kb/s
Output #0, wav, to 'xxx.wav':
    Stream #0.0: Audio: pcm_s16le, 48000 Hz, 5.1, s16, 4608 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop encoding
[ac3 @ 0x89bce10]frame sync error
Error while decoding stream #0.0
[ac3 @ 0x89bce10]incomplete framete=4607.3kbits/s
[ac3 @ 0x89bce10]invalid frame size
size=   70416kB time=125.18 bitrate=4608.0kbits/s
video:0kB audio:70416kB global headers:0kB muxing overhead 0.000094%
$



  However, if I use api-example.c, avcodec_decode_audio3() will return
negative value, and it won't continue decoding the remaining frames. How do
I modify it to do the same thing like ffmpeg.c? (By the way, in ffmpeg.c it
also does "goto fail_decode;" why does the ac3 to wave conversion work???)

    /* decode until eof */
    avpkt.data = inbuf;
    for(;;) {
        avpkt.size = fread(inbuf, 1, INBUF_SIZE, f);
        if (avpkt.size == 0)
            break;

        avpkt.data = inbuf;
        while (avpkt.size > 0) {
            out_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
            len = avcodec_decode_audio3(c, (short *)outbuf, &out_size,
&avpkt);
            if (len < 0) {
                fprintf(stderr, "Error while decoding\n");
                exit(1);
            }
            if (out_size > 0) {
                /* if a frame has been decoded, output it */
                fwrite(outbuf, 1, out_size, outfile);
            }
            avpkt.size -= len;
            avpkt.data += len;
        }
    }




Bob
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to