Opened 8 months ago

Closed 2 months ago

Last modified 2 months ago

#7581 closed defect (fixed)

Main10 profile is not set for hevc_videotoolbox

Reported by: Nomis101 Owned by: kernrj
Priority: normal Component: avcodec
Version: git-master Keywords: videotoolbox
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

A video encoded with hevc_videotoolbox in main10 profile is recognized as "main" instead of "main10".

$ ffmpeg -i /Volumes/Developer/Test?.mkv -acodec copy -vcodec hevc_videotoolbox -b:v 20000k -tag:v hvc1 -profile:v main10 /Volumes/Developer/Test?.mp4
ffmpeg version N-92558-ge695b0beba-tessus https :evermeet.cx/ffmpeg/ Copyright (c) 2000-2018 the FFmpeg developers

built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
libavutil 56. 24.101 / 56. 24.101
libavcodec 58. 40.100 / 58. 40.100
libavformat 58. 23.101 / 58. 23.101
libavdevice 58. 6.100 / 58. 6.100
libavfilter 7. 46.101 / 7. 46.101
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100

[h264 @ 0x7fe15f001c00] sps_id 1 out of range
Guessed Channel Layout for Input Stream #0.1 : 7.1
Input #0, matroska,webm, from '/Volumes/Developer/Test?.mkv':

Metadata:

ENCODER : Lavf58.12.100

Duration: 00:00:11.05, start: 0.000000, bitrate: 32452 kb/s

Chapter #0:0: start 0.000000, end 10.000000
Metadata:

title : Chapter 01

Stream #0:0(eng): Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc
Metadata:

stereo_mode : block_lr
BPS-eng : 43109843
DURATION-eng : 01:30:57.994208333
NUMBER_OF_FRAMES-eng: 130861
NUMBER_OF_BYTES-eng: 29411658311
SOURCE_ID-eng : 001011
_STATISTICS_WRITING_DATE_UTC-eng: 2018-07-08 16:09:54
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
DURATION : 00:00:11.052000000

Side data:

stereo3d: frame alternate

Stream #0:1(deu): Audio: eac3, 48000 Hz, 7.1, fltp (default)
Metadata:

title : Surround 7.1
BPS-eng : 1152000
DURATION-eng : 01:30:58.016000000
NUMBER_OF_FRAMES-eng: 170563
NUMBER_OF_BYTES-eng: 785954304
_STATISTICS_WRITING_DATE_UTC-eng: 2018-07-08 16:09:54
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
DURATION : 00:00:10.971000000

Stream mapping:

Stream #0:0 -> #0:0 (h264 (native) -> hevc (hevc_videotoolbox))
Stream #0:1 -> #0:1 (copy)

Press [q] to stop, ? for help
[h264 @ 0x7fe15e009600] sps_id 1 out of range
[hevc_videotoolbox @ 0x7fe15e006c00] Color range not set for yuv420p. Using MPEG range.
[mp4 @ 0x7fe15e005a00] track 1: codec frame size is not set
Output #0, mp4, to '/Volumes/Developer/Test?.mp4':

Metadata:

encoder : Lavf58.23.101
Chapter #0:0: start 0.000000, end 10.000000
Metadata:

title : Chapter 01

Stream #0:0(eng): Video: hevc (hevc_videotoolbox) (hvc1 / 0x31637668), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 20000 kb/s, 23.98 fps, 24k tbn, 23.98 tbc
Metadata:

stereo_mode : block_lr
BPS-eng : 43109843
DURATION-eng : 01:30:57.994208333
NUMBER_OF_FRAMES-eng: 130861
NUMBER_OF_BYTES-eng: 29411658311
SOURCE_ID-eng : 001011
_STATISTICS_WRITING_DATE_UTC-eng: 2018-07-08 16:09:54
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES SOURCE_ID
DURATION : 00:00:11.052000000
encoder : Lavc58.40.100 hevc_videotoolbox

Side data:

stereo3d: frame alternate

Stream #0:1(deu): Audio: eac3 (ec-3 / 0x332D6365), 48000 Hz, 7.1, fltp (default)
Metadata:

