Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
merge_av
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
胡斌
2018-11-15 21:15:53 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d06ae0fb736c4668dbf327ef0f331c3bec4f917f
d06ae0fb
1 parent
04e7b37e
modify the pip layout,if both teacher and student has video ,teacher at lop,and student at bottom
显示空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
30 行增加
和
4 行删除
pip/merge_pip.cpp
pip/merge_pip.cpp
查看文件 @
d06ae0f
...
...
@@ -105,13 +105,16 @@ void get_config_path(){
const
char
*
default_vcodec_param
=
"-vcodec libx264 -level 3.1 -preset veryfast -g 100 -r 20 -bf 0 -vsync cfr"
;
const
char
*
default_acodec_param
=
"-acodec copy"
;
const
char
*
default_av_codec_param
=
"-acodec aac -vcodec libx264 -level 3.1 -preset veryfast -g 100 -r 20 -bf 0 -vsync cfr"
;
const
char
*
default_pip_param
=
"-filter_complex
\"
[1:v]scale=w=96:h=72:force_original_aspect_ratio=decrease[b];[0:v][b]overlay=x=0:y=0
\"
-filter_complex amix=inputs=2:duration=first:dropout_transition=2,volume=1"
;
//const char * default_pip_param = "-filter_complex \"[1:v]scale=w=96:h=72:force_original_aspect_ratio=decrease[b];[0:v][b]overlay=x=0:y=0\" -filter_complex amix=inputs=2:duration=first:dropout_transition=2,volume=1";
const
char
*
default_pip_param
=
"-filter_complex
\"
[1:v]scale=w=320:h=240:force_original_aspect_ratio=decrease[b];[0:v]scale=w=320:h=240,pad=320:480:0:0:#165a82[c],[c][b]overlay=x=0:y=240
\"
-filter_complex amix=inputs=2:duration=first:dropout_transition=2,volume=1"
;
const
char
*
default_pip1_param
=
" -filter_complex
\"
scale=w=320:h=240,pad=320:480:0:0:#165a82
\"
-vcodec libx264 -level 3.1 -preset veryfast -g 100 -r 20 -bf 0 -vsync cfr -acodec copy"
;
char
av_codec_param
[
1024
];
char
vcodec_param
[
1024
];
char
acodec_param
[
1024
];
char
pip_param
[
1024
];
char
pip1_param
[
1024
];
bool
first_time_set
=
false
;
float
start_time
=
0.0
f
;
...
...
@@ -199,6 +202,20 @@ void split_av(const char * mediafile, float start, float duration, char * destfi
run_shell_cmd
(
buf
);
}
void
split_av_for_1pip
(
const
char
*
mediafile
,
float
start
,
float
duration
,
char
*
destfile
)
{
char
buf
[
2048
];
sprintf
(
buf
,
"ffmpeg -y -i %s -ss %.3f -t %.3f %s %s"
,
mediafile
,
start
,
duration
,
pip1_param
,
destfile
);
run_shell_cmd
(
buf
);
}
void
transcode_to_1pip
(
const
char
*
mediafile
,
char
*
destfile
)
{
char
buf
[
2048
];
sprintf
(
buf
,
"ffmpeg -y -i %s %s %s"
,
mediafile
,
pip1_param
,
destfile
);
run_shell_cmd
(
buf
);
}
void
get_video_first_frame_jpeg
(
const
char
*
video
,
const
char
*
destfile
)
{
char
buf
[
2048
];
...
...
@@ -766,11 +783,13 @@ int transcode_file(vector<media_info> files)
if
(
video
.
type_time
-
video
.
start_time
>
0.10
||
video_end
.
end_time
-
video_end
.
type_time
>
0.10
)
{
sprintf
(
video_file
,
"%d_%s"
,
nf
,
video
.
name
.
c_str
());
split_av
(
video
.
name
.
c_str
(),
video
.
type_time
-
video
.
start_time
,
video_end
.
type_time
-
video
.
type_time
,
video_file
);
split_av
_for_1pip
(
video
.
name
.
c_str
(),
video
.
type_time
-
video
.
start_time
,
video_end
.
type_time
-
video
.
type_time
,
video_file
);
tmp_files
.
push_back
(
video_file
);
}
else
{
strcpy
(
video_file
,
video
.
name
.
c_str
());
sprintf
(
video_file
,
"%d_%s"
,
nf
,
video
.
name
.
c_str
());
transcode_to_1pip
(
video
.
name
.
c_str
(),
video_file
);
tmp_files
.
push_back
(
video_file
);
}
merged_files
.
push_back
(
video_file
);
...
...
@@ -1429,6 +1448,7 @@ void load_codec_param()
strcpy
(
vcodec_param
,
default_vcodec_param
);
strcpy
(
av_codec_param
,
default_av_codec_param
);
strcpy
(
pip_param
,
default_pip_param
);
strcpy
(
pip1_param
,
default_pip1_param
);
char
cfgfile
[
1024
];
...
...
@@ -1462,9 +1482,15 @@ void load_codec_param()
str
[
0
]
=
0
;
if
(
fin
.
getline
(
str
,
LINE_LENGTH
))
{
printf
(
"load
av
codec from %s: %s
\n
"
,
cfgfile
,
str
);
printf
(
"load
pip
codec from %s: %s
\n
"
,
cfgfile
,
str
);
strcpy
(
pip_param
,
str
);
}
str
[
0
]
=
0
;
if
(
fin
.
getline
(
str
,
LINE_LENGTH
))
{
printf
(
"load pip1 codec from %s: %s
\n
"
,
cfgfile
,
str
);
strcpy
(
pip1_param
,
str
);
}
}
void
get_outinfo_file_name
(
char
*
input1
,
char
*
input2
)
...
...
请
注册
或
登录
后发表评论