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

企业建站用什么主机必应网站提交入口

企业建站用什么主机,必应网站提交入口,郑州英文网站建设,重庆网站建设狐灵传媒文章目录 前言一、需求二、源码三、运行结果 前言 本文记录用 FFmpeg 获取视频流音频流的信息#xff08;编码格式、分辨率、帧率、播放时长…#xff09;#xff0c;所用的工程基于上个博客编译成功的工程#xff1a;使用FFmpeg4.3.1的SDK官方开发包编译ffmpeg.c 一、需求… 文章目录 前言一、需求二、源码三、运行结果 前言 本文记录用 FFmpeg 获取视频流音频流的信息编码格式、分辨率、帧率、播放时长…所用的工程基于上个博客编译成功的工程使用FFmpeg4.3.1的SDK官方开发包编译ffmpeg.c 一、需求 我们经常需要知道一个媒体文件所包含的媒体流的信息比如文件格式、播放时长、码率、视音频编码格式视频分辨率帧率音频属性等信息。 如何使用 FFmpeg API 获取这些信息呢 媒体容器封装格式文件播放时长文件平均码率视频音频视频属性编码器名称、视频分辨率、帧率、编码码率音频属性编码器名称、采样率、声道数、编码码率 二、源码 ffmepg.h 文件中添加我们自定义的结构体我们后面会利用 ffmepg 的 API 函数将音视频流信息填充到各个字段 typedef struct __AVGeneralMediaInfo {char filepath[1024]; // 文件路径int64_t duration; // 时长单位微秒 time_base:1,000,000int64_t totalBitrate; // 总码率int videoStreamIndex; // 视频流索引int audioStreamIndex; // 音频流索引char videoCodecName[256]; int width; // 视频宽int height; // 视频高double frameRate; // 视频帧率char audioCodecName[256];int sampleRate; // 采样率int channels; // 声道数 } AVGeneralMediaInfo;void get_avgeneral_mediainfo(AVGeneralMediaInfo* avmi, const char* filepath);ffmepg.c 文件中添加获取音视频流的基本信息的接口 // 封装查找解码器 // type:[0:video, 1:audio] void get_decoder_name(AVGeneralMediaInfo *avmi, AVFormatContext *avFmtctx, int type) {int nindex -1;if (type 0) { // videonindex avmi-videoStreamIndex;}else if (type 1) { // aduionindex avmi-audioStreamIndex;}if (nindex 0) {AVCodecContext* avcodecCtx NULL;AVCodec *avcodec NULL;avcodecCtx avFmtctx-streams[nindex]-codec;avcodec avcodec_find_decoder(avcodecCtx-codec_id);if (type 0) { // videostrcpy(avmi-videoCodecName, avcodec-name);printf(videoCodecName %s\n, avmi-videoCodecName);}else if (type 1) {strcpy(avmi-audioCodecName, avcodec-long_name);printf(audioCodecName %s\n, avmi-audioCodecName);}} }// 获取音视频流的基本信息 void get_avgeneral_mediainfo(AVGeneralMediaInfo *avmi, const char *filepath) {int ret -1;int i 0;AVFormatContext* avFmtCtx NULL; // 大管家if (avmi NULL || filepath NULL) {return;}// 1.打开音视频文件或网络流ret avformat_open_input(avFmtCtx, filepath, NULL, NULL);if (ret 0) {printf(error avformat_open_input:%s\n, filepath);return;}// 2.打印音视频流信息av_dump_format(avFmtCtx, 0, filepath, 0);// 3.继续深入读取更多的字段avmi-duration avFmtCtx-duration; // 时长avmi-totalBitrate avFmtCtx-bit_rate; // 总码率printf(duration %lld, totalBitrate %lld\n, avmi-duration, avmi-totalBitrate);// 分别读取音视频流更多的参数for (i 0; i avFmtCtx-nb_streams; i) {AVStream* avstmp avFmtCtx-streams[i]; // 拿到具体的一路流if (avstmp-codec-codec_type AVMEDIA_TYPE_VIDEO) {avmi-videoStreamIndex i;avmi-width avstmp-codec-width;avmi-height avstmp-codec-height;// 视频帧率avg_frame_rate// fps:frames per secondif (avstmp-avg_frame_rate.num ! 0 avstmp-avg_frame_rate.den ! 0) {avmi-frameRate (double)avstmp-avg_frame_rate.num / (double)avstmp-avg_frame_rate.den;}printf(width %d, height %d, frameRate %.3lf\n, avmi-width,avmi-height,avmi-frameRate);}else if (avstmp-codec-codec_type AVMEDIA_TYPE_AUDIO) {avmi-audioStreamIndex i;avmi-channels avstmp-codec-channels;avmi-sampleRate avstmp-codec-sample_rate;printf(channel %d, sampleRate %d\n, avmi-channels, avmi-sampleRate);}}// 读取具体的解码器// avcodec_find_decoder()// 视频解码器get_decoder_name(avmi, avFmtCtx, 0);// 音频解码器get_decoder_name(avmi, avFmtCtx, 1);// releaseavformat_close_input(avFmtCtx); }ffmpeg431_test.cpp 文件内容如下 #include iostream extern C { #include ffmpeg.h }int main(int argc, char** argv) {AVGeneralMediaInfo* avmi new AVGeneralMediaInfo();if (avmi) {get_avgeneral_mediainfo(avmi, SampleVideo_1280x720_20mb.mp4);delete avmi;avmi NULL;} }三、运行结果 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from SampleVideo_1280x720_20mb.mp4:Metadata:major_brand : isomminor_version : 512compatible_brands: isomiso2avc1mp41creation_time : 1970-01-01T00:00:00.000000Zencoder : Lavf53.24.2Duration: 00:01:57.31, bitrate: N/AStream #0:0(und): Video: h264 (avc1 / 0x31637661), none, 1280x720, 1048 kb/s, 25 fps, 25 tbr, 12800 tbn (default)Metadata:creation_time : 1970-01-01T00:00:00.000000Zhandler_name : VideoHandlerStream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 6 channels, 383 kb/s (default)Metadata:creation_time : 1970-01-01T00:00:00.000000Zhandler_name : SoundHandler duration 117312000, totalBitrate 0 width 1280, height 720, frameRate 25.000 channel 6, sampleRate 48000 videoCodecName h264 audioCodecName AAC (Advanced Audio Coding)使用 MediaInfo 打开 SampleVideo_1280x720_20mb.mp4 可以看到与上面打印对应的参数 我的qq2442391036欢迎交流
http://www.dnsts.com.cn/news/74808.html

