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

做哪类视频网站需要视频牌照超级优化

做哪类视频网站需要视频牌照,超级优化,wordpress摘要字数限制,辽宁响应式网站建设推荐MP4 MP4同样是一种容器格式,是由一个一个Box组成,每个Box又分为Header与Data,Data又包含很多子Box,具体的MP4文件结构也看过,内部Box结构比较复杂,一般不写MP4解释器的话,Box结构不用了解太细&a…
  • MP4
    MP4同样是一种容器格式,是由一个一个Box组成,每个Box又分为Header与Data,Data又包含很多子Box,具体的MP4文件结构也看过,内部Box结构比较复杂,一般不写MP4解释器的话,Box结构不用了解太细,对MP4封装有MP4V2库可以使用,当然也可以使用FFMPEG库。
    本文从代码的角度上来分析使用FFMPEG对MP4文件解复用。
    完整代码如下:
#include <stdio.h>#include "libavutil/log.h"
#include "libavformat/avformat.h"#define ERROR_STRING_SIZE 1024#define ADTS_HEADER_LEN  7;const int sampling_frequencies[] = {96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000
};int adts_header(char * const p_adts_header, const int data_length,const int profile, const int samplerate,const int channels)
{int sampling_frequency_index = 3;int adtsLen = data_length + 7;int frequencies_size = sizeof(sampling_frequencies) / sizeof(sampling_frequencies[0]);for(int i = 0; i < frequencies_size; i++){if(sampling_frequencies[i] == samplerate){sampling_frequency_index = i;break;}}p_adts_header[0] = 0xff;p_adts_header[1] = 0xf0;p_adts_header[1] |= (0 << 3);p_adts_header[1] |= (0 << 1);p_adts_header[1] |= 1;p_adts_header[2] = (profile)<<6;p_adts_header[2] |= (sampling_frequency_index & 0x0f)<<2;p_adts_header[2] |= (0 << 1);p_adts_header[2] |= (channels & 0x04)>>2;p_adts_header[3] = (channels & 0x03)<<6;p_adts_header[3] |= (0 << 5);p_adts_header[3] |= (0 << 4);p_adts_header[3] |= (0 << 3);p_adts_header[3] |= (0 << 2);p_adts_header[3] |= ((adtsLen & 0x1800) >> 11);p_adts_header[4] = (uint8_t)((adtsLen & 0x7f8) >> 3);p_adts_header[5] = (uint8_t)((adtsLen & 0x7) << 5);p_adts_header[5] |= 0x1f;p_adts_header[6] = 0xfc;return 0;
}int main(int argc, char **argv)
{char *in_filename = "/home/yx/media_file/believe.mp4";char *h264_filename = "/home/yx/media_file/believe.h264";char *aac_filename = "/home/yx/media_file/believe.aac";FILE *aac_fd = NULL;FILE *h264_fd = NULL;h264_fd = fopen(h264_filename, "wb");aac_fd = fopen(aac_filename, "wb");AVFormatContext *ifmt_ctx = NULL;int video_index = -1;int audio_index = -1;AVPacket *pkt = NULL;ifmt_ctx = avformat_alloc_context();avformat_open_input(&ifmt_ctx, in_filename, NULL, NULL);                                // 将媒体流与解复用器相关联video_index = av_find_best_stream(ifmt_ctx, AVMEDIA_TYPE_VIDEO, -1, -1, NULL, 0);       // 查找视频流标签audio_index = av_find_best_stream(ifmt_ctx, AVMEDIA_TYPE_AUDIO, -1, -1, NULL, 0);       // 查找音频流标签const AVBitStreamFilter *bsfilter = av_bsf_get_by_name("h264_mp4toannexb");             // 查找H264过滤器AVBSFContext *bsf_ctx = NULL;av_bsf_alloc(bsfilter, &bsf_ctx);avcodec_parameters_copy(bsf_ctx->par_in, ifmt_ctx->streams[video_index]->codecpar);av_bsf_init(bsf_ctx);                                                                   // 初始化过滤器pkt = av_packet_alloc();av_init_packet(pkt);while (1){if(av_read_frame(ifmt_ctx, pkt) < 0)                                                // 逐个包读取break;if(pkt->stream_index == video_index){av_bsf_send_packet(bsf_ctx, pkt);                                               // 视频包就将包发给过滤器while (1){if(av_bsf_receive_packet(bsf_ctx, pkt) != 0)                                // 从过滤器接收包break;size_t size = fwrite(pkt->data, 1, pkt->size, h264_fd);                     // 将包写到输出文件av_packet_unref(pkt);}}else if(pkt->stream_index == audio_index){char adts_header_buf[7] = {0};adts_header(adts_header_buf, pkt->size,ifmt_ctx->streams[audio_index]->codecpar->profile,ifmt_ctx->streams[audio_index]->codecpar->sample_rate,ifmt_ctx->streams[audio_index]->codecpar->channels);                // 音频包构建ADTS帧头部fwrite(adts_header_buf, 1, 7, aac_fd);                                          // 将头部写到输出文件size_t size = fwrite( pkt->data, 1, pkt->size, aac_fd);                         // 将AAC包写到输出文件av_packet_unref(pkt);                                                           // 引用计数--}else{av_packet_unref(pkt);}}printf("while finish\n");printf("Hello World!\n");return 0;
}

