Error when decode AAC with avcodec_decode_audio4()

前端 未结 1 1596
野趣味
野趣味 2021-01-19 12:51

I\'m trying to decode AAC with FFmpeg native decoder and encountered an error

SSR is not implemeted. Update your FFmpeg version to newest from Git. If the            


        
相关标签:
1条回答
  • 2021-01-19 13:11
    f = fopen(filename, "rb");
    if (!f) {
        fprintf(stderr, "Could not open %s\n", filename);
        return;
    }
    outfile = fopen(outfilename, "wb");
    if (!outfile) {
        av_free(pCodecCtx);
        return;
    }
    
    /* decode until eof */
    avpkt.data = inbuf;
    avpkt.size = fread(inbuf, 1, AUDIO_INBUF_SIZE, f);
    
    while (avpkt.size > 0) {
        int i, ch;
        int got_frame = 0;
    

    Yeah, that's not going to work. You can't dump raw bytes from some random muxing format (potentially mp4) into a decoder and expect it to work. Use av_read_frame() to read individual audio packets from the muxing format, and feed the resulting AVPacket into the decoder using avcodec_decode_audio4(). See e.g. the dranger api tutorial. I know api-example.c uses the above code, but that unfortunately only works for a very limited subset of cases. Also see the detailed description in the API docs.

    0 讨论(0)
提交回复
热议问题