std::string ffmpeg_path = "C:\\fmpeg.exe ", directory = "";
void saveSequential(std::string filename, Image *movie, int movie_size)
{
std::stringstream command;
char buf[256];
for(int i=0; i<movie_size; i++) {
memset(buf, 0, 256);
sprintf(buf, "snap%04d.png\0", i+1);
movie[i]->save(directory+"/ScreenShots/"+buf);
}
command << ffmpeg_path << " -r 60 -y -i cap\\cap%04d.png -vcodec msmpeg4 " << filename;
const char *lpArg = command.str().c_str();
PROCESS_INFORMATION pi;
STARTUPINFO si;
ZeroMemory(&si,sizeof(si));
si.cb=sizeof(si);
CreateProcess(NULL,(LPTSTR)lpArg,NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,NULL,NULL,&si, &pi);
CloseHandle(pi.hThread);
WaitForSingleObject(pi.hProcess,INFINITE);
CloseHandle(pi.hProcess);
clear();
saved = true;
return *this;
}
キーワード:
参照: