📄 makeemptyavi.cc
字号:
const char *help = "\progname: makeemptyavi.cc\n\code2html: This program makes an empty video with a given color.\n\version: Torch3 vision2.0, 2005\n\(c) Sebastien Marcel (marcel@idiap.ch)\n";#include "ImageRgb.h"#include "ffmpegVideoFile.h"#include "CmdLine.h"using namespace Torch;int main(int argc, char **argv){ int width; int height; int nframes; int fps; int bitrate; char *output_filename; bool verbose; char *color_name; // Construct the command line CmdLine cmd; cmd.setBOption("write log", false); // Put the help line at the beginning cmd.info(help); cmd.addText("\nArguments:"); cmd.addICmdArg("width", &width, "width"); cmd.addICmdArg("height", &height, "height"); cmd.addText("\nOptions:"); cmd.addSCmdOption("-colorname", &color_name, "white", "color name"); cmd.addBCmdOption("-verbose", &verbose, false, "verbose"); cmd.addICmdOption("-nframes", &nframes, 25, "number of frames"); cmd.addICmdOption("-fps", &fps, 25, "frame rate"); cmd.addICmdOption("-bitrate", &bitrate, 1000000, "bitrate for encoding"); cmd.addSCmdOption("-o", &output_filename, "output.avi", "verbose"); cmd.read(argc, argv); VideoFile *video = NULL; video = new ffmpegVideoFile(); video->open(output_filename, "w"); video->setIOption("width", width); video->setIOption("height", height); video->setROption("framerate", fps); video->setIOption("bitrate", bitrate); Color *color = new Color(color_name); Image *image = new ImageRgb(width, height); for(int i = 0 ; i < nframes ; i++) { for(int j = 0 ; j < width * height ; j++) { image->pixmap[j*3] = color->data0; image->pixmap[j*3+1] = color->data1; image->pixmap[j*3+2] = color->data2; } video->write(image->pixmap); real percent = 100.0 * (i+1) / nframes; print("%03d%\r", (int) percent); } print("\n"); video->close(); delete image; delete color; delete video; return(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -