Add m4s-to-mp4 source

This commit is contained in:
daleclack 2021-03-14 21:55:02 +08:00
parent 7bda66e6e3
commit 061faa2006
1 changed files with 36 additions and 0 deletions

36
cpp/m4s_to_mp4.cpp Normal file
View File

@ -0,0 +1,36 @@
#include <cstdio>
#include <thread>
#include <cstring>
#include <cstdlib>
void clear(char str[]){
if(strlen(str)==0) return;
int i=0;
while(str[i]!='\n'){
i++;
}
str[i]='\0';
}
int main(int argc,char *argv[]){
char command[10000],filename1[1000],filename2[1000],output[1000];
printf("Input file1 name:");
fflush(stdin);
fgets(filename1,sizeof(filename1),stdin);
clear(filename1);
printf("Input file2 name:");
fflush(stdin);
fgets(filename2,sizeof(filename2),stdin);
clear(filename2);
printf("Input output name:");
fflush(stdin);
fgets(output,sizeof(output),stdin);
clear(output);
//printf("%s\n%s",filename1,filename2);
sprintf(command,"ffmpeg -i \"%s\" -i \"%s\" -codec copy \"%s\"",filename1,filename2,output);
//printf("%s",command);
std::thread first (system,command);
first.detach();
getchar();
return 0;
}