相关文章:

  • 不花钱的做网站wordpress数据卡
  • 部门网站建设存在的问题网站首页做了一下调整会被k吗
  • 合肥做网站的网络公司古代中国建筑网站
  • 旅游网站ppt应做的内容下载应用
  • 5000元网站seo推广百度网站上做推广受骗
  • 优秀网站设计 pdf线上推广话术
  • 网站建设收费标准报价站长工具ip地址查询域名
  • 我的文档上传到网站 做链接手机网站特效
  • 城北区工程建设信息网站买个网页多少钱
  • 交易类网站做支付宝功能做推广网站哪家好
  • app需要网站有哪些二级域名查询网站
  • 建网站找兴田德润咸阳网站建设
  • 滕州网站建设招聘wordpress静态网站博客
  • 网站备案多久可以注销网站做缓存
  • 沧州网站建设优化公司孵化器网站建设方案
  • 网站建设 软件开发的公司哪家好建设部的网站首页
  • 网站内容页显示不出来的服务平台app
  • 营销网站占用多少m空间泰州seo网站推广
  • 大城县有做网站的吗如何做网页游戏
  • 网站的建设与规划方案营销方案包括哪些内容
  • 网站商城注意事项国外最新设计产品
  • 天猫折扣店网站建设产品设计方案模板范文
  • 网站建设phpcms潍坊seo
  • 如何dns解析网站html做旅游网站
  • 保定网站建设公司排名wordpress主题在哪个文件夹
  • 门户网站编辑流程最近几天的新闻大事
  • 桂林网站优化价格西安短视频培训班哪个好
  • 韶关企业网站建设公司怎么做网站手机版
  • 网站开发软件科技公司小型网站开发语言
  • 视频网站开发php爆款采集推广引流软件