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左右,请问这种情况如何解决。为什么新版本的解码速度反倒是变慢了。