合并两个yuv文件的C++代码
Posted lakeone
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了合并两个yuv文件的C++代码相关的知识,希望对你有一定的参考价值。
//将BasketballPass_416x240_50.yuv序列的前50帧和BlowingBubbles_416x240_50.yuv序列的前250帧合并成out.yuv
//参数配置416 240 50 BasketballPass_416x240_50.yuv 416 240 250 BlowingBubbles_416x240_50.yuv out.yuv
#include <iostream> #include <fstream> using namespace std; //参数配置416 240 50 BasketballPass_416x240_50.yuv 416 240 250 BlowingBubbles_416x240_50.yuv out.yuv int main(int argc, char *argv[]) { ifstream fin; fin.open(argv[4], std::ifstream::binary); int width = atoi(argv[1]); int height = atoi(argv[2]); int frames = atoi(argv[3]); int num = width * height * frames * 1.5; ofstream fout; fout.open(argv[9], std::ofstream::binary); char* buf = new char[num]; fin.read(buf, num); fout.write(buf, num); fin.close(); delete []buf; fin.open(argv[8], std::ifstream::binary); width = atoi(argv[5]); height = atoi(argv[6]); frames = atoi(argv[7]); num = width * height * frames * 1.5; buf = new char[num]; fin.read(buf, num); fout.write(buf, num); fin.close(); delete []buf; fout.close(); cout << "Done!" << endl; getchar(); return 0; }
以上是关于合并两个yuv文件的C++代码的主要内容,如果未能解决你的问题,请参考以下文章
我的Android进阶之旅NDK开发之在C++代码中使用Android Log打印日志,打印出C++的函数耗时以及代码片段耗时详情
C++ YUV420文件读取与显示,绘制矩形框,绘制线段(绘制直线),绘制多边形(常用YUV数据格式——YUV420P中的YU12与YUV420SP中的NV21)