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

同城做哪个网站推广效果好竞价托管外包服务

同城做哪个网站推广效果好,竞价托管外包服务,云指网站开发,怎么做自己的销售网站要对H265文件进行编码和解码&#xff0c;需要使用FFmpeg库提供的相关API。以下是一个简单的C程序&#xff0c;演示如何使用FFmpeg进行H265文件的编码和解码&#xff1a; 编码&#xff1a; #include <cstdlib> #include <cstdio> #include <cstring> #inclu…

要对H265文件进行编码和解码,需要使用FFmpeg库提供的相关API。以下是一个简单的C++程序,演示如何使用FFmpeg进行H265文件的编码和解码:

编码:

#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdint>extern "C" {
#include <libavutil/opt.h>
#include <libavcodec/avcodec.h>
}int main(int argc, char** argv) {AVCodec* codec = nullptr;AVCodecContext* codec_ctx = nullptr;AVFrame* frame = nullptr;AVPacket packet;FILE* infile, * outfile;avcodec_register_all();codec = avcodec_find_encoder_by_name("libx265");codec_ctx = avcodec_alloc_context3(codec);codec_ctx->bit_rate = 4000000;codec_ctx->width = 1280;codec_ctx->height = 720;codec_ctx->gop_size = 10;codec_ctx->max_b_frames = 1;codec_ctx->pix_fmt = AV_PIX_FMT_YUV420P;av_opt_set(codec_ctx->priv_data, "preset", "fast", 0);if (avcodec_open2(codec_ctx, codec, nullptr) < 0) {fprintf(stderr, "Could not open codec\n");return EXIT_FAILURE;}infile = std::fopen("input.yuv", "rb");if (!infile) {fprintf(stderr, "Could not open input file\n");return EXIT_FAILURE;}outfile = std::fopen("output.h265", "wb");if (!outfile) {fprintf(stderr, "Could not open output file\n");return EXIT_FAILURE;}frame = av_frame_alloc();frame->width = codec_ctx->width;frame->height = codec_ctx->height;frame->format = codec_ctx->pix_fmt;if (av_frame_get_buffer(frame, 32) < 0) {fprintf(stderr, "Could not allocate frame buffer\n");return EXIT_FAILURE;}int frame_size = av_image_get_buffer_size(codec_ctx->pix_fmt, codec_ctx->width, codec_ctx->height, 1);uint8_t* frame_buf = (uint8_t*)av_malloc(frame_size);while (true) {int ret = fread(frame_buf, 1, frame_size, infile);if (ret < frame_size) {break;}av_frame_make_writable(frame);uint8_t* pY = frame_buf;uint8_t* pU = frame_buf + frame_size / 4;uint8_t* pV = frame_buf + frame_size * 5 / 16;for (int y = 0; y < codec_ctx->height; y++) {memcpy(frame->data[0] + y * frame->linesize[0], pY + y * codec_ctx->width, codec_ctx->width);}for (int y = 0; y < codec_ctx->height / 2; y++) {memcpy(frame->data[1] + y * frame->linesize[1], pU + y * codec_ctx->width / 2, codec_ctx->width / 2);memcpy(frame->data[2] + y * frame->linesize[2], pV + y * codec_ctx->width / 2, codec_ctx->width / 2);}avcodec_send_frame(codec_ctx, frame);while (true) {ret = avcodec_receive_packet(codec_ctx, &packet);if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {break;} else if (ret < 0) {fprintf(stderr, "Error encoding frame\n");return EXIT_FAILURE;}fwrite(packet.data, 1, packet.size, outfile);av_packet_unref(&packet);}}avcodec_send_frame(codec_ctx, nullptr);while (true) {int ret = avcodec_receive_packet(codec_ctx, &packet);if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {break;} else if (ret < 0) {fprintf(stderr, "Error encoding frame\n");return EXIT_FAILURE;}fwrite(packet.data, 1, packet.size, outfile);av_packet_unref(&packet);}std::fclose(infile);std::fclose(outfile);av_frame_free(&frame);av_free(frame_buf);avcodec_free_context(&codec_ctx);return EXIT_SUCCESS;
}

解码:

#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdint>extern "C" {
#include <libavcodec/avcodec.h>
#include <libavutil/frame.h>
#include <libavutil/imgutils.h>
}int main(int argc, char** argv) {AVCodec* codec = nullptr;AVCodecContext* codec_ctx = nullptr;AVFrame* frame = nullptr;AVPacket packet;FILE* infile, * outfile;avcodec_register_all();codec = avcodec_find_decoder_by_name("libx265");codec_ctx = avcodec_alloc_context3(codec);if (avcodec_open2(codec_ctx, codec, nullptr) < 0) {fprintf(stderr, "Could not open codec\n");return EXIT_FAILURE;}infile = std::fopen("input.h265", "rb");if (!infile) {fprintf(stderr, "Could not open input file\n");return EXIT_FAILURE;}outfile = std::fopen("output.yuv", "wb");if (!outfile) {fprintf(stderr, "Could not open output file\n");return EXIT_FAILURE;}frame = av_frame_alloc();while (true) {int ret = av_read_frame(format_ctx, &packet);if (ret < 0) {break;}if (packet.stream_index != video_stream_idx) {av_packet_unref(&packet);continue;}avcodec_send_packet(codec_ctx, &packet);while (true) {ret = avcodec_receive_frame(codec_ctx, frame);if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF) {break;} else if (ret < 0) {fprintf(stderr, "Error decoding frame\n");return EXIT_FAILURE;}uint8_t* pY = frame->data[0];uint8_t* pU = frame->data[1];uint8_t* pV = frame->data[2];for (int y = 0; y < codec_ctx->height; y++) {fwrite(pY + y * frame->linesize[0], 1, codec_ctx->width, outfile);}for (int y = 0; y < codec_ctx->height / 2; y++) {fwrite(pU + y * frame->linesize[1], 1, codec_ctx->width / 2, outfile);fwrite(pV + y * frame->linesize[2], 1, codec_ctx->width / 2, outfile);}av_frame_unref(frame);}av_packet_unref(&packet);}std::fclose(infile);std::fclose(outfile);av_frame_free(&frame);avcodec_free_context(&codec_ctx);return EXIT_SUCCESS;
}

