胡斌

add silence.aac to support for the recording file having video only

set version to 1.0.4
This file is too large to display.
... ... @@ -167,6 +167,13 @@ void merge_audio_pic(fileinfo audio, const char * picfile, const char * destfile
run_shell_cmd(buf);
}
void merge_video_silence(fileinfo video, const char * aacfile, const char * destfile)
{
char buf[2048];
sprintf(buf, "ffmpeg -y -i %s -i %s -shortest %s %s %s", aacfile, video.name.c_str(), acodec_param, vcodec_param, destfile);
run_shell_cmd(buf);
}
void megre_audio_video(fileinfo audio, int nf, fileinfo video, const char * destfile)
{
char buf[2048];
... ... @@ -332,14 +339,18 @@ int process_files(const char * output_dest_file)
int nf = 0;
char destfile[1024];
char blank_pic_file[1024];
char silence_aac_file[1024];
strcpy(blank_pic_file, cfg_path);
strcat(blank_pic_file, "blank.jpg");
strcpy(silence_aac_file, cfg_path);
strcat(silence_aac_file, "silence.aac");
get_duration_from_video_file();
if (filesvideo.size()) {//has video files
if (filesaudio.size()){
for (int i = 0; i < filesaudio.size(); i++){ //
fileinfo audio = filesaudio[i];
float audio_start = audio.start_time;
... ... @@ -436,6 +447,22 @@ int process_files(const char * output_dest_file)
}
}
}
else{//only video
if (filesvideo.size() == 1){
fileinfo video = filesvideo[0];
merge_video_silence(video, silence_aac_file, "dest.ts");
return 0;
}
for (int i = 0; i < filesvideo.size(); i++){
fileinfo video = filesvideo[i];
sprintf(destfile, "%d.ts", nf);
merge_video_silence(video, silence_aac_file, destfile);
merged_files.push_back(destfile);
nf++;
}
}
}
else {//only audio
if (filesaudio.size() == 1){
... ... @@ -526,7 +553,7 @@ void load_codec_param()
int main(int argc, char * argv[])
{
if (argc < 2) {
printf(" merge_av 1.0.3\n");
printf(" merge_av 1.0.4\n");
printf(" run ffmpeg to merge audio and video files according to the record info file,\nusage:");
printf("\n %s record_info_filename [-p] [-k]", argv[0]);
printf("\n -p :only print the command,don't run ffmpeg");
... ...
0.000 750351447_20171221092557104.webm create
0.001 750351447_20171221092557104.webm info width=240 height=180 rotation=0
752.813 750351447_20171221092557104.webm close
... ...