FFMPEG解复用时间优化

来源:互联网 发布:应用更新软件 编辑:程序博客网 时间:2024/05/19 03:42
因为需要较好的相应速度,但ffmpeg在解复用时,所用时间比较久。优化如下:
        //输入并解析流        LOG_PRINTF(LOG_LEVEL_DEBUG, LOG_MODULE_DECODER, "will open input file %s.", pu8FileName);        ret = avformat_open_input(&ifmt_ctx, (char *)pu8FileName, 0, 0);        if (ret < 0)        {            LOG_PRINTF(LOG_LEVEL_ERROR, LOG_MODULE_DECODER, "Could not open input file.");            continue;        }        else        {            LOG_PRINTF(LOG_LEVEL_ERROR, LOG_MODULE_DECODER, "Could open input file %s success.", pu8FileName);        }        //减少流格式探测时间        ifmt_ctx->max_analyze_duration = AV_TIME_BASE;        ret = avformat_find_stream_info(ifmt_ctx, 0);        if (ret < 0)        {            LOG_PRINTF(LOG_LEVEL_ERROR, LOG_MODULE_DECODER, "Failed to retrieve input stream information.");            goto close_ifmt;        }

ifmt_ctx->max_analyze_duration = AV_TIME_BASE;
可以有效的降低解复用的时长。

原创粉丝点击