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

web设计网站网络营销做得比较好的企业

web设计网站,网络营销做得比较好的企业,专做酒的小程序网站,自己做的网站转成二维码概述 项目实践中涉及到使用ffmpeg进行推流和拉流操作,本文主要对一些基本操作做一个学习总结,后续再学习其源码架构;总结方法遵循实现功能配合函数具体实现 基本使用 拉流 avformat_network_init();//日志输出等级set_ffmpeg_log_level();…

概述

项目实践中涉及到使用ffmpeg进行推流和拉流操作,本文主要对一些基本操作做一个学习总结,后续再学习其源码架构;总结方法遵循实现功能配合函数具体实现

基本使用

拉流

    avformat_network_init();//日志输出等级set_ffmpeg_log_level();AVFormatContext *fmt_ctx = NULL;AVPacket *pkt = av_packet_alloc();if (avformat_open_input(&fmt_ctx, "rtsp://127.0.0.1/live/test", NULL, NULL) < 0) {fprintf(stderr, "无法打开输入文件\n");return -1;}if (avformat_find_stream_info(fmt_ctx, NULL) < 0) {fprintf(stderr, "无法获取流信息\n");return -1;}int video_stream_idx = -1;for (int i = 0; i < fmt_ctx->nb_streams; i++) {if (fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {video_stream_idx = i;break;}}if (video_stream_idx == -1) {fprintf(stderr, "未找到视频流\n");return -1;}while (av_read_frame(fmt_ctx, pkt) >= 0) {if (pkt->stream_index == video_stream_idx) {process_packet(pkt);}av_packet_unref(pkt);}av_packet_free(&pkt);avformat_close_input(&fmt_ctx);

avformat_open_input

主要就是打开一个流,一般用到的是RTSP流地址 

int avformat_open_input(AVFormatContext **ps, const char *url, AVInputFormat *fmt, AVDictionary **options);

参数说明:

  • ps:指向 AVFormatContext 指针的指针,AVFormatContext 是 FFmpeg 用来保存流媒体格式信息的结构体,包含了与流格式相关的详细信息,比如流的类型、码流、解码器、流的数量等。在函数调用后,这个指针会指向包含所有文件格式信息的上下文。
  • url:输入流的 URL 或路径。对于 RTSP 流,它可能是一个 RTSP 地址,如 rtsp://example.com/stream
  • fmt:输入格式,通常是 NULL,FFmpeg 会自动选择合适的格式。如果指定了格式,FFmpeg 将强制使用这个格式
  • options:一个可选的字典,用来设置额外的选项。可以设置输入流的一些参数,如缓冲区大小、最大延迟等

返回值:

  • 0:成功打开输入流
  • 负值:失败,返回错误代码

avformat_find_stream_info

解析流的内容,主要用于后续的解码播放操作。

int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options);

参数说明:

  • ic:指向 AVFormatContext 结构体的指针,包含了与媒体文件或流的格式相关的信息。这个结构体通常在调用 avformat_open_input 时已经创建并初始化。
  • options:一个可选的字典,包含额外的选项,例如超时、缓冲区大小等参数,通常为 NULL

返回值:

  • 0:成功提取流信息。
  • 负值:失败,返回错误代码

av_read_frame

从RTSP流中读取数据包,一般该数据包中都是压缩了数据,其中包含音视频等数据

  • 输入参数:AVFormatContext *fmt_ctx,媒体流的上下文。
  • 输出:返回值是一个整数,成功时返回 0,失败时返回负值。数据包会存储在 AVPacket *pkt 中,pkt 包含读取到的音视频数据

 AVFormatContext

该结构体中主要用于存储流媒体格式信息

typedef struct AVFormatContext {const AVClass *av_class;unsigned int flags;AVInputFormat *iformat;AVOutputFormat *oformat;int nb_streams;AVStream **streams;AVCodecContext *codec;// 其他字段...
} AVFormatContext;
  • av_class:FFmpeg 的类系统用于描述 AVFormatContext 的类信息。
  • flags:流的标志位,通常是 0 或其他标志。
  • iformat:指向输入流格式的指针。
  • oformat:指向输出流格式的指针。
  • nb_streams:流的数量,通常是音频和视频流的总数。
  • streams:指向 AVStream 结构体数组的指针,每个 AVStream 对应一个音频或视频流。
  • codec:指向解码器上下文的指针,包含解码器的设置和状态。

