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
胡斌
2019-06-18 20:12:41 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b9dacd01cfb67471e05c5d3fd4213d9e6e3a3781
b9dacd01
1 parent
689f9245
V2.0.10
1.修改一对多布局时,老师视频由多段不同分辨率视频组成时,会出现程序异常的问题 2.一对多布局时,支持对不同分辨率的老师视频进行缩放,统一到相同分辨率
显示空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
64 行增加
和
8 行删除
pip/AVDecoder.cpp
pip/AVTranscoder.cpp
pip/AVTranscoder.h
pip/ReadMe.txt
pip/merge_pip.cpp
pip/AVDecoder.cpp
查看文件 @
b9dacd0
...
...
@@ -57,7 +57,7 @@ int CAVDecoder::add(media_info &info)
_end_time_ms
=
info
.
end_time_ms
;
}
av_log
(
NULL
,
AV_LOG_INFO
,
"CAVDecoder add info:%lf, %
"
PRIu64
"
, %"
PRIu64
", %.3f
\n
"
,
_cur_a_ts_ms
,
_cur_v_ts_ms
,
_end_time_ms
,
info
.
duration
);
av_log
(
NULL
,
AV_LOG_INFO
,
"CAVDecoder add info:%lf, %
lf
, %"
PRIu64
", %.3f
\n
"
,
_cur_a_ts_ms
,
_cur_v_ts_ms
,
_end_time_ms
,
info
.
duration
);
return
0
;
}
...
...
pip/AVTranscoder.cpp
查看文件 @
b9dacd0
...
...
@@ -104,7 +104,10 @@ _one2one_same_size(one2one_same_size)
_pip_width
=
_scaled_height
-
pip_x_reduce
;
//use the scaled height,not the scaled width as pip_width
_pip_height
=
_scaled_height
-
pip_y_reduce
;
_nOutputHeight
=
_teacher_height
+
extent_student_lines
*
(
_pip_height
+
pip_y_gap
)
-
(
part_student
==
0
?
(
pip_y_gap
)
:
0
);
_nOutputHeight
=
_teacher_height
+
extent_student_lines
*
(
_pip_height
+
pip_y_gap
);
if
(
extent_student_lines
>
0
)
{
_nOutputHeight
=
_nOutputHeight
-
(
part_student
==
0
?
(
pip_y_gap
)
:
0
);
}
_nOutputHeight
=
((
_nOutputHeight
+
1
)
/
2
)
*
2
;
int
student_line_width
=
4
*
(
_pip_width
)
+
3
*
pip_x_gap
+
2
*
pip_x_border
;
...
...
@@ -466,17 +469,29 @@ int CAVTranscoder::open_output_file(const char *filename)
CAVDecoder
*
pDecoder
=
decoders_got_frame
[
idxTeacher
];
AVFrame
*
pFrame
=
pDecoder
->
_cur_v_frame
;
if
(
pFrame
)
{
if
(
_teacherFrame
!=
_scaled_frame_teacher
)
{
av_frame_free
(
&
_teacherFrame
);
}
_teacherFrame
=
pFrame
;
pDecoder
->
_cur_v_frame
=
NULL
;
}
}
if
(
_teacherFrame
)
{
if
(
_one2one_same_size
)
{
fill_one2many_scaled_teacher_frame
(
pDstFrame
);
}
else
{
if
(
_nOutputWidth
>
_teacherFrame
->
width
)
{
memset
(
pDstFrame
->
data
[
0
],
_blank_y
,
pDstFrame
->
linesize
[
0
]
*
(
_teacherFrame
->
height
));
memset
(
pDstFrame
->
data
[
1
],
_blank_u
,
pDstFrame
->
linesize
[
1
]
*
(
_teacherFrame
->
height
)
/
2
);
memset
(
pDstFrame
->
data
[
2
],
_blank_v
,
pDstFrame
->
linesize
[
2
]
*
(
_teacherFrame
->
height
)
/
2
);
}
fillDestFrame
(
pDstFrame
,
_teacherFrame
,
0
,
0
);
}
if
(
_nOutputHeight
>
_teacherFrame
->
height
)
{
memset
(
pDstFrame
->
data
[
0
]
+
_teacher_height
*
pDstFrame
->
linesize
[
0
],
_blank_y
,
pDstFrame
->
linesize
[
0
]
*
(
_nOutputHeight
-
_teacherFrame
->
height
));
memset
(
pDstFrame
->
data
[
1
]
+
_teacher_height
/
2
*
pDstFrame
->
linesize
[
1
],
_blank_u
,
pDstFrame
->
linesize
[
1
]
*
(
_nOutputHeight
-
_teacherFrame
->
height
)
/
2
);
memset
(
pDstFrame
->
data
[
2
]
+
_teacher_height
/
2
*
pDstFrame
->
linesize
[
2
],
_blank_v
,
pDstFrame
->
linesize
[
2
]
*
(
_nOutputHeight
-
_teacherFrame
->
height
)
/
2
);
memset
(
pDstFrame
->
data
[
0
]
+
_teacherFrame
->
height
*
pDstFrame
->
linesize
[
0
],
_blank_y
,
pDstFrame
->
linesize
[
0
]
*
(
_nOutputHeight
-
_teacherFrame
->
height
));
memset
(
pDstFrame
->
data
[
1
]
+
_teacherFrame
->
height
/
2
*
pDstFrame
->
linesize
[
1
],
_blank_u
,
pDstFrame
->
linesize
[
1
]
*
(
_nOutputHeight
-
_teacherFrame
->
height
)
/
2
);
memset
(
pDstFrame
->
data
[
2
]
+
_teacherFrame
->
height
/
2
*
pDstFrame
->
linesize
[
2
],
_blank_v
,
pDstFrame
->
linesize
[
2
]
*
(
_nOutputHeight
-
_teacherFrame
->
height
)
/
2
);
}
}
else
...
...
@@ -901,6 +916,42 @@ int CAVTranscoder::open_output_file(const char *filename)
}
}
int
CAVTranscoder
::
fill_one2many_scaled_teacher_frame
(
AVFrame
*
pDstFrame
)
{
if
(
_teacherFrame
->
width
!=
_teacher_width
||
_teacherFrame
->
height
!=
_teacher_height
)
{
if
(
_scaled_frame_teacher
!=
_teacherFrame
)
{
if
(
_src_width_teacher
!=
_teacherFrame
->
width
||
_src_height_teacher
!=
_teacherFrame
->
height
)
{
//init scale context
free_scale_context
(
&
_sws_ctx_teacher
,
&
_scaled_frame_teacher
);
int
scaled_width
,
scaled_height
;
get_scaled_dest_size
(
_teacherFrame
,
_teacher_width
,
_teacher_height
,
&
scaled_width
,
&
scaled_height
);
init_scale_context
(
&
_sws_ctx_teacher
,
&
_scaled_frame_teacher
,
_teacherFrame
->
width
,
_teacherFrame
->
height
,
scaled_width
,
scaled_height
);
_src_width_teacher
=
_teacherFrame
->
width
;
_src_height_teacher
=
_teacherFrame
->
height
;
}
int
h
=
0
;
h
=
sws_scale
(
_sws_ctx_teacher
,
_teacherFrame
->
data
,
_teacherFrame
->
linesize
,
0
,
_teacherFrame
->
height
,
_scaled_frame_teacher
->
data
,
_scaled_frame_teacher
->
linesize
);
_scaled_frame_teacher
->
pkt_dts
=
_teacherFrame
->
pkt_dts
;
//pass rotation
av_frame_free
(
&
_teacherFrame
);
_teacherFrame
=
_scaled_frame_teacher
;
}
}
if
(
_nOutputWidth
>
_teacherFrame
->
width
)
{
memset
(
pDstFrame
->
data
[
0
],
_blank_y
,
pDstFrame
->
linesize
[
0
]
*
(
_teacherFrame
->
height
));
memset
(
pDstFrame
->
data
[
1
],
_blank_u
,
pDstFrame
->
linesize
[
1
]
*
(
_teacherFrame
->
height
)
/
2
);
memset
(
pDstFrame
->
data
[
2
],
_blank_v
,
pDstFrame
->
linesize
[
2
]
*
(
_teacherFrame
->
height
)
/
2
);
}
fillDestFrame
(
pDstFrame
,
_teacherFrame
,
0
,
0
);
return
0
;
}
int
CAVTranscoder
::
mix_and_output_one2one_vframe
(
vector
<
CAVDecoder
*>
&
decoders_got_frame
)
{
//prepare one2one base frame
...
...
pip/AVTranscoder.h
查看文件 @
b9dacd0
...
...
@@ -81,5 +81,6 @@ private:
int
scale_fill_one2one_studentframe
(
AVFrame
*
pDstFrame
,
int
y
);
int
fill_one2one_student_frame
(
AVFrame
*
pDstFrame
,
int
y
);
void
get_scaled_dest_size
(
AVFrame
*
pFrame
,
int
dest_width
,
int
dest_height
,
int
*
scaled_width
,
int
*
scaled_height
);
int
fill_one2many_scaled_teacher_frame
(
AVFrame
*
pDstFrame
);
};
...
...
pip/ReadMe.txt
查看文件 @
b9dacd0
...
...
@@ -46,8 +46,8 @@ merge_pip_codec.cfg主要编码参数:
#音频码率
a_bit_rate = 64000
-s 为可选参数,在一对一布局下起作用。缺省为1
1 如果老师和学生的视频大小不一致,会放大较小的视频使得老师和学生视频大小相同。
-s 为可选参数。缺省为1
1 在一对一时, 如果老师和学生的视频大小不一致,会放大较小的视频使得老师和学生视频大小相同。在一对多时,如果老师视频由多段不同分辨率视频组成,会对老师视频进行缩放统一
0 保持原有视频大小
合屏后生成完成信息文件,文件名为"m_" + 输入文件名" + ".txt",合成的mp4文件名为"m_" + 输入文件名" + ".mp4"
...
...
@@ -91,3 +91,7 @@ V2.0.8
V2.0.9
1.忽略录像信息文件里在视频文件关闭后设置视频旋转角度的情况,避免视频旋转角度错误
V2.0.10
1.修改一对多布局时,老师视频由多段不同分辨率视频组成时,会出现程序异常的问题
2.一对多布局时,支持对不同分辨率的老师视频进行缩放,统一到相同分辨率
\ No newline at end of file
...
...
pip/merge_pip.cpp
查看文件 @
b9dacd0
...
...
@@ -1216,7 +1216,7 @@ int process_av_files(char * record_info, int piptype, bool one2one_same_size, in
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
<
2
)
{
printf
(
" merge_pip 2.0.
9
\n
"
);
printf
(
" merge_pip 2.0.
10
\n
"
);
printf
(
" merge video files to one pip video according to record info file,
\n
usage:"
);
printf
(
"
\n
%s record_info_filename [-t {0,1,2}] [-c codec.cfg] [-s {1,0}]"
,
argv
[
0
]);
printf
(
"
\n\n
"
);
...
...
请
注册
或
登录
后发表评论