[FFmpeg-devel,v1,1/2] avcodec/videotoolboxenc: add H264 Extended profile and level

Submitted by lance.lmwang@gmail.com on Aug. 20, 2019, 11:04 a.m.

Details

Message ID 20190820110430.26908-1-lance.lmwang@gmail.com
State Accepted
Commit 57951f3019061917bbfccbc67360f561ad0bb466
Headers show

Commit Message

lance.lmwang@gmail.com Aug. 20, 2019, 11:04 a.m.
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavcodec/videotoolboxenc.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

lance.lmwang@gmail.com Aug. 27, 2019, 2:40 p.m.
ping the patchset.

On Tue, Aug 20, 2019 at 07:04:29PM +0800, lance.lmwang@gmail.com wrote:
> From: Limin Wang <lance.lmwang@gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
>  libavcodec/videotoolboxenc.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
> index d76bb7f646..b16b056f6c 100644
> --- a/libavcodec/videotoolboxenc.c
> +++ b/libavcodec/videotoolboxenc.c
> @@ -80,6 +80,8 @@ static struct{
>      CFStringRef kVTProfileLevel_H264_High_5_1;
>      CFStringRef kVTProfileLevel_H264_High_5_2;
>      CFStringRef kVTProfileLevel_H264_High_AutoLevel;
> +    CFStringRef kVTProfileLevel_H264_Extended_5_0;
> +    CFStringRef kVTProfileLevel_H264_Extended_AutoLevel;
>  
>      CFStringRef kVTProfileLevel_HEVC_Main_AutoLevel;
>      CFStringRef kVTProfileLevel_HEVC_Main10_AutoLevel;
> @@ -137,6 +139,8 @@ static void loadVTEncSymbols(){
>      GET_SYM(kVTProfileLevel_H264_High_5_1,           "H264_High_5_1");
>      GET_SYM(kVTProfileLevel_H264_High_5_2,           "H264_High_5_2");
>      GET_SYM(kVTProfileLevel_H264_High_AutoLevel,     "H264_High_AutoLevel");
> +    GET_SYM(kVTProfileLevel_H264_Extended_5_0,       "H264_Extended_5_0");
> +    GET_SYM(kVTProfileLevel_H264_Extended_AutoLevel, "H264_Extended_AutoLevel");
>  
>      GET_SYM(kVTProfileLevel_HEVC_Main_AutoLevel,     "HEVC_Main_AutoLevel");
>      GET_SYM(kVTProfileLevel_HEVC_Main10_AutoLevel,   "HEVC_Main10_AutoLevel");
> @@ -154,6 +158,7 @@ typedef enum VT_H264Profile {
>      H264_PROF_BASELINE,
>      H264_PROF_MAIN,
>      H264_PROF_HIGH,
> +    H264_PROF_EXTENDED,
>      H264_PROF_COUNT
>  } VT_H264Profile;
>  
> @@ -704,6 +709,14 @@ static bool get_vt_h264_profile_level(AVCodecContext *avctx,
>                                    compat_keys.kVTProfileLevel_H264_High_5_2;       break;
>              }
>              break;
> +        case H264_PROF_EXTENDED:
> +            switch (vtctx->level) {
> +                case  0: *profile_level_val =
> +                                  compat_keys.kVTProfileLevel_H264_Extended_AutoLevel; break;
> +                case 50: *profile_level_val =
> +                                  compat_keys.kVTProfileLevel_H264_Extended_5_0;       break;
> +            }
> +            break;
>      }
>  
>      if (!*profile_level_val) {
> @@ -2531,6 +2544,7 @@ static const AVOption h264_options[] = {
>      { "baseline", "Baseline Profile", 0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_BASELINE }, INT_MIN, INT_MAX, VE, "profile" },
>      { "main",     "Main Profile",     0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_MAIN     }, INT_MIN, INT_MAX, VE, "profile" },
>      { "high",     "High Profile",     0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_HIGH     }, INT_MIN, INT_MAX, VE, "profile" },
> +    { "extended", "Extend Profile",   0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_EXTENDED }, INT_MIN, INT_MAX, VE, "profile" },
>  
>      { "level", "Level", OFFSET(level), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 52, VE, "level" },
>      { "1.3", "Level 1.3, only available with Baseline Profile", 0, AV_OPT_TYPE_CONST, { .i64 = 13 }, INT_MIN, INT_MAX, VE, "level" },
> -- 
> 2.21.0
>
Richard Kern Aug. 27, 2019, 2:56 p.m.
I’ll look at it this weekend. 

