PR #23498 opened by ArazIusubov
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23498
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23498.patch

Expose the high_quality preset in AMF encoders.

The AMF H264 and HEVC encoder implementation currently exposes only the speed, 
balanced and quality presets. 
Add support for the high_quality preset and update the allowed preset range 
accordingly.


>From a83937e734767a749509173d59c9300d4b33e4fb Mon Sep 17 00:00:00 2001
From: Araz Iusubov <[email protected]>
Date: Mon, 15 Jun 2026 18:32:11 +0200
Subject: [PATCH] avcodec/amfenc: add high_quality quality preset

---
 libavcodec/amfenc_h264.c | 5 +++--
 libavcodec/amfenc_hevc.c | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
index edd18167a9..650a9bc7e9 100644
--- a/libavcodec/amfenc_h264.c
+++ b/libavcodec/amfenc_h264.c
@@ -73,11 +73,12 @@ static const AVOption options[] = {
     { "latency",        "enables low latency mode", OFFSET(latency), 
AV_OPT_TYPE_BOOL, {.i64 = -1 },  -1, 1, VE },
 
     /// Quality Preset
-    { "quality",        "Set the encoding quality preset",  OFFSET(quality),   
 AV_OPT_TYPE_INT,   { .i64 = -1 }, -1, 
AMF_VIDEO_ENCODER_QUALITY_PRESET_QUALITY, VE, .unit = "quality" },
-    { "preset",         "Set the encoding quality preset",  OFFSET(quality),   
 AV_OPT_TYPE_INT,   { .i64 = -1 }, -1, 
AMF_VIDEO_ENCODER_QUALITY_PRESET_QUALITY, VE, .unit = "quality" },
+    { "quality",        "Set the encoding quality preset",  OFFSET(quality),   
 AV_OPT_TYPE_INT,   { .i64 = -1 }, -1, 
AMF_VIDEO_ENCODER_QUALITY_PRESET_HIGH_QUALITY, VE, .unit = "quality" },
+    { "preset",         "Set the encoding quality preset",  OFFSET(quality),   
 AV_OPT_TYPE_INT,   { .i64 = -1 }, -1, 
AMF_VIDEO_ENCODER_QUALITY_PRESET_HIGH_QUALITY, VE, .unit = "quality" },
     { "balanced",       "Balanced",                         0,                 
 AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_QUALITY_PRESET_BALANCED },    0, 
0, VE, .unit = "quality" },
     { "speed",          "Prefer Speed",                     0,                 
 AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_QUALITY_PRESET_SPEED    },    0, 
0, VE, .unit = "quality" },
     { "quality",        "Prefer Quality",                   0,                 
 AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_QUALITY_PRESET_QUALITY  },    0, 
0, VE, .unit = "quality" },
+    { "high_quality",   "Prefer High Quality",              0,                 
 AV_OPT_TYPE_CONST, { .i64 = AMF_VIDEO_ENCODER_QUALITY_PRESET_HIGH_QUALITY  },  
  0, 0, VE, .unit = "quality" },
 
     // Dynamic
     /// Rate Control Method
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
index 644cdb37a4..8eebc7a2aa 100644
--- a/libavcodec/amfenc_hevc.c
+++ b/libavcodec/amfenc_hevc.c
@@ -68,6 +68,7 @@ static const AVOption options[] = {
 
     { "quality",        "Set the encoding quality preset",  OFFSET(quality),   
 AV_OPT_TYPE_INT,   { .i64 = -1 }, -1, 
AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_SPEED, VE, .unit = "quality" },
     { "preset",         "Set the encoding quality preset",  OFFSET(quality),   
 AV_OPT_TYPE_INT,   { .i64 = -1 }, -1, 
AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_SPEED, VE, .unit = "quality" },
+    { "high_quality",   "", 0, AV_OPT_TYPE_CONST, { .i64 = 
AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_HIGH_QUALITY  }, 0, 0, VE, .unit = 
"quality" },
     { "quality",        "", 0, AV_OPT_TYPE_CONST, { .i64 = 
AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_QUALITY  }, 0, 0, VE, .unit = "quality" },
     { "balanced",       "", 0, AV_OPT_TYPE_CONST, { .i64 = 
AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_BALANCED }, 0, 0, VE, .unit = "quality" },
     { "speed",          "", 0, AV_OPT_TYPE_CONST, { .i64 = 
AMF_VIDEO_ENCODER_HEVC_QUALITY_PRESET_SPEED    }, 0, 0, VE, .unit = "quality" },
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to