Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stefan Westerfeld
ffmpeg
Commits
c52869f3
Commit
c52869f3
authored
Mar 28, 2024
by
Mark Samuelson
Committed by
Mark Thompson
Apr 02, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/mfenc: expose more properties of the media foundation encoder
parent
2204ea00
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
6 deletions
+32
-6
mf_utils.h
libavcodec/mf_utils.h
+5
-0
mfenc.c
libavcodec/mfenc.c
+27
-6
No files found.
libavcodec/mf_utils.h
View file @
c52869f3
...
...
@@ -97,6 +97,11 @@ DEFINE_GUID(ff_CODECAPI_AVEncH264CABACEnable, 0xee6cad62, 0xd305, 0x4248, 0xa
DEFINE_GUID
(
ff_CODECAPI_AVEncVideoForceKeyFrame
,
0x398c1b98
,
0x8353
,
0x475a
,
0x9e
,
0xf2
,
0x8f
,
0x26
,
0x5d
,
0x26
,
0x3
,
0x45
);
DEFINE_GUID
(
ff_CODECAPI_AVEncMPVDefaultBPictureCount
,
0x8d390aac
,
0xdc5c
,
0x4200
,
0xb5
,
0x7f
,
0x81
,
0x4d
,
0x04
,
0xba
,
0xba
,
0xb2
);
DEFINE_GUID
(
ff_CODECAPI_AVScenarioInfo
,
0xb28a6e64
,
0x3ff9
,
0x446a
,
0x8a
,
0x4b
,
0x0d
,
0x7a
,
0x53
,
0x41
,
0x32
,
0x36
);
DEFINE_GUID
(
ff_CODECAPI_AVEncCommonBufferSize
,
0x0db96574
,
0xb6a4
,
0x4c8b
,
0x81
,
0x06
,
0x37
,
0x73
,
0xde
,
0x03
,
0x10
,
0xcd
);
DEFINE_GUID
(
ff_CODECAPI_AVEncCommonMaxBitRate
,
0x9651eae4
,
0x39b9
,
0x4ebf
,
0x85
,
0xef
,
0xd7
,
0xf4
,
0x44
,
0xec
,
0x74
,
0x65
);
DEFINE_GUID
(
ff_CODECAPI_AVEncCommonQualityVsSpeed
,
0x98332df8
,
0x03cd
,
0x476b
,
0x89
,
0xfa
,
0x3f
,
0x9e
,
0x44
,
0x2d
,
0xec
,
0x9f
);
DEFINE_GUID
(
ff_CODECAPI_AVEncMPVGOPSize
,
0x95f31b26
,
0x95a4
,
0x41aa
,
0x93
,
0x03
,
0x24
,
0x6a
,
0x7f
,
0xc6
,
0xee
,
0xf1
);
DEFINE_GUID
(
ff_CODECAPI_AVEncVideoEncodeQP
,
0x2cb5696b
,
0x23fb
,
0x4ce1
,
0xa0
,
0xf9
,
0xef
,
0x5b
,
0x90
,
0xfd
,
0x55
,
0xca
);
DEFINE_GUID
(
ff_MF_SA_D3D11_BINDFLAGS
,
0xeacf97ad
,
0x065c
,
0x4408
,
0xbe
,
0xe3
,
0xfd
,
0xcb
,
0xfd
,
0x12
,
0x8b
,
0xe2
);
DEFINE_GUID
(
ff_MF_SA_D3D11_USAGE
,
0xe85fe442
,
0x2ca3
,
0x486e
,
0xa9
,
0xc7
,
0x10
,
0x9d
,
0xda
,
0x60
,
0x98
,
0x80
);
...
...
libavcodec/mfenc.c
View file @
c52869f3
...
...
@@ -696,6 +696,21 @@ FF_ENABLE_DEPRECATION_WARNINGS
if
(
c
->
opt_enc_quality
>=
0
)
ICodecAPI_SetValue
(
c
->
codec_api
,
&
ff_CODECAPI_AVEncCommonQuality
,
FF_VAL_VT_UI4
(
c
->
opt_enc_quality
));
if
(
avctx
->
rc_max_rate
>
0
)
ICodecAPI_SetValue
(
c
->
codec_api
,
&
ff_CODECAPI_AVEncCommonMaxBitRate
,
FF_VAL_VT_UI4
(
avctx
->
rc_max_rate
));
if
(
avctx
->
gop_size
>
0
)
ICodecAPI_SetValue
(
c
->
codec_api
,
&
ff_CODECAPI_AVEncMPVGOPSize
,
FF_VAL_VT_UI4
(
avctx
->
gop_size
));
if
(
avctx
->
rc_buffer_size
>
0
)
ICodecAPI_SetValue
(
c
->
codec_api
,
&
ff_CODECAPI_AVEncCommonBufferSize
,
FF_VAL_VT_UI4
(
avctx
->
rc_buffer_size
));
if
(
avctx
->
compression_level
>=
0
)
ICodecAPI_SetValue
(
c
->
codec_api
,
&
ff_CODECAPI_AVEncCommonQualityVsSpeed
,
FF_VAL_VT_UI4
(
avctx
->
compression_level
));
if
(
avctx
->
global_quality
>
0
)
ICodecAPI_SetValue
(
c
->
codec_api
,
&
ff_CODECAPI_AVEncVideoEncodeQP
,
FF_VAL_VT_UI4
(
avctx
->
global_quality
));
// Always set the number of b-frames. Qualcomm's HEVC encoder on SD835
// defaults this to 1, and that setting is buggy with many of the
// rate control modes. (0 or 2 b-frames works fine with most rate
...
...
@@ -1224,7 +1239,7 @@ static int mf_init(AVCodecContext *avctx)
#define OFFSET(x) offsetof(MFContext, x)
#define MF_ENCODER(MEDIATYPE, NAME, ID, OPTS, FMTS, CAPS) \
#define MF_ENCODER(MEDIATYPE, NAME, ID, OPTS, FMTS, CAPS
, DEFAULTS
) \
static const AVClass ff_ ## NAME ## _mf_encoder_class = { \
.class_name = #NAME "_mf", \
.item_name = av_default_item_name, \
...
...
@@ -1244,6 +1259,7 @@ static int mf_init(AVCodecContext *avctx)
FMTS \
CAPS \
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP, \
.defaults = DEFAULTS, \
};
#define AFMTS \
...
...
@@ -1253,9 +1269,9 @@ static int mf_init(AVCodecContext *avctx)
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HYBRID | \
AV_CODEC_CAP_DR1 | AV_CODEC_CAP_VARIABLE_FRAME_SIZE,
MF_ENCODER
(
AUDIO
,
aac
,
AAC
,
NULL
,
AFMTS
,
ACAPS
);
MF_ENCODER
(
AUDIO
,
ac3
,
AC3
,
NULL
,
AFMTS
,
ACAPS
);
MF_ENCODER
(
AUDIO
,
mp3
,
MP3
,
NULL
,
AFMTS
,
ACAPS
);
MF_ENCODER
(
AUDIO
,
aac
,
AAC
,
NULL
,
AFMTS
,
ACAPS
,
NULL
);
MF_ENCODER
(
AUDIO
,
ac3
,
AC3
,
NULL
,
AFMTS
,
ACAPS
,
NULL
);
MF_ENCODER
(
AUDIO
,
mp3
,
MP3
,
NULL
,
AFMTS
,
ACAPS
,
NULL
);
#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
static
const
AVOption
venc_opts
[]
=
{
...
...
@@ -1284,6 +1300,11 @@ static const AVOption venc_opts[] = {
{
NULL
}
};
static
const
FFCodecDefault
defaults
[]
=
{
{
"g"
,
"0"
},
{
NULL
},
};
#define VFMTS \
.p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_NV12, \
AV_PIX_FMT_YUV420P, \
...
...
@@ -1292,5 +1313,5 @@ static const AVOption venc_opts[] = {
.p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HYBRID | \
AV_CODEC_CAP_DR1,
MF_ENCODER
(
VIDEO
,
h264
,
H264
,
venc_opts
,
VFMTS
,
VCAPS
);
MF_ENCODER
(
VIDEO
,
hevc
,
HEVC
,
venc_opts
,
VFMTS
,
VCAPS
);
MF_ENCODER
(
VIDEO
,
h264
,
H264
,
venc_opts
,
VFMTS
,
VCAPS
,
defaults
);
MF_ENCODER
(
VIDEO
,
hevc
,
HEVC
,
venc_opts
,
VFMTS
,
VCAPS
,
defaults
);
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