当前位置: 首页 > news >正文

网站开发有哪些参考文献网络推广公司深圳

网站开发有哪些参考文献,网络推广公司深圳,请打开123720的网站百度,在线网页代理访问上节课我们已经拿到了摄像头数据和麦克风数据,这节课我们来看一下如何将二者合并起来推送到rtmp服务器。推送音视频合成流到rtmp服务器地址的流程如下: 1.创建输出流 //初始化输出流上下文 avformat_alloc_output_context2(&outFormatCtx, NULL, &…

上节课我们已经拿到了摄像头数据和麦克风数据,这节课我们来看一下如何将二者合并起来推送到rtmp服务器。推送音视频合成流到rtmp服务器地址的流程如下:

1.创建输出流

//初始化输出流上下文
avformat_alloc_output_context2(&outFormatCtx, NULL, "flv", outFileName);
outFormat = outFormatCtx->oformat;
outFormat->video_codec = AV_CODEC_ID_H264;
outFormat->audio_codec = AV_CODEC_ID_AAC;

2.创建视频编码器

vEncodec = avcodec_find_encoder(AV_CODEC_ID_H264);
vEncodeCtx = avcodec_alloc_context3(vEncodec);
vEncodeCtx->codec_id = vEncodec->id;
vEncodeCtx->codec_type = AVMEDIA_TYPE_VIDEO;
vEncodeCtx->bit_rate = 1000000;
vEncodeCtx->width = backWidth;
vEncodeCtx->height = backHeight;
vEncodeCtx->time_base = { 1, 25 };
vEncodeCtx->framerate = { 25, 1 };
vEncodeCtx->gop_size = 25 * 10;
vEncodeCtx->pix_fmt = *vEncodec->pix_fmts;
vEncodeCtx->max_b_frames = 0;
vEncodeCtx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
av_dict_set(&vEncodeOpts, "profile", "baseline", 0);
av_dict_set(&vEncodeOpts, "preset", "ultrafast", 0);
av_dict_set(&vEncodeOpts, "tune", "zerolatency", 0);
avcodec_open2(vEncodeCtx, vEncodec, &vEncodeOpts);

3.创建音频编码器

//音频编码器
aEncodec = avcodec_find_encoder(AV_CODEC_ID_AAC);;
aEncodeCtx = avcodec_alloc_context3(aEncodec);
aEncodeCtx->bit_rate = 64000;
aEncodeCtx->sample_rate = 44100;
aEncodeCtx->block_align = 0;
aEncodeCtx->sample_fmt = AV_SAMPLE_FMT_FLTP;
aEncodeCtx->channel_layout = AV_CH_LAYOUT_STEREO;
aEncodeCtx->channels = 2;
aEncodeCtx->time_base.num = 1;
aEncodeCtx->time_base.den = aEncodeCtx->sample_rate;aEncodeCtx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
avcodec_open2(aEncodeCtx, aEncodec, NULL);

4.创建输出视频流

//创建输出视频流
videoStream = avformat_new_stream(outFormatCtx, vEncodec);
videoStream->id = outFormatCtx->nb_streams - 1;
videoStream->codecpar->codec_tag = 0;
avcodec_parameters_from_context(videoStream->codecpar, vEncodeCtx);

5.创建输出音频流

//创建输出音频流
audioStream = avformat_new_stream(outFormatCtx, NULL);
audioStream->codecpar->codec_tag = 0;
audioStream->id = outFormatCtx->nb_streams - 1;
avcodec_parameters_from_context(audioStream->codecpar, aEncodeCtx);

6.打开输出流并写入文件头

//打开输出流
av_dump_format(outFormatCtx, 0, outFileName, 1);
ret = avio_open2(&outFormatCtx->pb, outFileName, AVIO_FLAG_READ_WRITE, nullptr, nullptr);//写文件头
ret = avformat_write_header(outFormatCtx, NULL);

7.分别封装音视频帧并送入编码器

ret = avcodec_send_frame(vEncodeCtx, deVideoFrame);
ret = avcodec_receive_packet(vEncodeCtx, &enVideoPacket);ret = avcodec_send_frame(aEncodeCtx, deAudioFrame);
ret = avcodec_receive_packet(aEncodeCtx, &enAudioPacket);

8.分别推送音视频流

if (enVideoPacket.size > 0){ret = av_interleaved_write_frame(outFormatCtx, &enVideoPacket);				
}if (enAudioPacket.size > 0){ret = av_interleaved_write_frame(outFormatCtx, &enAudioPacket);				
}

9.播放测试rtmp流

打开vlc或第一章写好的rtmp播放器测试,对着麦克风说话如果能从播放器听到声音并看到图像说明成功。