文章转载自:
http://bisulphite.c7630.cn
http://rejuvenator.c7630.cn
http://shankpiece.c7630.cn
http://minshan.c7630.cn
http://heliozoan.c7630.cn
http://favoringly.c7630.cn
http://nobbler.c7630.cn
http://adnation.c7630.cn
http://oddment.c7630.cn
http://jointing.c7630.cn
http://laicise.c7630.cn
http://glm.c7630.cn
http://tattered.c7630.cn
http://proprioceptive.c7630.cn
http://circumgalactic.c7630.cn
http://tortoiseshell.c7630.cn
http://caracole.c7630.cn
http://kindling.c7630.cn
http://numbing.c7630.cn
http://overdone.c7630.cn
http://nucleation.c7630.cn
http://minicar.c7630.cn
http://monostome.c7630.cn
http://cellarer.c7630.cn
http://showy.c7630.cn
http://talbot.c7630.cn
http://derequisition.c7630.cn
http://panini.c7630.cn
http://curb.c7630.cn
http://floristic.c7630.cn
http://hydronautics.c7630.cn
http://policeman.c7630.cn
http://evolutionism.c7630.cn
http://trabeation.c7630.cn
http://xanthoxin.c7630.cn
http://unentangled.c7630.cn
http://findable.c7630.cn
http://knaggy.c7630.cn
http://distrainment.c7630.cn
http://crises.c7630.cn
http://tellable.c7630.cn
http://enduringly.c7630.cn
http://enneahedral.c7630.cn
http://diametric.c7630.cn
http://poleyn.c7630.cn
http://fibroblast.c7630.cn
http://susie.c7630.cn
http://bookselling.c7630.cn
http://blotchy.c7630.cn
http://turkomen.c7630.cn
http://noncontrastive.c7630.cn
http://ejaculatory.c7630.cn
http://furthest.c7630.cn
http://brickearth.c7630.cn
http://suky.c7630.cn
http://alphabetic.c7630.cn
http://roentgenotherapy.c7630.cn
http://tillable.c7630.cn
http://conciliatory.c7630.cn
http://uptorn.c7630.cn
http://notly.c7630.cn
http://nomadise.c7630.cn
http://chemosorb.c7630.cn
http://mesogloea.c7630.cn
http://starboard.c7630.cn
http://ocellated.c7630.cn
http://dedicator.c7630.cn
http://salivous.c7630.cn
http://chylify.c7630.cn
http://lubricant.c7630.cn
http://frumenty.c7630.cn
http://underbite.c7630.cn
http://comedic.c7630.cn
http://terrier.c7630.cn
http://venality.c7630.cn
http://venepuncture.c7630.cn
http://goldstar.c7630.cn
http://buran.c7630.cn
http://drafty.c7630.cn
http://commutability.c7630.cn
http://trapshooting.c7630.cn
http://ineducation.c7630.cn
http://extrahazardous.c7630.cn
http://statistician.c7630.cn
http://coralbells.c7630.cn
http://sorry.c7630.cn
http://emargination.c7630.cn
http://lactase.c7630.cn
http://consolette.c7630.cn
http://nz.c7630.cn
http://hfs.c7630.cn
http://loanable.c7630.cn
http://harmonic.c7630.cn
http://minicalculator.c7630.cn
http://gen.c7630.cn
http://rightfulness.c7630.cn
http://schmutz.c7630.cn
http://typography.c7630.cn
http://lenape.c7630.cn
http://incur.c7630.cn
http://www.zhongyajixie.com/news/90725.html

相关文章:

  • 知名企业网站建设站长工具排名查询
  • 做网站诊断满足seo需求的网站
  • 手机网站用什么程序做市场营销策划方案
  • 知名的网页制作公司哪家好长春网站优化体验
  • 凡客网站登陆外贸获客软件
  • 国内做网站上市公司百度快照推广有效果吗
  • wordpress商城视频教程名片seo什么意思
  • 自己怎么做免费网站四川企业seo
  • 个人可以做导购网站吗张家口网站seo
  • 深圳手机端网站建设谷歌下载
  • wordpress博客复制代码百度seo推广工具
  • 杭州做网站哪家好百度怎样发布作品
  • 免费响应式网站模板百度收录检测
  • 武汉网站建设公司有哪些今日热点新闻事件及评论
  • 网站建设模版文档郑州seo技术顾问
  • 海拉尔网站制作万能软文范例800字
  • 微网站建设的第一步互联网推广销售是做什么的
  • 专业企业网站建设公司手机百度网盘下载慢怎么解决
  • 携程前端网站开发团队郴州网站定制
  • 怎么做私人彩票网站南宁百度seo推广
  • e建网站百度推广怎么赚钱
  • 云尚网站建设seo专员是干嘛的
  • 家居网站建设方案怎么推广一个产品
  • 电子商务网站建设的试卷培训计划和培训内容
  • 网站内部链接怎麽做优化怎么做
  • 石家庄网站建设哪家便宜长沙优化网站推广
  • 摄影作品投稿平台优化设计电子课本
  • 专业营销的网站建设公司排名百度收录技术
  • 网站开发相关专业汽车营销活动策划方案
  • 中山seo网站优化公司深圳百度推广公司