metaRTC3.0集成ffmpeg实现webrtc推拉流 |
您所在的位置:网站首页 › webrtc拉流自动补帧 › metaRTC3.0集成ffmpeg实现webrtc推拉流 |
概述
ffmpeg是一个强大的音视频处理软件,处理各种音视频的编解码和传输等,里面还集成有ffplay播放器等。metaRTC3.0新版本支持静态编译集成到ffmpeg,实现 ffmpeg从流媒体服务器SRS和ZLM的webrtc推拉流,实现ffmpeg的p2p拉流。 下载源码GitHub - metartc/ffmpeg-metartc: 集成到ffmpeg的metaRTC https://github.com/metartc/metaRTChttps://github.com/metartc/metaRTC 将libssl.a/libcrypto.a/libsrtp2.a/libspeexdsp.a/libmetartccore3.a放到metartc3文件夹里 #注意:下面的路径/path/metartc3修改为本机路径 ./configure --enable-libx264 --enable-gpl --extra-libs='-L/path/metartc3 -lmetartccore3 -lspeexdsp -lpthread -lsrtp2 -lssl -lcrypto -ldl' make 集成说明新增文件: libavformat/webrtc_demuxer.c libavformat/yang_h264_initExtra.h libavformat/YangMetaConnection.h //metaRTC头文件 修改文件: libavformat/util.c libavcodec/h264dec.c 修改部分有//add metartc注释 增加了x264的支持,修改ffmpeg.c文件,开发者可以在此增加其他编码的支持。 if(ost->enc_ctx->codec_id==AV_CODEC_ID_H264&&memcmp(oc->ctx->filename,"webrtc",6)==0){ ost->enc_ctx->pix_fmt = AV_PIX_FMT_YUV420P; av_dict_set(&ost->encoder_opts, "preset", "superfast", 0); av_dict_set(&ost->encoder_opts, "tune", "zerolatency", 0); av_dict_set(&ost->encoder_opts, "profile", "baseline", 0); ost->enc_ctx->profile = FF_PROFILE_H264_CONSTRAINED_BASELINE;//:FF_PROFILE_HEVC_MAIN; ost->enc_ctx->level=31; ost->enc_ctx->max_b_frames=0; ost->enc_ctx->has_b_frames=0; } 流媒体服务器流媒体服务器支持SRS和ZLM,也支持从p2p拉流。 在文件webrtc_demuxer.c和webrtc_muxer.c中可修改流媒体服务支持 推流命令 ffmpeg ......-acodec opus -strict -2 -ar 48000 -f webrtc webrtc://192.168.0.1/live/livestream拉流命令 ffplay webrtc://127.0.0.1/live/livestreamp2p拉流命令 ffplay webrtc://127.0.0.1:1988/live/livestream |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |