[FFmpeg-devel] avcodec/qsvenc_hevc: add idr_interval option

Submitted by Steven Liu on July 6, 2017, 10:48 a.m.

Details

Message ID 20170706104804.9120-1-lq@chinaffmpeg.org
State New
Headers show

Commit Message

Steven Liu July 6, 2017, 10:48 a.m.
From: Steven Liu <lingjiujianke@gmail.com>

user need to control the idr_interval for qsv hevc

Signed-off-by: Steven Liu <lq@onvideo.cn>
---
 libavcodec/qsvenc_hevc.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Mark Thompson July 6, 2017, 11:51 a.m.
On 06/07/17 11:48, Steven Liu wrote:
> From: Steven Liu <lingjiujianke@gmail.com>
> 
> user need to control the idr_interval for qsv hevc
> 
> Signed-off-by: Steven Liu <lq@onvideo.cn>
> ---
>  libavcodec/qsvenc_hevc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c
> index 7d4d55bb61..c063e27eea 100644
> --- a/libavcodec/qsvenc_hevc.c
> +++ b/libavcodec/qsvenc_hevc.c
> @@ -214,6 +214,7 @@ static av_cold int qsv_enc_close(AVCodecContext *avctx)
>  static const AVOption options[] = {
>      QSV_COMMON_OPTS
>  
> +    { "idr_interval", "Distance (in I-frames) between IDR frames", OFFSET(qsv.idr_interval), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
>      { "load_plugin", "A user plugin to load in an internal session", OFFSET(load_plugin), AV_OPT_TYPE_INT, { .i64 = LOAD_PLUGIN_HEVC_SW }, LOAD_PLUGIN_NONE, LOAD_PLUGIN_HEVC_HW, VE, "load_plugin" },
>      { "none",     NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_NONE },    0, 0, VE, "load_plugin" },
>      { "hevc_sw",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_HEVC_SW }, 0, 0, VE, "load_plugin" },
> 

Sure, I guess?

Though, what use-case do you intend this option for in H.265?  It already generates IRAP frames at the GOP interval, and unlike H.264 there isn't any confusion about whether they are usable as seek points.

(I can't actually remember exactly what types of NAL units it generates with and without this option; I'll have a look later.)
Steven Liu July 6, 2017, 10:32 p.m.
2017-07-06 19:51 GMT+08:00 Mark Thompson <sw@jkqxz.net>:
> On 06/07/17 11:48, Steven Liu wrote:
>> From: Steven Liu <lingjiujianke@gmail.com>
>>
>> user need to control the idr_interval for qsv hevc
>>
>> Signed-off-by: Steven Liu <lq@onvideo.cn>
>> ---
>>  libavcodec/qsvenc_hevc.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c
>> index 7d4d55bb61..c063e27eea 100644
>> --- a/libavcodec/qsvenc_hevc.c
>> +++ b/libavcodec/qsvenc_hevc.c
>> @@ -214,6 +214,7 @@ static av_cold int qsv_enc_close(AVCodecContext *avctx)
>>  static const AVOption options[] = {
>>      QSV_COMMON_OPTS
>>
>> +    { "idr_interval", "Distance (in I-frames) between IDR frames", OFFSET(qsv.idr_interval), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
>>      { "load_plugin", "A user plugin to load in an internal session", OFFSET(load_plugin), AV_OPT_TYPE_INT, { .i64 = LOAD_PLUGIN_HEVC_SW }, LOAD_PLUGIN_NONE, LOAD_PLUGIN_HEVC_HW, VE, "load_plugin" },
>>      { "none",     NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_NONE },    0, 0, VE, "load_plugin" },
>>      { "hevc_sw",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_HEVC_SW }, 0, 0, VE, "load_plugin" },
>>
>
> Sure, I guess?
>
> Though, what use-case do you intend this option for in H.265?  It already generates IRAP frames at the GOP interval, and unlike H.264 there isn't any confusion about whether they are usable as seek points.
hmm, some user report to me they can not split mpegts segment by
keyframe when they use qsv h.265, i sent this patch to them, it can be
split.
>
> (I can't actually remember exactly what types of NAL units it generates with and without this option; I'll have a look later.)
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Mark Thompson July 6, 2017, 11:12 p.m.
On 06/07/17 23:32, Steven Liu wrote:
> 2017-07-06 19:51 GMT+08:00 Mark Thompson <sw@jkqxz.net>:
>> On 06/07/17 11:48, Steven Liu wrote:
>>> From: Steven Liu <lingjiujianke@gmail.com>
>>>
>>> user need to control the idr_interval for qsv hevc
>>>
>>> Signed-off-by: Steven Liu <lq@onvideo.cn>
>>> ---
>>>  libavcodec/qsvenc_hevc.c | 1 +
>>>  1 file changed, 1 insertion(+)
>>>
>>> diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c
>>> index 7d4d55bb61..c063e27eea 100644
>>> --- a/libavcodec/qsvenc_hevc.c
>>> +++ b/libavcodec/qsvenc_hevc.c
>>> @@ -214,6 +214,7 @@ static av_cold int qsv_enc_close(AVCodecContext *avctx)
>>>  static const AVOption options[] = {
>>>      QSV_COMMON_OPTS
>>>
>>> +    { "idr_interval", "Distance (in I-frames) between IDR frames", OFFSET(qsv.idr_interval), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
>>>      { "load_plugin", "A user plugin to load in an internal session", OFFSET(load_plugin), AV_OPT_TYPE_INT, { .i64 = LOAD_PLUGIN_HEVC_SW }, LOAD_PLUGIN_NONE, LOAD_PLUGIN_HEVC_HW, VE, "load_plugin" },
>>>      { "none",     NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_NONE },    0, 0, VE, "load_plugin" },
>>>      { "hevc_sw",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_HEVC_SW }, 0, 0, VE, "load_plugin" },
>>>
>>
>> Sure, I guess?
>>
>> Though, what use-case do you intend this option for in H.265?  It already generates IRAP frames at the GOP interval, and unlike H.264 there isn't any confusion about whether they are usable as seek points.
> hmm, some user report to me they can not split mpegts segment by
> keyframe when they use qsv h.265, i sent this patch to them, it can be
> split.

