博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
OpenCV视频编码器参数修改
阅读量:4200 次
发布时间:2019-05-26

本文共 1172 字,大约阅读时间需要 3 分钟。

OpenCV版本

  • OpenCV 4.1.2

视频编码

  • h264视频编码参考代码,outputVideo.write(frame) 需要有视频raw数据;
#include 
#include
int main(){ // init cv::VideoWriter outputVideo; cv::Size S = cv::Size(width_output, height_output); int fourcc = cv::VideoWriter::fourcc('H','2','6','4'); int fps = 25; outputVideo.open(output_file, fourcc, fps, S); // write frame outputVideo.write(frame); // deinit outputVideo.release(); return 0; }

h264视频编码参数调整

  • 修改文件 master/modules/videoio/src/cap_ffmpeg_impl.hpp
#if LIBAVUTIL_BUILD > CALC_FFMPEG_VERSION(51,11,0)    /* Some settings for libx264 encoding, restore dummy values for gop_size     and qmin since they will be set to reasonable defaults by the libx264     preset system. Also, use a crf encode with the default quality rating,     this seems easier than finding an appropriate default bitrate. */    if (c->codec_id == AV_CODEC_ID_H264) {      c->gop_size = -1;      c->qmin = -1;      c->bit_rate = 0;      if (c->priv_data)          av_opt_set(c->priv_data,"crf","21", 0);          av_opt_set(c->priv_data,"preset","faster", 0);    }#endif

上面的代码,修改了crf参数,23修改为21

添加了preset参数的设置;
大家可以参考一下

转载地址:http://bmfli.baihongyu.com/

你可能感兴趣的文章
做培训讲师就像做一名导演
查看>>
深圳51testing笔架山一日游
查看>>
《Scrum精髓》审校后记:关于Acceptance Test
查看>>
在DataTable中如何保留数据格式?
查看>>
国产APP自动化测试工具AndroidRobot下载地址
查看>>
QTP与手机测试
查看>>
在QTP中自定义测试对象WinList的Select方法
查看>>
QTP & DOM
查看>>
《TestComplete Made Easy》读书笔记
查看>>
LoadRunner如何在脚本运行时修改log设置选项?
查看>>
QC数据库表结构
查看>>
自动化测试工具的3个关键部分
查看>>
测试工具厂商的编程语言什么时候“退休”?
查看>>
QTP中为什么恢复场景(Recovery Scenario)没有被触发?
查看>>
资源监控工具 - Hyperic HQ
查看>>
LoadRunner中Concurrent与Simultaneous的区别
查看>>
SiteScope - Agentless监控
查看>>
QTP的智能识别(Smart Identification)过程
查看>>
LoadRunner各协议所需耗费的内存资源表
查看>>
AutomatedQA收购Smart Bear?
查看>>