title : Surround 7.1
BPS-eng : 1152000
DURATION-eng : 01:30:58.016000000
NUMBER_OF_FRAMES-eng: 170563
NUMBER_OF_BYTES-eng: 785954304
_STATISTICS_WRITING_DATE_UTC-eng: 2018-07-08 16:09:54
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
DURATION : 00:00:10.971000000

frame= 1 fps=0.0 q=0.0 size= 0kB time=00:00:00.31 bitrate= 1.7kbits/s[h264 @ 0x7fe15e07cc00] sps_id 1 out of range
frame= 16 fps= 16 q=-0.0 size= 512kB time=00:00:00.95 bitrate=4392.5kbits/frame= 32 fps= 21 q=-0.0 size= 2304kB time=00:00:01.59 bitrate=11833.8kbits[h264 @ 0x7fe15e00ce00] sps_id 1 out of range
frame= 48 fps= 23 q=-0.0 size= 3840kB time=00:00:02.26 bitrate=13876.4kbits[h264 @ 0x7fe15e009600] sps_id 1 out of range
frame= 64 fps= 25 q=-0.0 size= 5376kB time=00:00:02.93 bitrate=14984.9kbitsframe= 81 fps= 26 q=-0.0 size= 7168kB time=00:00:03.64 bitrate=16118.8kbits[h264 @ 0x7fe15e07cc00] sps_id 1 out of range
frame= 97 fps= 27 q=-0.0 size= 9216kB time=00:00:04.31 bitrate=17496.6kbits[h264 @ 0x7fe15e00ce00] sps_id 1 out of range
frame= 118 fps= 28 q=-0.0 size= 9728kB time=00:00:05.21 bitrate=15293.1kbits[h264 @ 0x7fe15e009600] sps_id 1 out of range
frame= 138 fps= 30 q=-0.0 size= 9728kB time=00:00:06.04 bitrate=13187.5kbitsframe= 155 fps= 30 q=-0.0 size= 11008kB time=00:00:06.74 bitrate=13365.7kbits[h264 @ 0x7fe15e07cc00] sps_id 1 out of range
frame= 172 fps= 30 q=-0.0 size= 13568kB time=00:00:07.45 bitrate=14917.4kbits[h264 @ 0x7fe15e00ce00] sps_id 1 out of range
frame= 190 fps= 31 q=-0.0 size= 16384kB time=00:00:08.18 bitrate=16394.1kbitsframe= 207 fps= 31 q=-0.0 size= 19200kB time=00:00:08.92 bitrate=17627.1kbits[h264 @ 0x7fe15e009600] sps_id 1 out of range
frame= 225 fps= 31 q=-0.0 size= 22016kB time=00:00:09.65 bitrate=18672.3kbits[h264 @ 0x7fe15e07cc00] sps_id 1 out of range
frame= 242 fps= 31 q=-0.0 size= 24576kB time=00:00:10.36 bitrate=19427.5kbits[h264 @ 0x7fe15e00ce00] sps_id 1 out of range
frame= 261 fps= 32 q=-0.0 size= 27392kB time=00:00:10.93 bitrate=20513.4kbitsframe= 265 fps= 31 q=-0.0 Lsize= 28858kB time=00:00:11.01 bitrate=21470.1kbits/s speed=1.28x
video:27312kB audio:1539kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.024384%

Test.mp4 is then recognized as "Stream #0:0(eng): Video: hevc (Main) (hvc1 / 0x31637668)" instead of "Main10".

$ ffmpeg -i /Volumes/Developer/Test?.mp4
ffmpeg version N-92558-ge695b0beba-tessus https :evermeet.cx/ffmpeg/ Copyright (c) 2000-2018 the FFmpeg developers

built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
libavutil 56. 24.101 / 56. 24.101
libavcodec 58. 40.100 / 58. 40.100
libavformat 58. 23.101 / 58. 23.101
libavdevice 58. 6.100 / 58. 6.100
libavfilter 7. 46.101 / 7. 46.101
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/Developer/Test?.mp4':

Metadata:

major_brand : isom
minor_version : 512
compatible_brands: isomiso2mp41
encoder : Lavf58.23.101

Duration: 00:00:11.05, start: 0.000000, bitrate: 21388 kb/s

Chapter #0:0: start 0.000000, end 10.000000
Metadata:

title : Chapter 01

Stream #0:0(eng): Video: hevc (Main) (hvc1 / 0x31637668), yuv420p(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 20243 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 24k tbc (default)
Metadata:

handler_name : VideoHandler?

Stream #0:1(deu): Audio: eac3 (ec-3 / 0x332D6365), 48000 Hz, 5.1(side), fltp, 1152 kb/s (default)
Metadata:

handler_name : SoundHandler?

Side data:

audio service type: main

Stream #0:2(eng): Data: bin_data (text / 0x74786574), 0 kb/s
Metadata:

handler_name : SubtitleHandler?

At least one output file must be specified

Also MediaInfo? tells about the video:

Video
ID :
1
Format :
HEVC
Format/Info? :
High Efficiency Video Coding
Format profile :
Main@L4.1@Main
Codec ID :
hvc1
Codec ID/Info :
High Efficiency Video Coding
Duration :
11 s 53 ms
Bit rate :
20.2 Mb/s
Width :
1 920 pixels
Height :
1 080 pixels
Display aspect ratio :
16:9
Frame rate mode :
Constant
Frame rate :
23.976 (24000/1001) FPS
Color space :
YUV
Chroma subsampling :
4:2:0
Bit depth :
8 bits
Scan type :
Progressive
Bits/(Pixel*Frame) :
0.407
Stream size :
26.7 MiB (95%)
Language :
English
Menus :
3
Codec configuration box :
hvcC

Change History (17)

comment:1 Changed 8 months ago by cehoyos

  • Keywords videotoolbox added; hevc_videotoolbox main10 removed
  • Priority changed from important to normal

Why do you believe that the output video is Main10?

comment:2 Changed 8 months ago by Nomis101

I don't believe it is main10, but it should be, because I set -profile:v main10.

comment:3 Changed 8 months ago by cehoyos

Why?
Does videotoolbox support Main10 encoding?

comment:4 Changed 8 months ago by kernrj

  • Owner set to kernrj
  • Status changed from new to open

It does. I'll look into it.

comment:5 Changed 8 months ago by kernrj

  • Reproduced by developer set

comment:6 Changed 6 months ago by KarelVD

Any update on this?

comment:7 Changed 6 months ago by kernrj

If someone would be willing to provide ssh access to the latest MacBook? Pro I can fix this issue. My hardware doesn't support Main 10.

comment:8 Changed 5 months ago by Nomis101

How does this ssh access work? Does it need to be the latest MacBook? Pro from 2018?

comment:9 follow-up: Changed 5 months ago by kernrj

SSH can be enabled by going to System Preferences -> Sharing and enabling Remote Login. The MBP from 2017 doesn't support Main 10 profile. I'm assuming the latest hardware does support it, since the API supports it.

comment:10 Changed 5 months ago by Nomis101

I see. Sadly I also don't have a recent MacBook? Pro, your one is more recent than mine. Mine is from 2016, but my MBP does support Main10 for x265, so I don't see why I should not support Main10 for videotoolbox. If I run this videotoolbox test: https://subler.org/downloads/VideoToolboxTest.zip
I get

