Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
d617e77c
Commit
d617e77c
authored
Feb 17, 2015
by
Derek Buitenhuis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libx265: Add crf private option
Signed-off-by:
Derek Buitenhuis
<
derek.buitenhuis@gmail.com
>
parent
2de887e4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
libx265.c
libavcodec/libx265.c
+12
-1
No files found.
libavcodec/libx265.c
View file @
d617e77c
...
...
@@ -25,6 +25,7 @@
#endif
#include <x265.h>
#include <float.h>
#include "libavutil/internal.h"
#include "libavutil/common.h"
...
...
@@ -39,6 +40,7 @@ typedef struct libx265Context {
x265_encoder
*
encoder
;
x265_param
*
params
;
float
crf
;
char
*
preset
;
char
*
tune
;
char
*
x265_opts
;
...
...
@@ -138,7 +140,15 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
break
;
}
if
(
avctx
->
bit_rate
>
0
)
{
if
(
ctx
->
crf
>=
0
)
{
char
crf
[
6
];
snprintf
(
crf
,
sizeof
(
crf
),
"%2.2f"
,
ctx
->
crf
);
if
(
x265_param_parse
(
ctx
->
params
,
"crf"
,
crf
)
==
X265_PARAM_BAD_VALUE
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid crf: %2.2f.
\n
"
,
ctx
->
crf
);
return
AVERROR
(
EINVAL
);
}
}
else
if
(
avctx
->
bit_rate
>
0
)
{
ctx
->
params
->
rc
.
bitrate
=
avctx
->
bit_rate
/
1000
;
ctx
->
params
->
rc
.
rateControlMode
=
X265_RC_ABR
;
}
...
...
@@ -294,6 +304,7 @@ static av_cold void libx265_encode_init_csp(AVCodec *codec)
#define OFFSET(x) offsetof(libx265Context, x)
#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
static
const
AVOption
options
[]
=
{
{
"crf"
,
"set the x265 crf"
,
OFFSET
(
crf
),
AV_OPT_TYPE_FLOAT
,
{
.
dbl
=
-
1
},
-
1
,
FLT_MAX
,
VE
},
{
"preset"
,
"set the x265 preset"
,
OFFSET
(
preset
),
AV_OPT_TYPE_STRING
,
{
0
},
0
,
0
,
VE
},
{
"tune"
,
"set the x265 tune parameter"
,
OFFSET
(
tune
),
AV_OPT_TYPE_STRING
,
{
0
},
0
,
0
,
VE
},
{
"x265-params"
,
"set the x265 configuration using a :-separated list of key=value parameters"
,
OFFSET
(
x265_opts
),
AV_OPT_TYPE_STRING
,
{
0
},
0
,
0
,
VE
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment