美文网首页
在Ubuntu下编译IjkPlayer,使其支持rtsp格式的播

在Ubuntu下编译IjkPlayer,使其支持rtsp格式的播

作者: chenzhenlindx | 来源:发表于2018-04-20 10:22 被阅读271次

    本文在ubuntu编译最新版ijkplayer基础上进行。
    参考文章在Ubuntu下编译IjkPlayer,使其支持rtsp格式的播放流

    在执行最后一句命令行 ./compile-ijk.sh all之前,需要修改一些东西

    1. 首先需要支持rtsp格式的播放流

    打开下载下来的ijkplayer文件夹,打开module-lite.sh文件


    图片.png

    添加支持

    export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocol=rtp"
    export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocol=tcp"
    export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=rtsp"
    export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=sdp"
    export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=rtp"
    
    图片.png

    2. 修改ff_ffplay.c文件

    图片.png
    /*添加*/
    AVDictionary* re_options = NULL;
    av_dict_set(&re_options,"buffer_size","1024000",0);
    av_dict_set(&re_options,"max_delay","500000",0);
    av_dict_set(&re_options,"stimeout","20000000",0);
    av_dict_set(&re_options,"rtsp_transport","tcp",0);
    //err = avformat_open_input(&ic, is->filename, is->iformat, &ffp->format_opts);
    err = avformat_open_input(&ic, is->filename, is->iformat, &re_options);
    
    图片.png
    /*添加*/
    ic->max_analyze_duration = 60 * AV_TIME_BASE;
    ic->probesize = 1024000;
    
    图片.png

    3. 修改ijklivehook.c

    图片.png
    /*
    * 引入avutil.h
    */
    #include "libavutil/avutil.h"
    
    图片.png
     /*
    av_dict_set_int(&tmp_opts, "probesize",         avf->probesize, 0);
    av_dict_set_int(&tmp_opts, "formatprobesize",   avf->format_probesize, 0);
    av_dict_set_int(&tmp_opts, "analyzeduration",   avf->max_analyze_duration, 0);
    av_dict_set_int(&tmp_opts, "fpsprobesize",      avf->fps_probe_size, 0);
    av_dict_set_int(&tmp_opts, "max_ts_probe",      avf->max_ts_probe, 0);
    */
    
    /*添加*/
    AVDictionary* re_options = NULL;
    av_dict_set(&re_options,"buffer_size","1024000",0);
    av_dict_set(&re_options,"max_delay","500000",0);
    av_dict_set(&re_options,"stimeout","20000000",0);
    av_dict_set(&re_options,"rtsp_transport","tcp",0);
    
     /*添加*/
    new_avf->max_analyze_duration = 60 * AV_TIME_BASE;
    new_avf->probesize = 1024000;
    
    图片.png

    4. 编译代码

    在compile-ijk.sh的文件夹下打开终端,执行命令行./compile-ijk.sh all
    等待编译成功。成功后直接使用文件夹中的ijkplayer就好了

    相关文章

      网友评论

          本文标题:在Ubuntu下编译IjkPlayer,使其支持rtsp格式的播

          本文链接:https://www.haomeiwen.com/subject/jfhakftx.html