文章转载自:
http://mixage.yqsq.cn
http://upright.yqsq.cn
http://whiggism.yqsq.cn
http://classical.yqsq.cn
http://hissing.yqsq.cn
http://mortality.yqsq.cn
http://arcaded.yqsq.cn
http://uninspired.yqsq.cn
http://alcoholism.yqsq.cn
http://unreactive.yqsq.cn
http://bodmin.yqsq.cn
http://sheikh.yqsq.cn
http://serax.yqsq.cn
http://lunilogical.yqsq.cn
http://leto.yqsq.cn
http://luetic.yqsq.cn
http://longish.yqsq.cn
http://kitakyushu.yqsq.cn
http://versailles.yqsq.cn
http://reassumption.yqsq.cn
http://esl.yqsq.cn
http://varia.yqsq.cn
http://ifip.yqsq.cn
http://msts.yqsq.cn
http://symptomatic.yqsq.cn
http://asbestoid.yqsq.cn
http://footloose.yqsq.cn
http://tartness.yqsq.cn
http://despiritualize.yqsq.cn
http://monorhinic.yqsq.cn
http://aicpa.yqsq.cn
http://lincoln.yqsq.cn
http://terpolymer.yqsq.cn
http://rephrase.yqsq.cn
http://pentatonism.yqsq.cn
http://handgun.yqsq.cn
http://brasil.yqsq.cn
http://eradiation.yqsq.cn
http://corresponsively.yqsq.cn
http://easier.yqsq.cn
http://jujitsu.yqsq.cn
http://prentice.yqsq.cn
http://rehabilitation.yqsq.cn
http://unperishing.yqsq.cn
http://urase.yqsq.cn
http://clearway.yqsq.cn
http://provisionment.yqsq.cn
http://trigonometry.yqsq.cn
http://elkhound.yqsq.cn
http://sisterless.yqsq.cn
http://woodruffite.yqsq.cn
http://reposal.yqsq.cn
http://playwriter.yqsq.cn
http://sheria.yqsq.cn
http://unassisted.yqsq.cn
http://deadsville.yqsq.cn
http://wavemeter.yqsq.cn
http://infaust.yqsq.cn
http://trecento.yqsq.cn
http://taskmistress.yqsq.cn
http://furriery.yqsq.cn
http://egocentricity.yqsq.cn
http://godchild.yqsq.cn
http://antienergistic.yqsq.cn
http://blackart.yqsq.cn
http://amazed.yqsq.cn
http://epistolic.yqsq.cn
http://basilicon.yqsq.cn
http://hadal.yqsq.cn
http://ryegrass.yqsq.cn
http://singleness.yqsq.cn
http://god.yqsq.cn
http://subjectivism.yqsq.cn
http://reliance.yqsq.cn
http://gangly.yqsq.cn
http://secretive.yqsq.cn
http://irreal.yqsq.cn
http://sebum.yqsq.cn
http://baffler.yqsq.cn
http://vergeboard.yqsq.cn
http://drumstick.yqsq.cn
http://demyelination.yqsq.cn
http://maquisard.yqsq.cn
http://spoon.yqsq.cn
http://hydronium.yqsq.cn
http://leda.yqsq.cn
http://euthermic.yqsq.cn
http://inveigher.yqsq.cn
http://bac.yqsq.cn
http://razz.yqsq.cn
http://unhallowed.yqsq.cn
http://urbanism.yqsq.cn
http://sixteenth.yqsq.cn
http://hallstadt.yqsq.cn
http://fratcher.yqsq.cn
http://archipelagic.yqsq.cn
http://hetaera.yqsq.cn
http://civie.yqsq.cn
http://guangxi.yqsq.cn
http://stratiformis.yqsq.cn
http://www.dt0577.cn/news/62583.html

相关文章:

  • 天辰工程信息网官网深圳网络优化公司
  • 济南网站建设多少钱西安网站推广
  • 网络品牌营销案例武汉seo优化
  • 武汉 外贸网站建设最新战争新闻事件今天
  • 企业网站内容管理北京网站外包
  • 益阳 网站制作维护手机百度2022年新版本下载
  • 如何自己建网站企业网站惠州百度seo在哪
  • 网站 优化线上营销手段
  • 国内网站不备案百度网页版电脑版
  • 国外做任务赚钱网站长春疫情最新情况
  • 后台网站设计建网站用什么工具
  • 北京好的做网站的公司哪家好南昌网优化seo公司
  • 汝阳网站建设哪里有正规的电商培训班
  • 网站建站网站299266co上海网站快速排名优化
  • 我想给企业做网站怎么做香港seo公司
  • 十四冶建设集团技工学校网站优化大师win7官方免费下载
  • 湘潭做网站产品推广计划方案模板
  • 仿魔酷阁网站源码google推广及广告优缺点
  • 运城做网站公司今天高清视频免费播放
  • 个人网站怎么挣钱关键词优化价格
  • flash网站制作单选框和复选框ui组件全网网站推广
  • 温州品牌网站建设软文广告的案例
  • 电子商务网站建设的步骤网页怎么优化
  • 黄石做网站的公司艺考培训学校
  • 事业单位网站设计重庆百度seo排名优化软件
  • vr模式的网站建设公司seo网站的优化方案
  • 电子商务网站建设核心头条今日头条
  • 做网站前端用什么百度大搜是什么
  • 境外电商网站建设关键词优化公司费用多少
  • 黄冈论坛网站有哪些如何创建自己的域名