> On Aug 27, 2019, at 10:40 AM, Limin Wang <lance.lmwang@gmail.com> wrote:
> 
> 
> ping the patchset.
> 
>> On Tue, Aug 20, 2019 at 07:04:29PM +0800, lance.lmwang@gmail.com wrote:
>> From: Limin Wang <lance.lmwang@gmail.com>
>> 
>> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
>> ---
>> libavcodec/videotoolboxenc.c | 14 ++++++++++++++
>> 1 file changed, 14 insertions(+)
>> 
>> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
>> index d76bb7f646..b16b056f6c 100644
>> --- a/libavcodec/videotoolboxenc.c
>> +++ b/libavcodec/videotoolboxenc.c
>> @@ -80,6 +80,8 @@ static struct{
>>     CFStringRef kVTProfileLevel_H264_High_5_1;
>>     CFStringRef kVTProfileLevel_H264_High_5_2;
>>     CFStringRef kVTProfileLevel_H264_High_AutoLevel;
>> +    CFStringRef kVTProfileLevel_H264_Extended_5_0;
>> +    CFStringRef kVTProfileLevel_H264_Extended_AutoLevel;
>> 
>>     CFStringRef kVTProfileLevel_HEVC_Main_AutoLevel;
>>     CFStringRef kVTProfileLevel_HEVC_Main10_AutoLevel;
>> @@ -137,6 +139,8 @@ static void loadVTEncSymbols(){
>>     GET_SYM(kVTProfileLevel_H264_High_5_1,           "H264_High_5_1");
>>     GET_SYM(kVTProfileLevel_H264_High_5_2, "H264_High_5_2");
>>     GET_SYM(kVTProfileLevel_H264_High_AutoLevel,     "H264_High_AutoLevel");
>> +    GET_SYM(kVTProfileLevel_H264_Extended_5_0,       "H264_Extended_5_0");
>> +    GET_SYM(kVTProfileLevel_H264_Extended_AutoLevel, "H264_Extended_AutoLevel");
>> 
>>     GET_SYM(kVTProfileLevel_HEVC_Main_AutoLevel,     "HEVC_Main_AutoLevel");
>>     GET_SYM(kVTProfileLevel_HEVC_Main10_AutoLevel,   "HEVC_Main10_AutoLevel");
>> @@ -154,6 +158,7 @@ typedef enum VT_H264Profile {
>>     H264_PROF_BASELINE,
>>     H264_PROF_MAIN,
>>     H264_PROF_HIGH,
>> +    H264_PROF_EXTENDED,
>>     H264_PROF_COUNT
>> } VT_H264Profile;
>> 
>> @@ -704,6 +709,14 @@ static bool get_vt_h264_profile_level(AVCodecContext *avctx,
>>                                   compat_keys.kVTProfileLevel_H264_High_5_2;       break;
>>             }
>>             break;
>> +        case H264_PROF_EXTENDED:
>> +            switch (vtctx->level) {
>> +                case  0: *profile_level_val =
>> +                                  compat_keys.kVTProfileLevel_H264_Extended_AutoLevel; break;
>> +                case 50: *profile_level_val =
>> +                                  compat_keys.kVTProfileLevel_H264_Extended_5_0;       break;
>> +            }
>> +            break;
>>     }
>> 
>>     if (!*profile_level_val) {
>> @@ -2531,6 +2544,7 @@ static const AVOption h264_options[] = {
>>     { "baseline", "Baseline Profile", 0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_BASELINE }, INT_MIN, INT_MAX, VE, "profile" },
>>     { "main",     "Main Profile",     0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_MAIN     }, INT_MIN, INT_MAX, VE, "profile" },
>>     { "high",     "High Profile",     0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_HIGH     }, INT_MIN, INT_MAX, VE, "profile" },
>> +    { "extended", "Extend Profile",   0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_EXTENDED }, INT_MIN, INT_MAX, VE, "profile" },
>> 
>>     { "level", "Level", OFFSET(level), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 52, VE, "level" },
>>     { "1.3", "Level 1.3, only available with Baseline Profile", 0, AV_OPT_TYPE_CONST, { .i64 = 13 }, INT_MIN, INT_MAX, VE, "level" },
>> -- 
>> 2.21.0
>> 
> _______________________________________________
> 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".
lance.lmwang@gmail.com Sept. 2, 2019, 1:53 p.m.
On Tue, Aug 27, 2019 at 10:56:42AM -0400, Richard Kern wrote:

> I’ll look at it this weekend. 
ping

> 
> > On Aug 27, 2019, at 10:40 AM, Limin Wang <lance.lmwang@gmail.com> wrote:
> > 
> > 
> > ping the patchset.
> > 
> >> On Tue, Aug 20, 2019 at 07:04:29PM +0800, lance.lmwang@gmail.com wrote:
> >> From: Limin Wang <lance.lmwang@gmail.com>
> >> 
> >> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> >> ---
> >> libavcodec/videotoolboxenc.c | 14 ++++++++++++++
> >> 1 file changed, 14 insertions(+)
> >> 
> >> diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
> >> index d76bb7f646..b16b056f6c 100644
> >> --- a/libavcodec/videotoolboxenc.c
> >> +++ b/libavcodec/videotoolboxenc.c
> >> @@ -80,6 +80,8 @@ static struct{
> >>     CFStringRef kVTProfileLevel_H264_High_5_1;
> >>     CFStringRef kVTProfileLevel_H264_High_5_2;
> >>     CFStringRef kVTProfileLevel_H264_High_AutoLevel;
> >> +    CFStringRef kVTProfileLevel_H264_Extended_5_0;
> >> +    CFStringRef kVTProfileLevel_H264_Extended_AutoLevel;
> >> 
> >>     CFStringRef kVTProfileLevel_HEVC_Main_AutoLevel;
> >>     CFStringRef kVTProfileLevel_HEVC_Main10_AutoLevel;
> >> @@ -137,6 +139,8 @@ static void loadVTEncSymbols(){
> >>     GET_SYM(kVTProfileLevel_H264_High_5_1,           "H264_High_5_1");
> >>     GET_SYM(kVTProfileLevel_H264_High_5_2, "H264_High_5_2");
> >>     GET_SYM(kVTProfileLevel_H264_High_AutoLevel,     "H264_High_AutoLevel");
> >> +    GET_SYM(kVTProfileLevel_H264_Extended_5_0,       "H264_Extended_5_0");
> >> +    GET_SYM(kVTProfileLevel_H264_Extended_AutoLevel, "H264_Extended_AutoLevel");
> >> 
> >>     GET_SYM(kVTProfileLevel_HEVC_Main_AutoLevel,     "HEVC_Main_AutoLevel");
> >>     GET_SYM(kVTProfileLevel_HEVC_Main10_AutoLevel,   "HEVC_Main10_AutoLevel");
> >> @@ -154,6 +158,7 @@ typedef enum VT_H264Profile {
> >>     H264_PROF_BASELINE,
> >>     H264_PROF_MAIN,
> >>     H264_PROF_HIGH,
> >> +    H264_PROF_EXTENDED,
> >>     H264_PROF_COUNT
> >> } VT_H264Profile;
> >> 
> >> @@ -704,6 +709,14 @@ static bool get_vt_h264_profile_level(AVCodecContext *avctx,
> >>                                   compat_keys.kVTProfileLevel_H264_High_5_2;       break;
> >>             }
> >>             break;
> >> +        case H264_PROF_EXTENDED:
> >> +            switch (vtctx->level) {
> >> +                case  0: *profile_level_val =
> >> +                                  compat_keys.kVTProfileLevel_H264_Extended_AutoLevel; break;
> >> +                case 50: *profile_level_val =
> >> +                                  compat_keys.kVTProfileLevel_H264_Extended_5_0;       break;
> >> +            }
> >> +            break;
> >>     }
> >> 
> >>     if (!*profile_level_val) {
> >> @@ -2531,6 +2544,7 @@ static const AVOption h264_options[] = {
> >>     { "baseline", "Baseline Profile", 0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_BASELINE }, INT_MIN, INT_MAX, VE, "profile" },
> >>     { "main",     "Main Profile",     0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_MAIN     }, INT_MIN, INT_MAX, VE, "profile" },
> >>     { "high",     "High Profile",     0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_HIGH     }, INT_MIN, INT_MAX, VE, "profile" },
> >> +    { "extended", "Extend Profile",   0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_EXTENDED }, INT_MIN, INT_MAX, VE, "profile" },
> >> 
> >>     { "level", "Level", OFFSET(level), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 52, VE, "level" },
> >>     { "1.3", "Level 1.3, only available with Baseline Profile", 0, AV_OPT_TYPE_CONST, { .i64 = 13 }, INT_MIN, INT_MAX, VE, "level" },
> >> -- 
> >> 2.21.0
> >> 
> > _______________________________________________
> > 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".
Richard Kern Sept. 3, 2019, 1:21 a.m.
On Mon, Sep 2, 2019 at 9:53 AM Limin Wang <lance.lmwang@gmail.com> wrote:

> On Tue, Aug 27, 2019 at 10:56:42AM -0400, Richard Kern wrote:
>
> > I’ll look at it this weekend.
> ping
>
>
It shows error kVTParameterErr when using the software encoder:

Error setting profile/level property: -12902

I used the following command for testing: ffmpeg -i "$mediaFile" -c:v
h264_videotoolbox -profile:v extended -y -require_sw 1 h264.ts


It defaults to High profile in the output.



The hardware encoder also fails to encode using Extended profile, but the
OS complains the parameter isn't supported. It also defaults to High
profile in the output, which seems like a good default.



Can you try both hardware and software encodes on your end? If you're
seeing Extended profile using ffprobe on either output file, I'll push the
changes.



>
> > > On Aug 27, 2019, at 10:40 AM, Limin Wang <lance.lmwang@gmail.com>
> wrote:
> > >
> > >
> > > ping the patchset.
> > >
> > >> On Tue, Aug 20, 2019 at 07:04:29PM +0800, lance.lmwang@gmail.com
> wrote:
> > >> From: Limin Wang <lance.lmwang@gmail.com>
> > >>
> > >> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > >> ---
> > >> libavcodec/videotoolboxenc.c | 14 ++++++++++++++
> > >> 1 file changed, 14 insertions(+)
> > >>
> > >> diff --git a/libavcodec/videotoolboxenc.c
> b/libavcodec/videotoolboxenc.c
> > >> index d76bb7f646..b16b056f6c 100644
> > >> --- a/libavcodec/videotoolboxenc.c
> > >> +++ b/libavcodec/videotoolboxenc.c
> > >> @@ -80,6 +80,8 @@ static struct{
> > >>     CFStringRef kVTProfileLevel_H264_High_5_1;
> > >>     CFStringRef kVTProfileLevel_H264_High_5_2;
> > >>     CFStringRef kVTProfileLevel_H264_High_AutoLevel;
> > >> +    CFStringRef kVTProfileLevel_H264_Extended_5_0;
> > >> +    CFStringRef kVTProfileLevel_H264_Extended_AutoLevel;
> > >>
> > >>     CFStringRef kVTProfileLevel_HEVC_Main_AutoLevel;
> > >>     CFStringRef kVTProfileLevel_HEVC_Main10_AutoLevel;
> > >> @@ -137,6 +139,8 @@ static void loadVTEncSymbols(){
> > >>     GET_SYM(kVTProfileLevel_H264_High_5_1,           "H264_High_5_1");
> > >>     GET_SYM(kVTProfileLevel_H264_High_5_2, "H264_High_5_2");
> > >>     GET_SYM(kVTProfileLevel_H264_High_AutoLevel,
>  "H264_High_AutoLevel");
> > >> +    GET_SYM(kVTProfileLevel_H264_Extended_5_0,
>  "H264_Extended_5_0");
> > >> +    GET_SYM(kVTProfileLevel_H264_Extended_AutoLevel,
> "H264_Extended_AutoLevel");
> > >>
> > >>     GET_SYM(kVTProfileLevel_HEVC_Main_AutoLevel,
>  "HEVC_Main_AutoLevel");
> > >>     GET_SYM(kVTProfileLevel_HEVC_Main10_AutoLevel,
>  "HEVC_Main10_AutoLevel");
> > >> @@ -154,6 +158,7 @@ typedef enum VT_H264Profile {
> > >>     H264_PROF_BASELINE,
> > >>     H264_PROF_MAIN,
> > >>     H264_PROF_HIGH,
> > >> +    H264_PROF_EXTENDED,
> > >>     H264_PROF_COUNT
> > >> } VT_H264Profile;
> > >>
> > >> @@ -704,6 +709,14 @@ static bool
> get_vt_h264_profile_level(AVCodecContext *avctx,
> > >>
>  compat_keys.kVTProfileLevel_H264_High_5_2;       break;
> > >>             }
> > >>             break;
> > >> +        case H264_PROF_EXTENDED:
> > >> +            switch (vtctx->level) {
> > >> +                case  0: *profile_level_val =
> > >> +
> compat_keys.kVTProfileLevel_H264_Extended_AutoLevel; break;
> > >> +                case 50: *profile_level_val =
> > >> +
> compat_keys.kVTProfileLevel_H264_Extended_5_0;       break;
> > >> +            }
> > >> +            break;
> > >>     }
> > >>
> > >>     if (!*profile_level_val) {
> > >> @@ -2531,6 +2544,7 @@ static const AVOption h264_options[] = {
> > >>     { "baseline", "Baseline Profile", 0, AV_OPT_TYPE_CONST, { .i64 =
> H264_PROF_BASELINE }, INT_MIN, INT_MAX, VE, "profile" },
> > >>     { "main",     "Main Profile",     0, AV_OPT_TYPE_CONST, { .i64 =
> H264_PROF_MAIN     }, INT_MIN, INT_MAX, VE, "profile" },
> > >>     { "high",     "High Profile",     0, AV_OPT_TYPE_CONST, { .i64 =
> H264_PROF_HIGH     }, INT_MIN, INT_MAX, VE, "profile" },
> > >> +    { "extended", "Extend Profile",   0, AV_OPT_TYPE_CONST, { .i64 =
> H264_PROF_EXTENDED }, INT_MIN, INT_MAX, VE, "profile" },
> > >>
> > >>     { "level", "Level", OFFSET(level), AV_OPT_TYPE_INT, { .i64 = 0 },
> 0, 52, VE, "level" },
> > >>     { "1.3", "Level 1.3, only available with Baseline Profile", 0,
> AV_OPT_TYPE_CONST, { .i64 = 13 }, INT_MIN, INT_MAX, VE, "level" },
> > >> --
> > >> 2.21.0
> > >>
> > > _______________________________________________
> > > 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".
> _______________________________________________
> 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".
lance.lmwang@gmail.com Sept. 3, 2019, 2:39 a.m.
On Mon, Sep 02, 2019 at 09:21:11PM -0400, Rick Kern wrote:
> On Mon, Sep 2, 2019 at 9:53 AM Limin Wang <lance.lmwang@gmail.com> wrote:
> 
> > On Tue, Aug 27, 2019 at 10:56:42AM -0400, Richard Kern wrote:
> >
> > > I’ll look at it this weekend.
> > ping
> >
> >
> It shows error kVTParameterErr when using the software encoder:
> 
> Error setting profile/level property: -12902
> 
> I used the following command for testing: ffmpeg -i "$mediaFile" -c:v
> h264_videotoolbox -profile:v extended -y -require_sw 1 h264.ts
> 
> 
> It defaults to High profile in the output.
> 
> 
> 
> The hardware encoder also fails to encode using Extended profile, but the
> OS complains the parameter isn't supported. It also defaults to High
> profile in the output, which seems like a good default.
> 
> 
> 
> Can you try both hardware and software encodes on your end? If you're
> seeing Extended profile using ffprobe on either output file, I'll push the
> changes.
> 
I'm adding the missing profile/level by the apple document:
https://developer.apple.com/documentation/videotoolbox/vtcompressionsession/compression_properties/profile_and_level_constants
My iMac/macpro can't support the extended profile for sw and hw, so I add patch#2 to check the error. 
If someone have ios hardware can try it. 

Thanks,
Limin
> 
> 
> >
> > > > On Aug 27, 2019, at 10:40 AM, Limin Wang <lance.lmwang@gmail.com>
> > wrote:
> > > >
> > > >
> > > > ping the patchset.
> > > >
> > > >> On Tue, Aug 20, 2019 at 07:04:29PM +0800, lance.lmwang@gmail.com
> > wrote:
> > > >> From: Limin Wang <lance.lmwang@gmail.com>
> > > >>
> > > >> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > > >> ---
> > > >> libavcodec/videotoolboxenc.c | 14 ++++++++++++++
> > > >> 1 file changed, 14 insertions(+)
> > > >>
> > > >> diff --git a/libavcodec/videotoolboxenc.c
> > b/libavcodec/videotoolboxenc.c
> > > >> index d76bb7f646..b16b056f6c 100644
> > > >> --- a/libavcodec/videotoolboxenc.c
> > > >> +++ b/libavcodec/videotoolboxenc.c
> > > >> @@ -80,6 +80,8 @@ static struct{
> > > >>     CFStringRef kVTProfileLevel_H264_High_5_1;
> > > >>     CFStringRef kVTProfileLevel_H264_High_5_2;
> > > >>     CFStringRef kVTProfileLevel_H264_High_AutoLevel;
> > > >> +    CFStringRef kVTProfileLevel_H264_Extended_5_0;
> > > >> +    CFStringRef kVTProfileLevel_H264_Extended_AutoLevel;
> > > >>
> > > >>     CFStringRef kVTProfileLevel_HEVC_Main_AutoLevel;
> > > >>     CFStringRef kVTProfileLevel_HEVC_Main10_AutoLevel;
> > > >> @@ -137,6 +139,8 @@ static void loadVTEncSymbols(){
> > > >>     GET_SYM(kVTProfileLevel_H264_High_5_1,           "H264_High_5_1");
> > > >>     GET_SYM(kVTProfileLevel_H264_High_5_2, "H264_High_5_2");
> > > >>     GET_SYM(kVTProfileLevel_H264_High_AutoLevel,
> >  "H264_High_AutoLevel");
> > > >> +    GET_SYM(kVTProfileLevel_H264_Extended_5_0,
> >  "H264_Extended_5_0");
> > > >> +    GET_SYM(kVTProfileLevel_H264_Extended_AutoLevel,
> > "H264_Extended_AutoLevel");
> > > >>
> > > >>     GET_SYM(kVTProfileLevel_HEVC_Main_AutoLevel,
> >  "HEVC_Main_AutoLevel");
> > > >>     GET_SYM(kVTProfileLevel_HEVC_Main10_AutoLevel,
> >  "HEVC_Main10_AutoLevel");
> > > >> @@ -154,6 +158,7 @@ typedef enum VT_H264Profile {
> > > >>     H264_PROF_BASELINE,
> > > >>     H264_PROF_MAIN,
> > > >>     H264_PROF_HIGH,
> > > >> +    H264_PROF_EXTENDED,
> > > >>     H264_PROF_COUNT
> > > >> } VT_H264Profile;
> > > >>
> > > >> @@ -704,6 +709,14 @@ static bool
> > get_vt_h264_profile_level(AVCodecContext *avctx,
> > > >>
> >  compat_keys.kVTProfileLevel_H264_High_5_2;       break;
> > > >>             }
> > > >>             break;
> > > >> +        case H264_PROF_EXTENDED:
> > > >> +            switch (vtctx->level) {
> > > >> +                case  0: *profile_level_val =
> > > >> +
> > compat_keys.kVTProfileLevel_H264_Extended_AutoLevel; break;
> > > >> +                case 50: *profile_level_val =
> > > >> +
> > compat_keys.kVTProfileLevel_H264_Extended_5_0;       break;
> > > >> +            }
> > > >> +            break;
> > > >>     }
> > > >>
> > > >>     if (!*profile_level_val) {
> > > >> @@ -2531,6 +2544,7 @@ static const AVOption h264_options[] = {
> > > >>     { "baseline", "Baseline Profile", 0, AV_OPT_TYPE_CONST, { .i64 =
> > H264_PROF_BASELINE }, INT_MIN, INT_MAX, VE, "profile" },
> > > >>     { "main",     "Main Profile",     0, AV_OPT_TYPE_CONST, { .i64 =
> > H264_PROF_MAIN     }, INT_MIN, INT_MAX, VE, "profile" },
> > > >>     { "high",     "High Profile",     0, AV_OPT_TYPE_CONST, { .i64 =
> > H264_PROF_HIGH     }, INT_MIN, INT_MAX, VE, "profile" },
> > > >> +    { "extended", "Extend Profile",   0, AV_OPT_TYPE_CONST, { .i64 =
> > H264_PROF_EXTENDED }, INT_MIN, INT_MAX, VE, "profile" },
> > > >>
> > > >>     { "level", "Level", OFFSET(level), AV_OPT_TYPE_INT, { .i64 = 0 },
> > 0, 52, VE, "level" },
> > > >>     { "1.3", "Level 1.3, only available with Baseline Profile", 0,
> > AV_OPT_TYPE_CONST, { .i64 = 13 }, INT_MIN, INT_MAX, VE, "level" },
> > > >> --
> > > >> 2.21.0
> > > >>
> > > > _______________________________________________
> > > > 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".
> > _______________________________________________
> > 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".

Patch hide | download patch | download mbox

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index d76bb7f646..b16b056f6c 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -80,6 +80,8 @@  static struct{
     CFStringRef kVTProfileLevel_H264_High_5_1;
     CFStringRef kVTProfileLevel_H264_High_5_2;
     CFStringRef kVTProfileLevel_H264_High_AutoLevel;
+    CFStringRef kVTProfileLevel_H264_Extended_5_0;
+    CFStringRef kVTProfileLevel_H264_Extended_AutoLevel;
 
     CFStringRef kVTProfileLevel_HEVC_Main_AutoLevel;
     CFStringRef kVTProfileLevel_HEVC_Main10_AutoLevel;
@@ -137,6 +139,8 @@  static void loadVTEncSymbols(){
     GET_SYM(kVTProfileLevel_H264_High_5_1,           "H264_High_5_1");
     GET_SYM(kVTProfileLevel_H264_High_5_2,           "H264_High_5_2");
     GET_SYM(kVTProfileLevel_H264_High_AutoLevel,     "H264_High_AutoLevel");
+    GET_SYM(kVTProfileLevel_H264_Extended_5_0,       "H264_Extended_5_0");
+    GET_SYM(kVTProfileLevel_H264_Extended_AutoLevel, "H264_Extended_AutoLevel");
 
     GET_SYM(kVTProfileLevel_HEVC_Main_AutoLevel,     "HEVC_Main_AutoLevel");
     GET_SYM(kVTProfileLevel_HEVC_Main10_AutoLevel,   "HEVC_Main10_AutoLevel");
@@ -154,6 +158,7 @@  typedef enum VT_H264Profile {
     H264_PROF_BASELINE,
     H264_PROF_MAIN,
     H264_PROF_HIGH,
+    H264_PROF_EXTENDED,
     H264_PROF_COUNT
 } VT_H264Profile;
 
@@ -704,6 +709,14 @@  static bool get_vt_h264_profile_level(AVCodecContext *avctx,
                                   compat_keys.kVTProfileLevel_H264_High_5_2;       break;
             }
             break;
+        case H264_PROF_EXTENDED:
+            switch (vtctx->level) {
+                case  0: *profile_level_val =
+                                  compat_keys.kVTProfileLevel_H264_Extended_AutoLevel; break;
+                case 50: *profile_level_val =
+                                  compat_keys.kVTProfileLevel_H264_Extended_5_0;       break;
+            }
+            break;
     }
 
     if (!*profile_level_val) {
@@ -2531,6 +2544,7 @@  static const AVOption h264_options[] = {
     { "baseline", "Baseline Profile", 0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_BASELINE }, INT_MIN, INT_MAX, VE, "profile" },
     { "main",     "Main Profile",     0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_MAIN     }, INT_MIN, INT_MAX, VE, "profile" },
     { "high",     "High Profile",     0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_HIGH     }, INT_MIN, INT_MAX, VE, "profile" },
+    { "extended", "Extend Profile",   0, AV_OPT_TYPE_CONST, { .i64 = H264_PROF_EXTENDED }, INT_MIN, INT_MAX, VE, "profile" },
 
     { "level", "Level", OFFSET(level), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 52, VE, "level" },
     { "1.3", "Level 1.3, only available with Baseline Profile", 0, AV_OPT_TYPE_CONST, { .i64 = 13 }, INT_MIN, INT_MAX, VE, "level" },