Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
小白菜888
Ffmpeg
提交
a4208b9b
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,发现更多精彩内容 >>
提交
a4208b9b
编写于
3月 13, 2013
作者:
A
Anton Khirnov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
avconv: add options for reading filtergraphs from a file.
上级
cf53704c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
99 addition
and
8 deletion
+99
-8
Changelog
Changelog
+2
-0
avconv.c
avconv.c
+1
-0
avconv.h
avconv.h
+2
-0
avconv_opt.c
avconv_opt.c
+82
-8
doc/avconv.texi
doc/avconv.texi
+12
-0
未找到文件。
Changelog
浏览文件 @
a4208b9b
...
@@ -7,6 +7,8 @@ version 10:
...
@@ -7,6 +7,8 @@ version 10:
- reference-counting for AVFrame and AVPacket data
- reference-counting for AVFrame and AVPacket data
- avconv now fails when input options are used for output file
- avconv now fails when input options are used for output file
or vice versa
or vice versa
- new avconv options -filter_script and -filter_complex_script, which allow a
filtergraph description to be read from a file
version 9:
version 9:
...
...
avconv.c
浏览文件 @
a4208b9b
...
@@ -160,6 +160,7 @@ static void exit_program(void)
...
@@ -160,6 +160,7 @@ static void exit_program(void)
av_freep
(
&
filtergraphs
[
i
]
->
outputs
[
j
]);
av_freep
(
&
filtergraphs
[
i
]
->
outputs
[
j
]);
}
}
av_freep
(
&
filtergraphs
[
i
]
->
outputs
);
av_freep
(
&
filtergraphs
[
i
]
->
outputs
);
av_freep
(
&
filtergraphs
[
i
]
->
graph_desc
);
av_freep
(
&
filtergraphs
[
i
]);
av_freep
(
&
filtergraphs
[
i
]);
}
}
av_freep
(
&
filtergraphs
);
av_freep
(
&
filtergraphs
);
...
...
avconv.h
浏览文件 @
a4208b9b
...
@@ -158,6 +158,8 @@ typedef struct OptionsContext {
...
@@ -158,6 +158,8 @@ typedef struct OptionsContext {
int
nb_copy_initial_nonkeyframes
;
int
nb_copy_initial_nonkeyframes
;
SpecifierOpt
*
filters
;
SpecifierOpt
*
filters
;
int
nb_filters
;
int
nb_filters
;
SpecifierOpt
*
filter_scripts
;
int
nb_filter_scripts
;
SpecifierOpt
*
pass
;
SpecifierOpt
*
pass
;
int
nb_pass
;
int
nb_pass
;
SpecifierOpt
*
passlogfiles
;
SpecifierOpt
*
passlogfiles
;
...
...
avconv_opt.c
浏览文件 @
a4208b9b
...
@@ -926,6 +926,59 @@ static void parse_matrix_coeffs(uint16_t *dest, const char *str)
...
@@ -926,6 +926,59 @@ static void parse_matrix_coeffs(uint16_t *dest, const char *str)
}
}
}
}
/* read file contents into a string */
static
uint8_t
*
read_file
(
const
char
*
filename
)
{
AVIOContext
*
pb
=
NULL
;
AVIOContext
*
dyn_buf
=
NULL
;
int
ret
=
avio_open
(
&
pb
,
filename
,
AVIO_FLAG_READ
);
uint8_t
buf
[
1024
],
*
str
;
if
(
ret
<
0
)
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"Error opening file %s.
\n
"
,
filename
);
return
NULL
;
}
ret
=
avio_open_dyn_buf
(
&
dyn_buf
);
if
(
ret
<
0
)
{
avio_closep
(
&
pb
);
return
NULL
;
}
while
((
ret
=
avio_read
(
pb
,
buf
,
sizeof
(
buf
)))
>
0
)
avio_write
(
dyn_buf
,
buf
,
ret
);
avio_w8
(
dyn_buf
,
0
);
avio_closep
(
&
pb
);
ret
=
avio_close_dyn_buf
(
dyn_buf
,
&
str
);
if
(
ret
<
0
)
return
NULL
;
return
str
;
}
static
char
*
get_ost_filters
(
OptionsContext
*
o
,
AVFormatContext
*
oc
,
OutputStream
*
ost
)
{
AVStream
*
st
=
ost
->
st
;
char
*
filter
=
NULL
,
*
filter_script
=
NULL
;
MATCH_PER_STREAM_OPT
(
filter_scripts
,
str
,
filter_script
,
oc
,
st
);
MATCH_PER_STREAM_OPT
(
filters
,
str
,
filter
,
oc
,
st
);
if
(
filter_script
&&
filter
)
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"Both -filter and -filter_script set for "
"output stream #%d:%d.
\n
"
,
nb_output_files
,
st
->
index
);
exit
(
1
);
}
if
(
filter_script
)
return
read_file
(
filter_script
);
else
if
(
filter
)
return
av_strdup
(
filter
);
return
av_strdup
(
st
->
codec
->
codec_type
==
AVMEDIA_TYPE_VIDEO
?
"null"
:
"anull"
);
}
static
OutputStream
*
new_video_stream
(
OptionsContext
*
o
,
AVFormatContext
*
oc
)
static
OutputStream
*
new_video_stream
(
OptionsContext
*
o
,
AVFormatContext
*
oc
)
{
{
AVStream
*
st
;
AVStream
*
st
;
...
@@ -941,7 +994,6 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
...
@@ -941,7 +994,6 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
char
*
frame_rate
=
NULL
,
*
frame_size
=
NULL
;
char
*
frame_rate
=
NULL
,
*
frame_size
=
NULL
;
char
*
frame_aspect_ratio
=
NULL
,
*
frame_pix_fmt
=
NULL
;
char
*
frame_aspect_ratio
=
NULL
,
*
frame_pix_fmt
=
NULL
;
char
*
intra_matrix
=
NULL
,
*
inter_matrix
=
NULL
;
char
*
intra_matrix
=
NULL
,
*
inter_matrix
=
NULL
;
const
char
*
filters
=
"null"
;
int
do_pass
=
0
;
int
do_pass
=
0
;
int
i
;
int
i
;
...
@@ -1036,8 +1088,10 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
...
@@ -1036,8 +1088,10 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
ost
->
top_field_first
=
-
1
;
ost
->
top_field_first
=
-
1
;
MATCH_PER_STREAM_OPT
(
top_field_first
,
i
,
ost
->
top_field_first
,
oc
,
st
);
MATCH_PER_STREAM_OPT
(
top_field_first
,
i
,
ost
->
top_field_first
,
oc
,
st
);
MATCH_PER_STREAM_OPT
(
filters
,
str
,
filters
,
oc
,
st
);
ost
->
avfilter
=
av_strdup
(
filters
);
ost
->
avfilter
=
get_ost_filters
(
o
,
oc
,
ost
);
if
(
!
ost
->
avfilter
)
exit
(
1
);
}
else
{
}
else
{
MATCH_PER_STREAM_OPT
(
copy_initial_nonkeyframes
,
i
,
ost
->
copy_initial_nonkeyframes
,
oc
,
st
);
MATCH_PER_STREAM_OPT
(
copy_initial_nonkeyframes
,
i
,
ost
->
copy_initial_nonkeyframes
,
oc
,
st
);
}
}
...
@@ -1059,7 +1113,6 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc)
...
@@ -1059,7 +1113,6 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc)
if
(
!
ost
->
stream_copy
)
{
if
(
!
ost
->
stream_copy
)
{
char
*
sample_fmt
=
NULL
;
char
*
sample_fmt
=
NULL
;
const
char
*
filters
=
"anull"
;
MATCH_PER_STREAM_OPT
(
audio_channels
,
i
,
audio_enc
->
channels
,
oc
,
st
);
MATCH_PER_STREAM_OPT
(
audio_channels
,
i
,
audio_enc
->
channels
,
oc
,
st
);
...
@@ -1072,8 +1125,9 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc)
...
@@ -1072,8 +1125,9 @@ static OutputStream *new_audio_stream(OptionsContext *o, AVFormatContext *oc)
MATCH_PER_STREAM_OPT
(
audio_sample_rate
,
i
,
audio_enc
->
sample_rate
,
oc
,
st
);
MATCH_PER_STREAM_OPT
(
audio_sample_rate
,
i
,
audio_enc
->
sample_rate
,
oc
,
st
);
MATCH_PER_STREAM_OPT
(
filters
,
str
,
filters
,
oc
,
st
);
ost
->
avfilter
=
get_ost_filters
(
o
,
oc
,
ost
);
ost
->
avfilter
=
av_strdup
(
filters
);
if
(
!
ost
->
avfilter
)
exit
(
1
);
}
}
return
ost
;
return
ost
;
...
@@ -1878,8 +1932,24 @@ static int opt_filter_complex(void *optctx, const char *opt, const char *arg)
...
@@ -1878,8 +1932,24 @@ static int opt_filter_complex(void *optctx, const char *opt, const char *arg)
GROW_ARRAY
(
filtergraphs
,
nb_filtergraphs
);
GROW_ARRAY
(
filtergraphs
,
nb_filtergraphs
);
if
(
!
(
filtergraphs
[
nb_filtergraphs
-
1
]
=
av_mallocz
(
sizeof
(
*
filtergraphs
[
0
]))))
if
(
!
(
filtergraphs
[
nb_filtergraphs
-
1
]
=
av_mallocz
(
sizeof
(
*
filtergraphs
[
0
]))))
return
AVERROR
(
ENOMEM
);
return
AVERROR
(
ENOMEM
);
filtergraphs
[
nb_filtergraphs
-
1
]
->
index
=
nb_filtergraphs
-
1
;
filtergraphs
[
nb_filtergraphs
-
1
]
->
index
=
nb_filtergraphs
-
1
;
filtergraphs
[
nb_filtergraphs
-
1
]
->
graph_desc
=
arg
;
filtergraphs
[
nb_filtergraphs
-
1
]
->
graph_desc
=
av_strdup
(
arg
);
if
(
!
filtergraphs
[
nb_filtergraphs
-
1
]
->
graph_desc
)
return
AVERROR
(
ENOMEM
);
return
0
;
}
static
int
opt_filter_complex_script
(
void
*
optctx
,
const
char
*
opt
,
const
char
*
arg
)
{
uint8_t
*
graph_desc
=
read_file
(
arg
);
if
(
!
graph_desc
)
return
AVERROR
(
EINVAL
);
GROW_ARRAY
(
filtergraphs
,
nb_filtergraphs
);
if
(
!
(
filtergraphs
[
nb_filtergraphs
-
1
]
=
av_mallocz
(
sizeof
(
*
filtergraphs
[
0
]))))
return
AVERROR
(
ENOMEM
);
filtergraphs
[
nb_filtergraphs
-
1
]
->
index
=
nb_filtergraphs
-
1
;
filtergraphs
[
nb_filtergraphs
-
1
]
->
graph_desc
=
graph_desc
;
return
0
;
return
0
;
}
}
...
@@ -2138,8 +2208,12 @@ const OptionDef options[] = {
...
@@ -2138,8 +2208,12 @@ const OptionDef options[] = {
"use fixed quality scale (VBR)"
,
"q"
},
"use fixed quality scale (VBR)"
,
"q"
},
{
"filter"
,
HAS_ARG
|
OPT_STRING
|
OPT_SPEC
|
OPT_OUTPUT
,
{
.
off
=
OFFSET
(
filters
)
},
{
"filter"
,
HAS_ARG
|
OPT_STRING
|
OPT_SPEC
|
OPT_OUTPUT
,
{
.
off
=
OFFSET
(
filters
)
},
"set stream filterchain"
,
"filter_list"
},
"set stream filterchain"
,
"filter_list"
},
{
"filter_script"
,
HAS_ARG
|
OPT_STRING
|
OPT_SPEC
|
OPT_OUTPUT
,
{
.
off
=
OFFSET
(
filter_scripts
)
},
"read stream filtergraph description from a file"
,
"filename"
},
{
"filter_complex"
,
HAS_ARG
|
OPT_EXPERT
,
{
.
func_arg
=
opt_filter_complex
},
{
"filter_complex"
,
HAS_ARG
|
OPT_EXPERT
,
{
.
func_arg
=
opt_filter_complex
},
"create a complex filtergraph"
,
"graph_description"
},
"create a complex filtergraph"
,
"graph_description"
},
{
"filter_complex_script"
,
HAS_ARG
|
OPT_EXPERT
,
{
.
func_arg
=
opt_filter_complex_script
},
"read complex filtergraph description from a file"
,
"filename"
},
{
"stats"
,
OPT_BOOL
,
{
&
print_stats
},
{
"stats"
,
OPT_BOOL
,
{
&
print_stats
},
"print progress report during encoding"
,
},
"print progress report during encoding"
,
},
{
"attach"
,
HAS_ARG
|
OPT_PERFILE
|
OPT_EXPERT
|
{
"attach"
,
HAS_ARG
|
OPT_PERFILE
|
OPT_EXPERT
|
...
...
doc/avconv.texi
浏览文件 @
a4208b9b
...
@@ -330,6 +330,12 @@ the stream. Use @code{-filters} to show all the available filters
...
@@ -330,6 +330,12 @@ the stream. Use @code{-filters} to show all the available filters
See also the @option
{
-filter
_
complex
}
option if you want to create filter graphs
See also the @option
{
-filter
_
complex
}
option if you want to create filter graphs
with multiple inputs and/or outputs.
with multiple inputs and/or outputs.
@item -filter
_
script[:@var
{
stream
_
specifier
}
] @var
{
filename
}
(@emph
{
output,per-stream
}
)
This option is similar to @option
{
-filter
}
, the only difference is that its
argument is the name of the file from which a filtergraph description is to be
read.
@item -pre[:@var
{
stream
_
specifier
}
] @var
{
preset
_
name
}
(@emph
{
output,per-stream
}
)
@item -pre[:@var
{
stream
_
specifier
}
] @var
{
preset
_
name
}
(@emph
{
output,per-stream
}
)
Specify the preset for matching stream(s).
Specify the preset for matching stream(s).
...
@@ -823,6 +829,12 @@ To generate 5 seconds of pure red video using lavfi @code{color} source:
...
@@ -823,6 +829,12 @@ To generate 5 seconds of pure red video using lavfi @code{color} source:
@example
@example
avconv -filter
_
complex 'color=red' -t 5 out.mkv
avconv -filter
_
complex 'color=red' -t 5 out.mkv
@end example
@end example
@item -filter
_
complex
_
script @var
{
filename
}
(@emph
{
global
}
)
This option is similar to @option
{
-filter
_
complex
}
, the only difference is that
its argument is the name of the file from which a complex filtergraph
description is to be read.
@end table
@end table
@c man end OPTIONS
@c man end OPTIONS
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录