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-12-19 20:49:32 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
85a1de676e8f2a03541642f87e2e9d6e6d0531a2
85a1de67
1 parent
4addd60f
set the encode parameter ultrafast
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
8 行增加
和
8 行删除
pip/AVTranscoder.cpp
pip/AVTranscoder.cpp
查看文件 @
85a1de6
...
...
@@ -216,7 +216,7 @@ int CAVTranscoder::open_output_file(const char *filename)
enc_ctx
->
flags
|=
CODEC_FLAG_GLOBAL_HEADER
;
if
(
0
==
i
)
{
encoder
=
avcodec_find_encoder
(
AV_CODEC_ID_H264
);
;
encoder
=
avcodec_find_encoder
(
AV_CODEC_ID_H264
);
if
(
!
encoder
)
{
av_log
(
NULL
,
AV_LOG_FATAL
,
"Necessary encoder not found
\n
"
);
return
AVERROR_INVALIDDATA
;
...
...
@@ -235,21 +235,21 @@ int CAVTranscoder::open_output_file(const char *filename)
enc_ctx
->
time_base
.
num
=
1
;
enc_ctx
->
time_base
.
den
=
20
;
enc_ctx
->
gop_size
=
20
;
enc_ctx
->
me_range
=
16
;
enc_ctx
->
max_qdiff
=
4
;
enc_ctx
->
qmin
=
10
;
enc_ctx
->
qmax
=
30
;
enc_ctx
->
qcompress
=
0.6
f
;
enc_ctx
->
framerate
.
den
=
20
;
enc_ctx
->
framerate
.
num
=
1
;
enc_ctx
->
max_b_frames
=
0
;
AVDictionary
*
d
=
NULL
;
char
*
k
=
av_strdup
(
"preset"
);
// if your strings are already allocated,
char
*
v
=
av_strdup
(
"ultrafast"
);
// you can avoid copying them like this
av_dict_set
(
&
d
,
k
,
v
,
AV_DICT_DONT_STRDUP_KEY
|
AV_DICT_DONT_STRDUP_VAL
);
/* Third parameter can be used to pass settings to encoder */
ret
=
avcodec_open2
(
enc_ctx
,
encoder
,
NULL
);
AVDictionary
*
d
=
NULL
;
av_dict_set
(
&
d
,
"preset"
,
"ultrafast"
,
0
);
/* Third parameter can be used to pass settings to encoder */
ret
=
avcodec_open2
(
enc_ctx
,
encoder
,
&
d
);
if
(
ret
<
0
)
{
av_log
(
NULL
,
AV_LOG_ERROR
,
"Cannot open video encoder for stream #%u
\n
"
,
i
);
return
ret
;
...
...
请
注册
或
登录
后发表评论