这是什么呀 2019-03-05 10:33 采纳率: 0%
浏览 3451
已结题

ffmpeg avcodec_receive_frame 解码效率慢

if (pPacket->stream_index == videoIndex)
{
                Uint32 pretimer = SDL_GetTicks();
                /*
                ret = avcodec_decode_video2(pCodecCtx, pFrame, &got_picture, pPacket);
                if (ret < 0)
                {
                    printf("解帧失败!\n");
                    return -1;
                }
                */
                ret = avcodec_send_packet(pCodecCtx, pPacket);
                if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF)
                    return -1;

                ret = avcodec_receive_frame(pCodecCtx, pFrame);
                if (ret < 0 && ret != AVERROR_EOF) {
                    //fprintf(stderr, "Could not open audio codec: %s\n", av_err2str(ret));
                    continue;
                }

                Uint32  a = SDL_GetTicks() - pretimer;
                cout << "avcodec_receive_frame" << a << endl;
}

ffmpeg 我是用3.4版本 解码时,使用函数avcodec_send_packet avcodec_receive_frame 获取一帧4K高清视频,30ms左右
使用2.8老版本时 avcodec_decode_video2 获取一帧4K高清视频 10ms左右,请问这种情况如何解决。为什么新版本的解码速度反倒是变慢了。

  • 写回答

1条回答 默认 最新

  • 、、、、南山小雨、、、、 新星创作者: 编程框架技术领域 2021-11-07 14:36
    关注

    是不是你解码器的速度设置不同

    评论

报告相同问题?