* [FFmpeg-devel] [PATCH] avcodec/amfenc: add smart access video option
@ 2025-03-11 14:48 Araz Iusubov
2025-03-11 16:23 ` Zhao Zhili
0 siblings, 1 reply; 4+ messages in thread
From: Araz Iusubov @ 2025-03-11 14:48 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Evgeny Pavlov
From: Evgeny Pavlov <lucenticus@gmail.com>
This commit adds option for enabling SmartAccess Video (SAV)
in AMF encoders. SAV is an AMD hardware-specific feature which
enables the parallelization of encode and decode streams across
multiple Video Codec Engine (VCN) hardware instances.
---
libavcodec/amfenc.h | 1 +
libavcodec/amfenc_av1.c | 17 +++++++++++++++++
libavcodec/amfenc_h264.c | 18 ++++++++++++++++++
libavcodec/amfenc_hevc.c | 18 ++++++++++++++++++
4 files changed, 54 insertions(+)
diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
index 3f42c4cd94..aec3a3f9ec 100644
--- a/libavcodec/amfenc.h
+++ b/libavcodec/amfenc.h
@@ -72,6 +72,7 @@ typedef struct AMFEncoderContext {
int b_frame_delta_qp;
int ref_b_frame_delta_qp;
int bit_depth;
+ int smart_access_video;
// Dynamic options, can be set after Init() call
diff --git a/libavcodec/amfenc_av1.c b/libavcodec/amfenc_av1.c
index 05ad2b8897..8c5fa9dfbc 100644
--- a/libavcodec/amfenc_av1.c
+++ b/libavcodec/amfenc_av1.c
@@ -133,6 +133,8 @@ static const AVOption options[] = {
{ "1080p", "", 0, AV_OPT_TYPE_CONST, {.i64 = AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_64X16_1080P_CODED_1082 }, 0, 0, VE, .unit = "align" },
{ "none", "", 0, AV_OPT_TYPE_CONST, {.i64 = AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_NO_RESTRICTIONS }, 0, 0, VE, .unit = "align" },
+ { "smart_access_video", "Enable Smart Access Video", OFFSET(smart_access_video), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE},
+
//Pre Analysis options
{ "preanalysis", "Enable preanalysis", OFFSET(preanalysis), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE },
@@ -326,6 +328,21 @@ FF_ENABLE_DEPRECATION_WARNINGS
av_log(ctx, AV_LOG_DEBUG, "Rate control turned to Peak VBR\n");
}
}
+ if (ctx->smart_access_video != -1) {
+ AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_ENABLE_SMART_ACCESS_VIDEO, ctx->smart_access_video != 0);
+ if (res != AMF_OK) {
+ av_log(avctx, AV_LOG_ERROR, "The Smart Access Video is not supported by AMF.\n");
+ if (ctx->smart_access_video != 0)
+ return AVERROR(ENOSYS);
+ } else {
+ av_log(avctx, AV_LOG_INFO, "The Smart Access Video (%d) is set.\n", ctx->smart_access_video);
+ // Set low latency mode if Smart Access Video is enabled
+ if (ctx->smart_access_video != 0) {
+ AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE, AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE_LOWEST_LATENCY);
+ av_log(avctx, AV_LOG_INFO, "The Smart Access Video set low latency mode.\n");
+ }
+ }
+ }
// Pre-Pass, Pre-Analysis, Two-Pass
if (ctx->rate_control_mode == AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_CONSTANT_QP) {
diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
index 4291f0ea64..2f906f3273 100644
--- a/libavcodec/amfenc_h264.c
+++ b/libavcodec/amfenc_h264.c
@@ -139,6 +139,8 @@ static const AVOption options[] = {
{ "forced_idr", "Force I frames to be IDR frames", OFFSET(forced_idr) , AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
{ "aud", "Inserts AU Delimiter NAL unit", OFFSET(aud) , AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VE },
+ { "smart_access_video", "Enable Smart Access Video", OFFSET(smart_access_video), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE},
+
//Pre Analysis options
{ "preanalysis", "Enable preanalysis", OFFSET(preanalysis), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE },
@@ -399,6 +401,22 @@ FF_ENABLE_DEPRECATION_WARNINGS
AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_LOWLATENCY_MODE, ((ctx->latency == 0) ? false : true));
}
+ if (ctx->smart_access_video != -1) {
+ AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_ENABLE_SMART_ACCESS_VIDEO, ctx->smart_access_video != 0);
+ if (res != AMF_OK) {
+ av_log(avctx, AV_LOG_ERROR, "The Smart Access Video is not supported by AMF.\n");
+ if (ctx->smart_access_video != 0)
+ return AVERROR(ENOSYS);
+ } else {
+ av_log(avctx, AV_LOG_INFO, "The Smart Access Video (%d) is set.\n", ctx->smart_access_video);
+ // Set low latency mode if Smart Access Video is enabled
+ if (ctx->smart_access_video != 0) {
+ AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_LOWLATENCY_MODE, true);
+ av_log(avctx, AV_LOG_INFO, "The Smart Access Video set low latency mode.\n");
+ }
+ }
+ }
+
if (ctx->preanalysis != -1) {
AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_PRE_ANALYSIS_ENABLE, !!((ctx->preanalysis == 0) ? false : true));
}
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
index 81ef1534f5..ace1d60c70 100644
--- a/libavcodec/amfenc_hevc.c
+++ b/libavcodec/amfenc_hevc.c
@@ -109,6 +109,8 @@ static const AVOption options[] = {
{ "forced_idr", "Force I frames to be IDR frames", OFFSET(forced_idr) ,AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, VE },
{ "aud", "Inserts AU Delimiter NAL unit", OFFSET(aud) ,AV_OPT_TYPE_BOOL,{ .i64 = -1 }, -1, 1, VE },
+ { "smart_access_video", "Enable Smart Access Video", OFFSET(smart_access_video), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE},
+
//Pre Analysis options
{ "preanalysis", "Enable preanalysis", OFFSET(preanalysis), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE },
@@ -309,6 +311,22 @@ FF_ENABLE_DEPRECATION_WARNINGS
}
}
+ if (ctx->smart_access_video != -1) {
+ AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_ENABLE_SMART_ACCESS_VIDEO, ctx->smart_access_video != 0);
+ if (res != AMF_OK) {
+ av_log(avctx, AV_LOG_ERROR, "The Smart Access Video is not supported by AMF.\n");
+ if (ctx->smart_access_video != 0)
+ return AVERROR(ENOSYS);
+ } else {
+ av_log(avctx, AV_LOG_INFO, "The Smart Access Video (%d) is set.\n", ctx->smart_access_video);
+ // Set low latency mode if Smart Access Video is enabled
+ if (ctx->smart_access_video != 0) {
+ AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_LOWLATENCY_MODE, true);
+ av_log(avctx, AV_LOG_INFO, "The Smart Access Video set low latency mode.\n");
+ }
+ }
+ }
+
// Pre-Pass, Pre-Analysis, Two-Pass
if (ctx->rate_control_mode == AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_CONSTANT_QP) {
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_PREENCODE_ENABLE, 0);
--
2.45.2.windows.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avcodec/amfenc: add smart access video option
2025-03-11 14:48 [FFmpeg-devel] [PATCH] avcodec/amfenc: add smart access video option Araz Iusubov
@ 2025-03-11 16:23 ` Zhao Zhili
2025-03-11 16:44 ` Dennis Mungai
2025-03-11 21:37 ` Araz
0 siblings, 2 replies; 4+ messages in thread
From: Zhao Zhili @ 2025-03-11 16:23 UTC (permalink / raw)
To: FFmpeg development discussions and patches
> On Mar 11, 2025, at 22:48, Araz Iusubov <primeadvice@gmail.com> wrote:
>
> From: Evgeny Pavlov <lucenticus@gmail.com>
>
> This commit adds option for enabling SmartAccess Video (SAV)
> in AMF encoders. SAV is an AMD hardware-specific feature which
> enables the parallelization of encode and decode streams across
> multiple Video Codec Engine (VCN) hardware instances.
>
> ---
> libavcodec/amfenc.h | 1 +
> libavcodec/amfenc_av1.c | 17 +++++++++++++++++
> libavcodec/amfenc_h264.c | 18 ++++++++++++++++++
> libavcodec/amfenc_hevc.c | 18 ++++++++++++++++++
> 4 files changed, 54 insertions(+)
>
> diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
> index 3f42c4cd94..aec3a3f9ec 100644
> --- a/libavcodec/amfenc.h
> +++ b/libavcodec/amfenc.h
> @@ -72,6 +72,7 @@ typedef struct AMFEncoderContext {
> int b_frame_delta_qp;
> int ref_b_frame_delta_qp;
> int bit_depth;
> + int smart_access_video;
>
> // Dynamic options, can be set after Init() call
>
> diff --git a/libavcodec/amfenc_av1.c b/libavcodec/amfenc_av1.c
> index 05ad2b8897..8c5fa9dfbc 100644
> --- a/libavcodec/amfenc_av1.c
> +++ b/libavcodec/amfenc_av1.c
> @@ -133,6 +133,8 @@ static const AVOption options[] = {
> { "1080p", "", 0, AV_OPT_TYPE_CONST, {.i64 = AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_64X16_1080P_CODED_1082 }, 0, 0, VE, .unit = "align" },
> { "none", "", 0, AV_OPT_TYPE_CONST, {.i64 = AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_NO_RESTRICTIONS }, 0, 0, VE, .unit = "align" },
>
> + { "smart_access_video", "Enable Smart Access Video", OFFSET(smart_access_video), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE},
> +
It’s almost impossible to get what does this option do for user with good background on video encoding.
Please add some comments here.
> //Pre Analysis options
> { "preanalysis", "Enable preanalysis", OFFSET(preanalysis), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE },
>
> @@ -326,6 +328,21 @@ FF_ENABLE_DEPRECATION_WARNINGS
> av_log(ctx, AV_LOG_DEBUG, "Rate control turned to Peak VBR\n");
> }
> }
> + if (ctx->smart_access_video != -1) {
> + AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_ENABLE_SMART_ACCESS_VIDEO, ctx->smart_access_video != 0);
> + if (res != AMF_OK) {
> + av_log(avctx, AV_LOG_ERROR, "The Smart Access Video is not supported by AMF.\n");
> + if (ctx->smart_access_video != 0)
> + return AVERROR(ENOSYS);
> + } else {
> + av_log(avctx, AV_LOG_INFO, "The Smart Access Video (%d) is set.\n", ctx->smart_access_video);
> + // Set low latency mode if Smart Access Video is enabled
> + if (ctx->smart_access_video != 0) {
> + AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE, AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE_LOWEST_LATENCY);
> + av_log(avctx, AV_LOG_INFO, "The Smart Access Video set low latency mode.\n");
> + }
> + }
> + }
>
> // Pre-Pass, Pre-Analysis, Two-Pass
> if (ctx->rate_control_mode == AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_CONSTANT_QP) {
> diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
> index 4291f0ea64..2f906f3273 100644
> --- a/libavcodec/amfenc_h264.c
> +++ b/libavcodec/amfenc_h264.c
> @@ -139,6 +139,8 @@ static const AVOption options[] = {
> { "forced_idr", "Force I frames to be IDR frames", OFFSET(forced_idr) , AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
> { "aud", "Inserts AU Delimiter NAL unit", OFFSET(aud) , AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VE },
>
> + { "smart_access_video", "Enable Smart Access Video", OFFSET(smart_access_video), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE},
> +
> //Pre Analysis options
> { "preanalysis", "Enable preanalysis", OFFSET(preanalysis), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE },
>
> @@ -399,6 +401,22 @@ FF_ENABLE_DEPRECATION_WARNINGS
> AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_LOWLATENCY_MODE, ((ctx->latency == 0) ? false : true));
> }
>
> + if (ctx->smart_access_video != -1) {
> + AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_ENABLE_SMART_ACCESS_VIDEO, ctx->smart_access_video != 0);
> + if (res != AMF_OK) {
> + av_log(avctx, AV_LOG_ERROR, "The Smart Access Video is not supported by AMF.\n");
> + if (ctx->smart_access_video != 0)
> + return AVERROR(ENOSYS);
> + } else {
> + av_log(avctx, AV_LOG_INFO, "The Smart Access Video (%d) is set.\n", ctx->smart_access_video);
> + // Set low latency mode if Smart Access Video is enabled
> + if (ctx->smart_access_video != 0) {
> + AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_LOWLATENCY_MODE, true);
> + av_log(avctx, AV_LOG_INFO, "The Smart Access Video set low latency mode.\n");
> + }
> + }
> + }
> +
> if (ctx->preanalysis != -1) {
> AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_PRE_ANALYSIS_ENABLE, !!((ctx->preanalysis == 0) ? false : true));
> }
> diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
> index 81ef1534f5..ace1d60c70 100644
> --- a/libavcodec/amfenc_hevc.c
> +++ b/libavcodec/amfenc_hevc.c
> @@ -109,6 +109,8 @@ static const AVOption options[] = {
> { "forced_idr", "Force I frames to be IDR frames", OFFSET(forced_idr) ,AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, VE },
> { "aud", "Inserts AU Delimiter NAL unit", OFFSET(aud) ,AV_OPT_TYPE_BOOL,{ .i64 = -1 }, -1, 1, VE },
>
> + { "smart_access_video", "Enable Smart Access Video", OFFSET(smart_access_video), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE},
> +
> //Pre Analysis options
> { "preanalysis", "Enable preanalysis", OFFSET(preanalysis), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE },
>
> @@ -309,6 +311,22 @@ FF_ENABLE_DEPRECATION_WARNINGS
> }
> }
>
> + if (ctx->smart_access_video != -1) {
> + AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_ENABLE_SMART_ACCESS_VIDEO, ctx->smart_access_video != 0);
> + if (res != AMF_OK) {
> + av_log(avctx, AV_LOG_ERROR, "The Smart Access Video is not supported by AMF.\n");
> + if (ctx->smart_access_video != 0)
> + return AVERROR(ENOSYS);
> + } else {
> + av_log(avctx, AV_LOG_INFO, "The Smart Access Video (%d) is set.\n", ctx->smart_access_video);
> + // Set low latency mode if Smart Access Video is enabled
> + if (ctx->smart_access_video != 0) {
> + AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_LOWLATENCY_MODE, true);
> + av_log(avctx, AV_LOG_INFO, "The Smart Access Video set low latency mode.\n");
> + }
> + }
> + }
> +
> // Pre-Pass, Pre-Analysis, Two-Pass
> if (ctx->rate_control_mode == AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_CONSTANT_QP) {
> AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_PREENCODE_ENABLE, 0);
> --
> 2.45.2.windows.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avcodec/amfenc: add smart access video option
2025-03-11 16:23 ` Zhao Zhili
@ 2025-03-11 16:44 ` Dennis Mungai
2025-03-11 21:37 ` Araz
1 sibling, 0 replies; 4+ messages in thread
From: Dennis Mungai @ 2025-03-11 16:44 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Tue, 11 Mar 2025 at 19:24, Zhao Zhili <
quinkblack-at-foxmail.com@ffmpeg.org> wrote:
>
>
> > On Mar 11, 2025, at 22:48, Araz Iusubov <primeadvice@gmail.com> wrote:
> >
> > From: Evgeny Pavlov <lucenticus@gmail.com>
> >
> > This commit adds option for enabling SmartAccess Video (SAV)
> > in AMF encoders. SAV is an AMD hardware-specific feature which
> > enables the parallelization of encode and decode streams across
> > multiple Video Codec Engine (VCN) hardware instances.
> >
> > ---
> > libavcodec/amfenc.h | 1 +
> > libavcodec/amfenc_av1.c | 17 +++++++++++++++++
> > libavcodec/amfenc_h264.c | 18 ++++++++++++++++++
> > libavcodec/amfenc_hevc.c | 18 ++++++++++++++++++
> > 4 files changed, 54 insertions(+)
> >
> > diff --git a/libavcodec/amfenc.h b/libavcodec/amfenc.h
> > index 3f42c4cd94..aec3a3f9ec 100644
> > --- a/libavcodec/amfenc.h
> > +++ b/libavcodec/amfenc.h
> > @@ -72,6 +72,7 @@ typedef struct AMFEncoderContext {
> > int b_frame_delta_qp;
> > int ref_b_frame_delta_qp;
> > int bit_depth;
> > + int smart_access_video;
> >
> > // Dynamic options, can be set after Init() call
> >
> > diff --git a/libavcodec/amfenc_av1.c b/libavcodec/amfenc_av1.c
> > index 05ad2b8897..8c5fa9dfbc 100644
> > --- a/libavcodec/amfenc_av1.c
> > +++ b/libavcodec/amfenc_av1.c
> > @@ -133,6 +133,8 @@ static const AVOption options[] = {
> > { "1080p", "", 0, AV_OPT_TYPE_CONST, {.i64 =
> AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_64X16_1080P_CODED_1082 }, 0, 0, VE,
> .unit = "align" },
> > { "none", "", 0, AV_OPT_TYPE_CONST, {.i64 =
> AMF_VIDEO_ENCODER_AV1_ALIGNMENT_MODE_NO_RESTRICTIONS }, 0, 0, VE,
> .unit = "align" },
> >
> > + { "smart_access_video", "Enable Smart Access Video",
> OFFSET(smart_access_video), AV_OPT_TYPE_BOOL, {.i64 = -1
> }, -1, 1, VE},
> > +
>
> It’s almost impossible to get what does this option do for user with good
> background on video encoding.
> Please add some comments here.
>
> > //Pre Analysis options
> > { "preanalysis", "Enable preanalysis",
> OFFSET(preanalysis),
> AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE },
> >
> > @@ -326,6 +328,21 @@ FF_ENABLE_DEPRECATION_WARNINGS
> > av_log(ctx, AV_LOG_DEBUG, "Rate control turned to Peak
> VBR\n");
> > }
> > }
> > + if (ctx->smart_access_video != -1) {
> > + AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder,
> AMF_VIDEO_ENCODER_AV1_ENABLE_SMART_ACCESS_VIDEO, ctx->smart_access_video !=
> 0);
> > + if (res != AMF_OK) {
> > + av_log(avctx, AV_LOG_ERROR, "The Smart Access Video is not
> supported by AMF.\n");
> > + if (ctx->smart_access_video != 0)
> > + return AVERROR(ENOSYS);
> > + } else {
> > + av_log(avctx, AV_LOG_INFO, "The Smart Access Video (%d) is
> set.\n", ctx->smart_access_video);
> > + // Set low latency mode if Smart Access Video is enabled
> > + if (ctx->smart_access_video != 0) {
> > + AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder,
> AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE,
> AMF_VIDEO_ENCODER_AV1_ENCODING_LATENCY_MODE_LOWEST_LATENCY);
> > + av_log(avctx, AV_LOG_INFO, "The Smart Access Video set
> low latency mode.\n");
> > + }
> > + }
> > + }
> >
> > // Pre-Pass, Pre-Analysis, Two-Pass
> > if (ctx->rate_control_mode ==
> AMF_VIDEO_ENCODER_AV1_RATE_CONTROL_METHOD_CONSTANT_QP) {
> > diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
> > index 4291f0ea64..2f906f3273 100644
> > --- a/libavcodec/amfenc_h264.c
> > +++ b/libavcodec/amfenc_h264.c
> > @@ -139,6 +139,8 @@ static const AVOption options[] = {
> > { "forced_idr", "Force I frames to be IDR frames",
> OFFSET(forced_idr) , AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
> > { "aud", "Inserts AU Delimiter NAL unit",
> OFFSET(aud) , AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VE },
> >
> > + { "smart_access_video", "Enable Smart Access Video",
> OFFSET(smart_access_video), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE},
> > +
> > //Pre Analysis options
> > { "preanalysis", "Enable preanalysis",
> OFFSET(preanalysis),
> AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE },
> >
> > @@ -399,6 +401,22 @@ FF_ENABLE_DEPRECATION_WARNINGS
> > AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder,
> AMF_VIDEO_ENCODER_LOWLATENCY_MODE, ((ctx->latency == 0) ? false : true));
> > }
> >
> > + if (ctx->smart_access_video != -1) {
> > + AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder,
> AMF_VIDEO_ENCODER_ENABLE_SMART_ACCESS_VIDEO, ctx->smart_access_video != 0);
> > + if (res != AMF_OK) {
> > + av_log(avctx, AV_LOG_ERROR, "The Smart Access Video is not
> supported by AMF.\n");
> > + if (ctx->smart_access_video != 0)
> > + return AVERROR(ENOSYS);
> > + } else {
> > + av_log(avctx, AV_LOG_INFO, "The Smart Access Video (%d) is
> set.\n", ctx->smart_access_video);
> > + // Set low latency mode if Smart Access Video is enabled
> > + if (ctx->smart_access_video != 0) {
> > + AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder,
> AMF_VIDEO_ENCODER_LOWLATENCY_MODE, true);
> > + av_log(avctx, AV_LOG_INFO, "The Smart Access Video set
> low latency mode.\n");
> > + }
> > + }
> > + }
> > +
> > if (ctx->preanalysis != -1) {
> > AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder,
> AMF_VIDEO_ENCODER_PRE_ANALYSIS_ENABLE, !!((ctx->preanalysis == 0) ? false :
> true));
> > }
> > diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
> > index 81ef1534f5..ace1d60c70 100644
> > --- a/libavcodec/amfenc_hevc.c
> > +++ b/libavcodec/amfenc_hevc.c
> > @@ -109,6 +109,8 @@ static const AVOption options[] = {
> > { "forced_idr", "Force I frames to be IDR frames",
> OFFSET(forced_idr) ,AV_OPT_TYPE_BOOL,{ .i64 = 0 }, 0, 1, VE },
> > { "aud", "Inserts AU Delimiter NAL unit",
> OFFSET(aud) ,AV_OPT_TYPE_BOOL,{ .i64 = -1 }, -1, 1, VE },
> >
> > + { "smart_access_video", "Enable Smart Access Video",
> OFFSET(smart_access_video), AV_OPT_TYPE_BOOL, {.i64 = -1 }, -1, 1, VE},
> > +
> > //Pre Analysis options
> > { "preanalysis", "Enable preanalysis",
> OFFSET(preanalysis), AV_OPT_TYPE_BOOL, {.i64 =
> -1 }, -1, 1, VE },
> >
> > @@ -309,6 +311,22 @@ FF_ENABLE_DEPRECATION_WARNINGS
> > }
> > }
> >
> > + if (ctx->smart_access_video != -1) {
> > + AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder,
> AMF_VIDEO_ENCODER_HEVC_ENABLE_SMART_ACCESS_VIDEO, ctx->smart_access_video
> != 0);
> > + if (res != AMF_OK) {
> > + av_log(avctx, AV_LOG_ERROR, "The Smart Access Video is not
> supported by AMF.\n");
> > + if (ctx->smart_access_video != 0)
> > + return AVERROR(ENOSYS);
> > + } else {
> > + av_log(avctx, AV_LOG_INFO, "The Smart Access Video (%d) is
> set.\n", ctx->smart_access_video);
> > + // Set low latency mode if Smart Access Video is enabled
> > + if (ctx->smart_access_video != 0) {
> > + AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder,
> AMF_VIDEO_ENCODER_HEVC_LOWLATENCY_MODE, true);
> > + av_log(avctx, AV_LOG_INFO, "The Smart Access Video set
> low latency mode.\n");
> > + }
> > + }
> > + }
> > +
> > // Pre-Pass, Pre-Analysis, Two-Pass
> > if (ctx->rate_control_mode ==
> AMF_VIDEO_ENCODER_HEVC_RATE_CONTROL_METHOD_CONSTANT_QP) {
> > AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder,
> AMF_VIDEO_ENCODER_HEVC_PREENCODE_ENABLE, 0);
> > --
> > 2.45.2.windows.1
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >
> > To unsubscribe, visit link above, or email
> > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
>
To my understanding, this is similar to Intel's Deep Link Hyper Encode
<https://www.intel.com/content/www/us/en/support/articles/000090035/graphics/intel-arc-dedicated-graphics-family.html>
feature set , which allows for the combination of Intel's discrete and
integrated GPU's media engines to speed up video encoding in a single
pipeline/session.
From AMD
<https://www.amd.com/en/gaming/technologies/smart-technologies.html>: " AMD
SmartAccess Video accesses the video compression engines across both the
AMD Ryzen™ processor and the AMD Radeon™ graphics to distribute video
related encoding and decoding tasks to provide faster transcoding speeds,
fewer dropped frames and a smooth editing experience. "
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH] avcodec/amfenc: add smart access video option
2025-03-11 16:23 ` Zhao Zhili
2025-03-11 16:44 ` Dennis Mungai
@ 2025-03-11 21:37 ` Araz
1 sibling, 0 replies; 4+ messages in thread
From: Araz @ 2025-03-11 21:37 UTC (permalink / raw)
To: FFmpeg development discussions and patches
> It’s almost impossible to get what does this option do for user with good
> background on video encoding.
> Please add some comments here.
>
Yes, as Dennis Mungai said, this feature allows to use both APU and GPU
for decoding/encoding in a single pipeline.
It is supported on AMD Radeon CPU 5000 series and higher and RX 6000
series and higher graphics cards.
The average transcoding speed improves up to 30%.
This patch is tested on AMD Ryzen 5 7600X + AMD GPU RX6700XT.
To enable this feature, you need to select the hwaccel AMF input
and output as in the example below:
ffmpeg.exe -hwaccel amf -hwaccel_output_format amf -extra_hw_frames 33
-i input.mp4 -c:v hevc_amf -smart_access_video 1 -y output.mp4
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-03-11 21:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-11 14:48 [FFmpeg-devel] [PATCH] avcodec/amfenc: add smart access video option Araz Iusubov
2025-03-11 16:23 ` Zhao Zhili
2025-03-11 16:44 ` Dennis Mungai
2025-03-11 21:37 ` Araz
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git