ProfileLevel? = {

SupportedValueList? = (

"HEVC_Main10_AutoLevel",
"HEVC_Main_AutoLevel",
"HEVC_MainStill_AutoLevel",
"HEVC_Monochrome_AutoLevel"

);

comment:11 Changed 5 months ago by kernrj

Ok, looks like there is support for Main10, but only for the software HEVC encoder at the moment. The hardware encoder doesn't support it as of the 2017 MBP.

The tool on the subler.org website doesn't appear to be open source, so I've pushed a utility to check for supported encoders and properties (which will list the supported profiles): https://github.com/8birds/VTEncoderInfo.

comment:12 Changed 5 months ago by kirdes

Hi kemrj, according to the utility it seems also true for the (i guess) T2 HEVC encoder (AVE)

Encoder: Apple HEVC (AVE)
    Codec Type: HEVC/H.265
    Encoder ID: com.apple.videotoolbox.videoencoder.hevc.ave
    Codec Name: HEVC
    Encoder Name: Apple HEVC (AVE)
    Supported Properties:
        GammaLevel
        FigThreadPriority
        ConvergenceDurationForAverageDataRate
        AllowTemporalCompression
        ThrottleForBackground
        ExpectedDuration
        MaxKeyFrameInterval
        TransferFunction
        InputQueueMaxCount
        AllowFrameReordering
        PixelAspectRatio
        PoolPixelBufferAttributesSeed
        SourceFrameCount
        ContentLightLevelInfo
        ExpectedFrameRate
        MasteringDisplayColorVolume
        ICCProfile
        UsingHardwareAcceleratedVideoEncoder
        PoolPixelBufferAttributes
        DataRateLimits
        RealTime
        YCbCrMatrix
        PixelBufferPoolIsShared
        VideoEncoderPixelBufferAttributes
        FieldCount
        MultiPassStorage
        Priority
        ClientPID
        H264EntropyMode
        ColorPrimaries
        AverageBitRate
        EncoderID
        NumberOfPendingFrames
        FieldDetail
        EncoderUsage
        ProfileLevel
            HEVC_Main_AutoLevel
        MaxKeyFrameIntervalDuration
        CleanAperture
        PixelTransferProperties
        AllowPixelTransfer
        NumberOfSlices


comment:13 in reply to: ↑ 9 Changed 5 months ago by Nomis101

Replying to kernrj:

The MBP from 2017 doesn't support Main 10 profile. I'm assuming the latest hardware does support it, since the API supports it.

I was curious and checked the VideoToolboxText? on the latest MacBook? Pro from the local Apple Store. It was a MacBookPro15,1; Intel Core i7; 2.2 GHz. The result was:

Encoder: Apple HEVC (AVE)
    Codec Type: HEVC/H.265
    Encoder ID: com.apple.videotoolbox.videoencoder.hevc.ave
    Codec Name: HEVC
    Encoder Name: Apple HEVC (AVE)
    Supported Properties:
        GammaLevel
        FigThreadPriority
        ConvergenceDurationForAverageDataRate
        AllowTemporalCompression
        ThrottleForBackground
        ExpectedDuration
        MaxKeyFrameInterval
        TransferFunction
        InputQueueMaxCount
        AllowFrameReordering
        PixelAspectRatio
        PoolPixelBufferAttributesSeed
        SourceFrameCount
        ContentLightLevelInfo
        ExpectedFrameRate
        MasteringDisplayColorVolume
        ICCProfile
        UsingHardwareAcceleratedVideoEncoder
        PoolPixelBufferAttributes
        DataRateLimits
        RealTime
        YCbCrMatrix
        PixelBufferPoolIsShared
        VideoEncoderPixelBufferAttributes
        FieldCount
        MultiPassStorage
        Priority
        ClientPID
        H264EntropyMode
        ColorPrimaries
        AverageBitRate
        EncoderID
        NumberOfPendingFrames
        FieldDetail
        EncoderUsage
        ProfileLevel
            HEVC_Main_AutoLevel
        MaxKeyFrameIntervalDuration
        CleanAperture
        PixelTransferProperties
        AllowPixelTransfer
        NumberOfSlices
 
Encoder: Apple HEVC (HW)
    Codec Type: HEVC/H.265
    Encoder ID: com.apple.videotoolbox.videoencoder.hevc.gva
    Codec Name: HEVC
    Encoder Name: Apple HEVC (HW)
    Supported Properties:
        FigThreadPriority
        AllowTemporalCompression
        MaxKeyFrameInterval
        TransferFunction
        PixelAspectRatio
        AllowFrameReordering
        PoolPixelBufferAttributesSeed
        ContentLightLevelInfo
        ExpectedFrameRate
        MasteringDisplayColorVolume
        ICCProfile
        UsingHardwareAcceleratedVideoEncoder
        PoolPixelBufferAttributes
        DataRateLimits
        RealTime
        YCbCrMatrix
        PixelBufferPoolIsShared
        VideoEncoderPixelBufferAttributes
        FieldCount
        NegotiationDetails
        MultiPassStorage
        Priority
        ClientPID
        ColorPrimaries
        AverageBitRate
        EncoderID
        NumberOfPendingFrames
        FieldDetail
        ConnectionID
        EncoderUsage
        ProfileLevel
            HEVC_Main_AutoLevel
        CleanAperture
        PixelTransferProperties
        AllowPixelTransfer
        GammaLevel
 
Encoder: Apple HEVC (SW)
    Codec Type: HEVC/H.265
    Encoder ID: com.apple.videotoolbox.videoencoder.hevc.vcp
    Codec Name: HEVC
    Encoder Name: Apple HEVC (SW)
    Supported Properties:
        EncoderUsage
        RequireDeterministicDependencyAndReordering
        CleanAperture
        Quality
        ICCProfile
        VideoEncoderPixelBufferAttributes
        FieldCount
        NumberOfPendingFrames
        YCbCrMatrix
        RealTime
        AllowPixelTransfer
        NegotiationDetails
        ExpectedFrameRate
        PrivateKey000
        UsingCellular
        PrivateKey002
        SourceFrameCount
        PrivateKey004
        QuantizationScalingMatrixPreset
        ProfileLevel
            HEVC_Main10_AutoLevel
            HEVC_Main_AutoLevel
            HEVC_MainStill_AutoLevel
            HEVC_Monochrome_AutoLevel
        PixelBufferPoolIsShared
        MaxKeyFrameIntervalDuration
        PrivateKey024
        MasteringDisplayColorVolume
        PrivateKey035
        TransferFunction
        ThermalLevel
        FieldDetail
        ClientPID
        AllowFrameReordering
        PoolPixelBufferAttributesSeed
        MaxKeyFrameInterval
        AllowTemporalCompression
        ColorPrimaries
        NumberOfParallelCores
        PrivateKey001
        EncoderID
        PrivateKey003
        GammaLevel
        PrivateKey005
        ContentLightLevelInfo
        PoolPixelBufferAttributes
        QuantizationScalingLists
        PrivateKey023
        FigThreadPriority
        PixelTransferProperties
        PrivateKey034
        PrivateKey036
        MultiPassStorage
        InitialQP
        AverageBitRate
        RequiredHEVCPictureParameterSetID
        PixelAspectRatio
        InitialQPI
        RequiredHEVCSequenceParameterSetID

I could check other Hardware if that's of interest.

comment:14 Changed 2 months ago by kernrj

  • Resolution set to fixed
  • Status changed from open to closed

Some hardware encoders will silently convert 10-bit frames to 8-bit during encoding. To get 10-bit output, use software encoding by adding '-require_sw 1' on the command line.

Fixed in 98478c05edb674ec429c298fbe593bda493ba60f.

comment:15 Changed 2 months ago by Nomis101

Thanks for fixing this. What would be the complete command line command for encoding in 10-bit? I tried the one from the initial post, but this did not work. So I added "-require_sw 1" which made the encoding 6x slower, but the output still was only in profile "main" instead of "main10".

ffmpeg -i input.mkv -acodec copy -vcodec hevc_videotoolbox -b:v 20000k -tag:v hvc1 -require_sw 1 -profile:v main10 output.mp4

What do I need to change to make the output main10?

comment:16 Changed 2 months ago by kernrj

If the source isn't 10-bit, the encoder silently falls back to main profile. I used http://jell.yfish.us/media/jellyfish-3-mbps-hd-hevc-10bit.mkv for testing.

comment:17 Changed 2 months ago by Nomis101

OK, I see. It is also working for me with your sample, as well with other 10-bit input. Thanks for clarifying.

Note: See TracTickets for help on using tickets.