diff mbox series

[FFmpeg-devel,v1,1/1] lavc/qsvenc: disable SEI frame before each P-frame

Message ID OSZP286MB21429531501B073BDB525F00D50FA@OSZP286MB2142.JPNP286.PROD.OUTLOOK.COM
State New
Headers show
Series [FFmpeg-devel,v1,1/1] lavc/qsvenc: disable SEI frame before each P-frame | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Ting Hu Aug. 6, 2023, 11:54 a.m. UTC
From: tinghu3 <siriushu@hotmail.com>

In order to save bandwith for video conference application,
set pic_timing_sei of av_option to disable SEI frames.
It doesn't take effect.

Signed-off-by: tinghu3 <siriushu@hotmail.com>
---
 libavcodec/qsvenc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Xiang, Haihao Aug. 7, 2023, 2:06 a.m. UTC | #1
On So, 2023-08-06 at 19:54 +0800, Ting Hu wrote:
> From: tinghu3 <siriushu@hotmail.com>
> 
> In order to save bandwith for video conference application,
> set pic_timing_sei of av_option to disable SEI frames.
> It doesn't take effect.
> 
> Signed-off-by: tinghu3 <siriushu@hotmail.com>
> ---
>  libavcodec/qsvenc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index df63c182b0..7a5ea5391e 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -937,7 +937,7 @@ static int init_video_param(AVCodecContext *avctx,
> QSVEncContext *q)
>          q->extco.Header.BufferSz      = sizeof(q->extco);
>  
>          q->extco.PicTimingSEI         = q->pic_timing_sei ?
> -                                        MFX_CODINGOPTION_ON :
> MFX_CODINGOPTION_UNKNOWN;
> +                                        MFX_CODINGOPTION_ON :
> MFX_CODINGOPTION_OFF;

PicTimingSEI and RefPicMarkRep are tristate flags. When a tristate flag is set
to MFX_CODINGOPTION_UNKNOWN(0), the SDK encoder can choose a best configuration
based on the current state and settings. We want to the SDK encoder set 
reasonable values for these flags

Thanks
Haihao