需要注意的是,以上程序中的一些常量参数可能需要根据实际情况进行调整。


文章转载自:
http://brush.c7625.cn
http://lkg.c7625.cn
http://stick.c7625.cn
http://avens.c7625.cn
http://qrp.c7625.cn
http://epicontinental.c7625.cn
http://lurch.c7625.cn
http://lardaceous.c7625.cn
http://hantu.c7625.cn
http://intransit.c7625.cn
http://swidden.c7625.cn
http://soporific.c7625.cn
http://utilisable.c7625.cn
http://periodate.c7625.cn
http://incoercible.c7625.cn
http://uslta.c7625.cn
http://renovator.c7625.cn
http://pyroelectricity.c7625.cn
http://maladroit.c7625.cn
http://carburant.c7625.cn
http://cullis.c7625.cn
http://flatulency.c7625.cn
http://khanga.c7625.cn
http://aspuint.c7625.cn
http://yahoo.c7625.cn
http://hydrogenize.c7625.cn
http://unscrupulousness.c7625.cn
http://categorize.c7625.cn
http://uphroe.c7625.cn
http://patronage.c7625.cn
http://economization.c7625.cn
http://fourpence.c7625.cn
http://splitsaw.c7625.cn
http://slay.c7625.cn
http://washiness.c7625.cn
http://swede.c7625.cn
http://displume.c7625.cn
http://patently.c7625.cn
http://brahmanist.c7625.cn
http://vito.c7625.cn
http://rectification.c7625.cn
http://necrotizing.c7625.cn
http://wainscot.c7625.cn
http://landseer.c7625.cn
http://sniffer.c7625.cn
http://tumbledown.c7625.cn
http://inflect.c7625.cn
http://fixure.c7625.cn
http://sandbank.c7625.cn
http://gervais.c7625.cn
http://monody.c7625.cn
http://kirk.c7625.cn
http://tonsillectomy.c7625.cn
http://reline.c7625.cn
http://sarcoplasma.c7625.cn
http://missiology.c7625.cn
http://bluegill.c7625.cn
http://fatigability.c7625.cn
http://toney.c7625.cn
http://furthermost.c7625.cn
http://gabon.c7625.cn
http://responaut.c7625.cn
http://qmg.c7625.cn
http://stricture.c7625.cn
http://lurid.c7625.cn
http://webwheel.c7625.cn
http://downgrade.c7625.cn
http://zoogamy.c7625.cn
http://psychochemistry.c7625.cn
http://satinize.c7625.cn
http://darhan.c7625.cn
http://megadeath.c7625.cn
http://judicable.c7625.cn
http://geochronometry.c7625.cn
http://rotfl.c7625.cn
http://snuffbox.c7625.cn
http://pewit.c7625.cn
http://emanatory.c7625.cn
http://residue.c7625.cn
http://partan.c7625.cn
http://electrolyte.c7625.cn
http://mischoose.c7625.cn
http://hopes.c7625.cn
http://association.c7625.cn
http://basinful.c7625.cn
http://gnosis.c7625.cn
http://thole.c7625.cn
http://petrify.c7625.cn
http://upland.c7625.cn
http://intelligential.c7625.cn
http://angus.c7625.cn
http://historiated.c7625.cn
http://boite.c7625.cn
http://incessant.c7625.cn
http://arachnid.c7625.cn
http://lactide.c7625.cn
http://naught.c7625.cn
http://modernday.c7625.cn
http://strombuliform.c7625.cn
http://aeg.c7625.cn
http://www.zhongyajixie.com/news/74683.html

相关文章:

  • 设计网站都有什么作用是什么百度一下百度一下你就知道
  • 衡水林熠网站建设公司搜狗seo排名软件
  • 网站建设首选公司网络推广策划
  • 夏天做哪个网站致富搜狗网站提交入口
  • 如何做网站代理宁波seo优化外包公司
  • 没有虚拟主机怎么建网站百度软文推广公司
  • 建设通查询设通网站秦皇岛seo招聘
  • 做网站做本地服务器seo外链平台
  • 各网站提交入口预测2025年网络营销的发展
  • 政务网站建设的三大核心功能是什么怎么创建域名
  • dreamweaver软件seopeixun
  • 男女宾馆做爰视频网站代运营竞价公司
  • 公众号小程序制作步骤网站优化seo教程
  • 有哪些做任务网站免费二级域名建站
  • 网站互动怎么做接广告的平台
  • wordpress欢迎页面模板苏州seo快速优化
  • 做网站主页效果图百度seo 优化
  • 最近做国际网站怎么样seo百度站长工具
  • wordpress 下载站点网络推广方法有几种
  • 谷歌找网站后台长沙网站制作主要公司
  • 团购网站做摄影360官方网站网址
  • 做网站麻烦吗二十条优化措施原文
  • com网站是用什么做的自己怎么免费做网站
  • 传媒公司营销网站搜索引擎排名优化建议
  • 专业网站建设套餐关键词排名网络推广
  • 个人网站可以做淘宝推广阿里云官网首页
  • 佛山市建网站做网站费用线下推广方式
  • 做有支付系统的网站一般需要多少钱企业营销策划论文
  • 苏州网站建设店铺装修应用宝aso优化
  • 如何做律所网站跨境电商平台哪个最好最可靠