Then adding this option to set sounds like an appalling hack.  What are the actual symptoms of this problem?  Can you provide an example?

>>
>> (I can't actually remember exactly what types of NAL units it generates with and without this option; I'll have a look later.)
>>

Using the hardware encoder on Linux for Skylake, the very first frame is IDR_W_RADL, then subsequent frames are all TRAIL_N/TRAIL_R, or CRA to start a new GOP.  (It need not be the same on all versions of the encoder, though.)
Steven Liu July 6, 2017, 11:20 p.m.
2017-07-07 7:12 GMT+08:00 Mark Thompson <sw@jkqxz.net>:
> On 06/07/17 23:32, Steven Liu wrote:
>> 2017-07-06 19:51 GMT+08:00 Mark Thompson <sw@jkqxz.net>:
>>> On 06/07/17 11:48, Steven Liu wrote:
>>>> From: Steven Liu <lingjiujianke@gmail.com>
>>>>
>>>> user need to control the idr_interval for qsv hevc
>>>>
>>>> Signed-off-by: Steven Liu <lq@onvideo.cn>
>>>> ---
>>>>  libavcodec/qsvenc_hevc.c | 1 +
>>>>  1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c
>>>> index 7d4d55bb61..c063e27eea 100644
>>>> --- a/libavcodec/qsvenc_hevc.c
>>>> +++ b/libavcodec/qsvenc_hevc.c
>>>> @@ -214,6 +214,7 @@ static av_cold int qsv_enc_close(AVCodecContext *avctx)
>>>>  static const AVOption options[] = {
>>>>      QSV_COMMON_OPTS
>>>>
>>>> +    { "idr_interval", "Distance (in I-frames) between IDR frames", OFFSET(qsv.idr_interval), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
>>>>      { "load_plugin", "A user plugin to load in an internal session", OFFSET(load_plugin), AV_OPT_TYPE_INT, { .i64 = LOAD_PLUGIN_HEVC_SW }, LOAD_PLUGIN_NONE, LOAD_PLUGIN_HEVC_HW, VE, "load_plugin" },
>>>>      { "none",     NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_NONE },    0, 0, VE, "load_plugin" },
>>>>      { "hevc_sw",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_HEVC_SW }, 0, 0, VE, "load_plugin" },
>>>>
>>>
>>> Sure, I guess?
>>>
>>> Though, what use-case do you intend this option for in H.265?  It already generates IRAP frames at the GOP interval, and unlike H.264 there isn't any confusion about whether they are usable as seek points.
>> hmm, some user report to me they can not split mpegts segment by
>> keyframe when they use qsv h.265, i sent this patch to them, it can be
>> split.
>
> Then adding this option to set sounds like an appalling hack.  What are the actual symptoms of this problem?  Can you provide an example?
Just use command line to split hls format.  after the patch sent to
the user, they just response an that's ok and no more response :(>
>>>
>>> (I can't actually remember exactly what types of NAL units it generates with and without this option; I'll have a look later.)
>>>
>
> Using the hardware encoder on Linux for Skylake, the very first frame is IDR_W_RADL, then subsequent frames are all TRAIL_N/TRAIL_R, or CRA to start a new GOP.  (It need not be the same on all versions of the encoder, though.)
Yes, maybe the problem is different versions' result.

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Patch hide | download patch | download mbox

diff --git a/libavcodec/qsvenc_hevc.c b/libavcodec/qsvenc_hevc.c
index 7d4d55bb61..c063e27eea 100644
--- a/libavcodec/qsvenc_hevc.c
+++ b/libavcodec/qsvenc_hevc.c
@@ -214,6 +214,7 @@  static av_cold int qsv_enc_close(AVCodecContext *avctx)
 static const AVOption options[] = {
     QSV_COMMON_OPTS
 
+    { "idr_interval", "Distance (in I-frames) between IDR frames", OFFSET(qsv.idr_interval), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
     { "load_plugin", "A user plugin to load in an internal session", OFFSET(load_plugin), AV_OPT_TYPE_INT, { .i64 = LOAD_PLUGIN_HEVC_SW }, LOAD_PLUGIN_NONE, LOAD_PLUGIN_HEVC_HW, VE, "load_plugin" },
     { "none",     NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_NONE },    0, 0, VE, "load_plugin" },
     { "hevc_sw",  NULL, 0, AV_OPT_TYPE_CONST, { .i64 = LOAD_PLUGIN_HEVC_SW }, 0, 0, VE, "load_plugin" },