>          q->old_pic_timing_sei = q->pic_timing_sei;
>  
>          if (q->rdo >= 0)
> @@ -968,6 +968,7 @@ static int init_video_param(AVCodecContext *avctx,
> QSVEncContext *q)
>              q->extco.AUDelimiter          = q->aud ? MFX_CODINGOPTION_ON :
> MFX_CODINGOPTION_OFF;
>          }
>  
> +        q->extco.RefPicMarkRep = q->pic_timing_sei ? MFX_CODINGOPTION_ON :
> MFX_CODINGOPTION_OFF;
>          q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q-
> >extco;
>  
>          if (avctx->codec_id == AV_CODEC_ID_H264) {
Ting Hu Aug. 8, 2023, 12:39 p.m. UTC | #2
Hi,
How can I disable SEI frame? Is there any other option?

获取 Outlook for iOS<https://aka.ms/o0ukef>
________________________________
发件人: Xiang, Haihao <haihao.xiang@intel.com>
发送时间: Monday, August 7, 2023 10:06:41 AM
收件人: ffmpeg-devel@ffmpeg.org <ffmpeg-devel@ffmpeg.org>
抄送: siriushu@hotmail.com <siriushu@hotmail.com>
主题: Re: [FFmpeg-devel] [PATCH v1 1/1] lavc/qsvenc: disable SEI frame before each P-frame

On So, 2023-08-06 at 19:54 +0800, Ting Hu wrote:
> From: tinghu3 <siriushu@hotmail.com>
>
> In order to save bandwith for video conference application,
> set pic_timing_sei of av_option to disable SEI frames.
> It doesn't take effect.
>
> Signed-off-by: tinghu3 <siriushu@hotmail.com>
> ---
>  libavcodec/qsvenc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index df63c182b0..7a5ea5391e 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -937,7 +937,7 @@ static int init_video_param(AVCodecContext *avctx,
> QSVEncContext *q)
>          q->extco.Header.BufferSz      = sizeof(q->extco);
>
>          q->extco.PicTimingSEI         = q->pic_timing_sei ?
> -                                        MFX_CODINGOPTION_ON :
> MFX_CODINGOPTION_UNKNOWN;
> +                                        MFX_CODINGOPTION_ON :
> MFX_CODINGOPTION_OFF;

PicTimingSEI and RefPicMarkRep are tristate flags. When a tristate flag is set
to MFX_CODINGOPTION_UNKNOWN(0), the SDK encoder can choose a best configuration
based on the current state and settings. We want to the SDK encoder set
reasonable values for these flags

Thanks
Haihao

>          q->old_pic_timing_sei = q->pic_timing_sei;
>
>          if (q->rdo >= 0)
> @@ -968,6 +968,7 @@ static int init_video_param(AVCodecContext *avctx,
> QSVEncContext *q)
>              q->extco.AUDelimiter          = q->aud ? MFX_CODINGOPTION_ON :
> MFX_CODINGOPTION_OFF;
>          }
>
> +        q->extco.RefPicMarkRep = q->pic_timing_sei ? MFX_CODINGOPTION_ON :
> MFX_CODINGOPTION_OFF;
>          q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q-
> >extco;
>
>          if (avctx->codec_id == AV_CODEC_ID_H264) {
Xiang, Haihao Aug. 10, 2023, 8:37 a.m. UTC | #3
Hi,
How can I disable SEI frame? Is there any other option?

You may use option -scenario <arg> to indicate the scenario for the encoding session, but I'm not sure whether your runtime has the optimization for SEI.

Thanks
Haihao



获取 Outlook for iOS<https://aka.ms/o0ukef>
________________________________
发件人: Xiang, Haihao <haihao.xiang@intel.com>
发送时间: Monday, August 7, 2023 10:06:41 AM
收件人: ffmpeg-devel@ffmpeg.org <ffmpeg-devel@ffmpeg.org>
抄送: siriushu@hotmail.com <siriushu@hotmail.com>
主题: Re: [FFmpeg-devel] [PATCH v1 1/1] lavc/qsvenc: disable SEI frame before each P-frame

On So, 2023-08-06 at 19:54 +0800, Ting Hu wrote:
> From: tinghu3 <siriushu@hotmail.com>
>
> In order to save bandwith for video conference application,
> set pic_timing_sei of av_option to disable SEI frames.
> It doesn't take effect.
>
> Signed-off-by: tinghu3 <siriushu@hotmail.com>
> ---
>  libavcodec/qsvenc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
> index df63c182b0..7a5ea5391e 100644
> --- a/libavcodec/qsvenc.c
> +++ b/libavcodec/qsvenc.c
> @@ -937,7 +937,7 @@ static int init_video_param(AVCodecContext *avctx,
> QSVEncContext *q)
>          q->extco.Header.BufferSz      = sizeof(q->extco);
>
>          q->extco.PicTimingSEI         = q->pic_timing_sei ?
> -                                        MFX_CODINGOPTION_ON :
> MFX_CODINGOPTION_UNKNOWN;
> +                                        MFX_CODINGOPTION_ON :
> MFX_CODINGOPTION_OFF;

PicTimingSEI and RefPicMarkRep are tristate flags. When a tristate flag is set
to MFX_CODINGOPTION_UNKNOWN(0), the SDK encoder can choose a best configuration
based on the current state and settings. We want to the SDK encoder set
reasonable values for these flags

Thanks
Haihao

>          q->old_pic_timing_sei = q->pic_timing_sei;
>
>          if (q->rdo >= 0)
> @@ -968,6 +968,7 @@ static int init_video_param(AVCodecContext *avctx,
> QSVEncContext *q)
>              q->extco.AUDelimiter          = q->aud ? MFX_CODINGOPTION_ON :
> MFX_CODINGOPTION_OFF;
>          }
>
> +        q->extco.RefPicMarkRep = q->pic_timing_sei ? MFX_CODINGOPTION_ON :
> MFX_CODINGOPTION_OFF;
>          q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q-
> >extco;
>
>          if (avctx->codec_id == AV_CODEC_ID_H264) {
diff mbox series

Patch

diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index df63c182b0..7a5ea5391e 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -937,7 +937,7 @@  static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
         q->extco.Header.BufferSz      = sizeof(q->extco);
 
         q->extco.PicTimingSEI         = q->pic_timing_sei ?
-                                        MFX_CODINGOPTION_ON : MFX_CODINGOPTION_UNKNOWN;
+                                        MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
         q->old_pic_timing_sei = q->pic_timing_sei;
 
         if (q->rdo >= 0)
@@ -968,6 +968,7 @@  static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
             q->extco.AUDelimiter          = q->aud ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
         }
 
+        q->extco.RefPicMarkRep = q->pic_timing_sei ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF;
         q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q->extco;
 
         if (avctx->codec_id == AV_CODEC_ID_H264) {