Skip to content

Commit 5afa001

Browse files
committed
vcomp/lavc: hevc_videotoolbox: enforce rext profile
Otherwise encoding 4:2:0 will be used by the encoder - if not specified, the default profile is Main10, which is 4:2:0. The only option to get 4:2:2 is to use AV_PROFILE_HEVC_REXT. Only remaining is Main, which isn't suitable neither for UYVY if we don't want to reduce subsampling.
1 parent cb73002 commit 5afa001

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/video_compress/libavcodec.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2004,6 +2004,17 @@ static void configure_qsv_h264_hevc(AVCodecContext *codec_ctx, struct setparam_p
20042004
}
20052005
}
20062006

2007+
static void
2008+
configure_videotoolbox_hevc(AVCodecContext * /*codec_ctx*/,
2009+
struct setparam_param *param)
2010+
{
2011+
if (param->lavc_opts.find("profile") == param->lavc_opts.end()) {
2012+
// enforce AV_PROFILE_HEVC_REXT, otherwise we will get Main10
2013+
// profile (10-bit 4:2:0) - even for UYVY
2014+
param->lavc_opts["profile"] = "rext";
2015+
}
2016+
}
2017+
20072018
static void configure_vaapi(AVCodecContext * /* codec_ctx */, struct setparam_param *param) {
20082019
param->thread_mode = "no"; // VA-API doesn't support threads
20092020
// interesting options: "b_depth" (not used - we are not using B-frames), "idr_interval" - set to 0 by default
@@ -2216,6 +2227,8 @@ static void setparam_h264_h265_av1(AVCodecContext *codec_ctx, struct setparam_pa
22162227
} else if (strcmp(codec_ctx->codec->name, "h264_qsv") == 0 ||
22172228
strcmp(codec_ctx->codec->name, "hevc_qsv") == 0) {
22182229
configure_qsv_h264_hevc(codec_ctx, param);
2230+
} else if (strcmp(codec_ctx->codec->name, "hevc_videotoolbox") == 0) {
2231+
configure_videotoolbox_hevc(codec_ctx, param);
22192232
} else if (strcmp(codec_ctx->codec->name, "libaom-av1") == 0) {
22202233
configure_aom_av1(codec_ctx, param);
22212234
} else if (strcmp(codec_ctx->codec->name, "librav1e") == 0) {

0 commit comments

Comments
 (0)