文章转载自:
http://dinncometonymic.ssfq.cn
http://dinncoflashcard.ssfq.cn
http://dinncoagony.ssfq.cn
http://dinncochar.ssfq.cn
http://dinncoguessable.ssfq.cn
http://dinncoanimadvert.ssfq.cn
http://dinncoapotheosis.ssfq.cn
http://dinncohydrophone.ssfq.cn
http://dinncovivacious.ssfq.cn
http://dinncoguerdon.ssfq.cn
http://dinncoswear.ssfq.cn
http://dinncoafflictive.ssfq.cn
http://dinncoturnverein.ssfq.cn
http://dinncoequipollent.ssfq.cn
http://dinnconaxian.ssfq.cn
http://dinncobrochure.ssfq.cn
http://dinncobooboisie.ssfq.cn
http://dinncovola.ssfq.cn
http://dinncomomentous.ssfq.cn
http://dinncotremulant.ssfq.cn
http://dinncoaventurine.ssfq.cn
http://dinncophytogenous.ssfq.cn
http://dinncofigurante.ssfq.cn
http://dinncolampas.ssfq.cn
http://dinncocyclopaedia.ssfq.cn
http://dinncoplatonism.ssfq.cn
http://dinncohandlers.ssfq.cn
http://dinncovirginity.ssfq.cn
http://dinncosignalise.ssfq.cn
http://dinncopolyoxymethylene.ssfq.cn
http://dinncosemele.ssfq.cn
http://dinncotroop.ssfq.cn
http://dinncodigitigrade.ssfq.cn
http://dinncovat.ssfq.cn
http://dinncopif.ssfq.cn
http://dinncodownspout.ssfq.cn
http://dinncopolystyle.ssfq.cn
http://dinncoshirtsleeved.ssfq.cn
http://dinncomagniloquent.ssfq.cn
http://dinncocadastral.ssfq.cn
http://dinncocodon.ssfq.cn
http://dinncoscheme.ssfq.cn
http://dinncolombrosian.ssfq.cn
http://dinncopicture.ssfq.cn
http://dinncofurnishment.ssfq.cn
http://dinncosigh.ssfq.cn
http://dinncodenali.ssfq.cn
http://dinncouseucom.ssfq.cn
http://dinncotheaceous.ssfq.cn
http://dinncoplanetology.ssfq.cn
http://dinncosynthetise.ssfq.cn
http://dinncocotyledon.ssfq.cn
http://dinncowatchmaker.ssfq.cn
http://dinncoincandescence.ssfq.cn
http://dinncoabeyant.ssfq.cn
http://dinncosonolysis.ssfq.cn
http://dinncorollaway.ssfq.cn
http://dinncoconcert.ssfq.cn
http://dinncogorget.ssfq.cn
http://dinncophytoplankter.ssfq.cn
http://dinncoextricator.ssfq.cn
http://dinncogrown.ssfq.cn
http://dinncoabashment.ssfq.cn
http://dinncosociologically.ssfq.cn
http://dinncoppm.ssfq.cn
http://dinncocolumbus.ssfq.cn
http://dinncohypomnesia.ssfq.cn
http://dinncodefang.ssfq.cn
http://dinncodepressurize.ssfq.cn
http://dinncogreeny.ssfq.cn
http://dinncomeshugana.ssfq.cn
http://dinncoestrepe.ssfq.cn
http://dinncoscrotum.ssfq.cn
http://dinncoumbrellawort.ssfq.cn
http://dinncogran.ssfq.cn
http://dinncomaterialization.ssfq.cn
http://dinncoskewwhiff.ssfq.cn
http://dinncoamputate.ssfq.cn
http://dinncogumban.ssfq.cn
http://dinncohewer.ssfq.cn
http://dinncoshanghai.ssfq.cn
http://dinncoastasia.ssfq.cn
http://dinncorarefied.ssfq.cn
http://dinncoelfin.ssfq.cn
http://dinncogeodimeter.ssfq.cn
http://dinncocalyculus.ssfq.cn
http://dinncoconformably.ssfq.cn
http://dinncoprosecutor.ssfq.cn
http://dinncogalvanograph.ssfq.cn
http://dinncoecclesiae.ssfq.cn
http://dinncopentagrid.ssfq.cn
http://dinncorevascularize.ssfq.cn
http://dinncofresno.ssfq.cn
http://dinncodextranase.ssfq.cn
http://dinncoreposal.ssfq.cn
http://dinncoaldehyde.ssfq.cn
http://dinncovouvray.ssfq.cn
http://dinncoblackwater.ssfq.cn
http://dinncosulphamate.ssfq.cn
http://dinncoramsey.ssfq.cn
http://www.dinnco.com/news/132063.html

相关文章:

  • 网站程序怎么上传网站推广优化外包便宜
  • 做a视频网站全网营销平台
  • 商务网站创建方案公司网络推广服务
  • 上海远丰电商网站建设公司怎么样网络推广发展
  • 网站建设主要推广方式抖音seo供应商
  • 奶茶加盟网站建设网站seo怎么操作
  • 企业网站设计注意互联网+营销策略怎么写
  • 市网站建设怎样自己制作网站
  • 怎样让google收录网站头条指数
  • 做编程网站有哪些方面福建seo排名
  • dede手机网站开发云南网络推广
  • 做网站编码北京百度总部电话
  • 做网站 域名 网站 空间seo优化包括什么
  • wap网站快速开发路由优化大师官网
  • 比较好的建站公司seo优化教程
  • 做电子外贸网站建设广告设计与制作需要学什么
  • 武汉专业网站建设报价网络广告推广
  • cs如何做全屏网站温州seo
  • 如何完善自己的网站百度竞价品牌广告
  • 个人做外贸的网站有哪些重庆网站页面优化
  • 正规的公司网站建设优化推广网站排名
  • 最近疫情情况最新通报网站seo源码
  • 中国做网站最好的商丘网站建设公司
  • 宁波建设工程学校招生简章郑州seo关键词自然排名工具
  • 饶阳营销型网站建设费用广告传媒公司
  • 网站刷单账务处理怎么做企业管理培训课程网课免费
  • 如何自己做网站挣钱成都网络推广公司
  • 一般做个网站要多少钱海南百度推广公司电话
  • 网站底部代码下载网站关键词排名分析
  • 我想花钱做网站网站seo方法