Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
9087eaf1
F
Ffmpeg
项目概览
小白菜888
/
Ffmpeg
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Ffmpeg
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
9087eaf1
编写于
2月 25, 2013
作者:
A
Anton Khirnov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vf_overlay: switch to an AVOptions-based system.
上级
20b46f8f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
36 addition
and
22 deletion
+36
-22
doc/filters.texi
doc/filters.texi
+15
-7
libavfilter/vf_overlay.c
libavfilter/vf_overlay.c
+21
-15
未找到文件。
doc/filters.texi
浏览文件 @
9087eaf1
...
...
@@ -1485,11 +1485,19 @@ Overlay one video on top of another.
It takes two inputs and one output, the first input is the "main"
video on which the second input is overlayed.
It accepts the parameters: @var{x}:@var{y}.
This filter accepts the following parameters:
@table @option
@item x
The horizontal position of the left edge of the overlaid video on the main video.
@item y
The vertical position of the top edge of the overlaid video on the main video.
@end table
@var{x} is the x coordinate of the overlayed video on the main video,
@var{y} is the y coordinate. The parameters are expressions containing
the following parameters:
The parameters are expressions containing the following parameters:
@table @option
@item main_w, main_h
...
...
@@ -1515,15 +1523,15 @@ Follow some examples:
@example
# draw the overlay at 10 pixels from the bottom right
# corner of the main video.
overlay=
main_w-overlay_w-10:
main_h-overlay_h-10
overlay=
x=main_w-overlay_w-10:y=
main_h-overlay_h-10
# insert a transparent PNG logo in the bottom left corner of the input
avconv -i input -i logo -filter_complex 'overlay=
10:
main_h-overlay_h-10' output
avconv -i input -i logo -filter_complex 'overlay=
x=10:y=
main_h-overlay_h-10' output
# insert 2 different transparent PNG logos (second logo on bottom
# right corner):
avconv -i input -i logo1 -i logo2 -filter_complex
'overlay=
10:H-h-10,overlay=W-w-10:
H-h-10' output
'overlay=
x=10:y=H-h-10,overlay=x=W-w-10:y=
H-h-10' output
# add a transparent color layer on top of the main video,
# WxH specifies the size of the main input to the overlay filter
...
...
libavfilter/vf_overlay.c
浏览文件 @
9087eaf1
...
...
@@ -34,6 +34,7 @@
#include "libavutil/pixdesc.h"
#include "libavutil/imgutils.h"
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "internal.h"
#include "video.h"
...
...
@@ -63,30 +64,18 @@ enum var_name {
#define OVERLAY 1
typedef
struct
{
const
AVClass
*
class
;
int
x
,
y
;
///< position of overlayed picture
int
max_plane_step
[
4
];
///< steps per pixel for each plane
int
hsub
,
vsub
;
///< chroma subsampling values
char
x_expr
[
256
],
y_expr
[
256
]
;
char
*
x_expr
,
*
y_expr
;
AVFrame
*
main
;
AVFrame
*
over_prev
,
*
over_next
;
}
OverlayContext
;
static
av_cold
int
init
(
AVFilterContext
*
ctx
,
const
char
*
args
)
{
OverlayContext
*
over
=
ctx
->
priv
;
av_strlcpy
(
over
->
x_expr
,
"0"
,
sizeof
(
over
->
x_expr
));
av_strlcpy
(
over
->
y_expr
,
"0"
,
sizeof
(
over
->
y_expr
));
if
(
args
)
sscanf
(
args
,
"%255[^:]:%255[^:]"
,
over
->
x_expr
,
over
->
y_expr
);
return
0
;
}
static
av_cold
void
uninit
(
AVFilterContext
*
ctx
)
{
OverlayContext
*
s
=
ctx
->
priv
;
...
...
@@ -358,6 +347,23 @@ static int request_frame(AVFilterLink *outlink)
return
output_frame
(
ctx
);
}
#define OFFSET(x) offsetof(OverlayContext, x)
#define FLAGS AV_OPT_FLAG_VIDEO_PARAM
static
const
AVOption
options
[]
=
{
{
"x"
,
"Horizontal position of the left edge of the overlaid video on the "
"main video."
,
OFFSET
(
x_expr
),
AV_OPT_TYPE_STRING
,
{
.
str
=
"0"
},
.
flags
=
FLAGS
},
{
"y"
,
"Vertical position of the top edge of the overlaid video on the "
"main video."
,
OFFSET
(
y_expr
),
AV_OPT_TYPE_STRING
,
{
.
str
=
"0"
},
.
flags
=
FLAGS
},
{
NULL
},
};
static
const
AVClass
overlay_class
=
{
.
class_name
=
"overlay"
,
.
item_name
=
av_default_item_name
,
.
option
=
options
,
.
version
=
LIBAVUTIL_VERSION_INT
,
};
static
const
AVFilterPad
avfilter_vf_overlay_inputs
[]
=
{
{
.
name
=
"main"
,
...
...
@@ -391,10 +397,10 @@ AVFilter avfilter_vf_overlay = {
.
name
=
"overlay"
,
.
description
=
NULL_IF_CONFIG_SMALL
(
"Overlay a video source on top of the input."
),
.
init
=
init
,
.
uninit
=
uninit
,
.
priv_size
=
sizeof
(
OverlayContext
),
.
priv_class
=
&
overlay_class
,
.
query_formats
=
query_formats
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录