Apple Silicon HEVC Encoding

Do you have any reference for Apple Silicon HEVC encoding being faster/higher quality/smaller than Apple Silicon AVC encoding?

I’m very curious about the quality of Apple’s hardware encoders, especially any difference between the M2, variants of the M1, and compared with Quick Sync. I haven’t seen anything - have you?

Sure.

The example is .TS with an audio stream that will not sit in a regular MP4 container. MPEG-TS by its nature, is a bit of a pain to sort out. The CQ of 57 is probably a bit higher than needed for a quality reproduction but lower values are not significantly quicker and I would rather not bit-starve broadcast recordings and the quality is always as good as source. Using Apple Silicon VideoToolBox means the machines remain quiet, cool and plenty resources left for other tasks during transcoding:

[edit: M1, M1Pro vs M1Max added to subsequent post below]

21 Bridges (2019) Handbrake M1 Pro vs M1 Max

Original - Plex DVR Broadcast - MPEG-TS 2.93 GB

M1Pro

H.264
[19:13:42] hb_scan: path=/Users/rob/Movies/Movies/21 Bridges/21 Bridges (2019).ts, title_index=1
[19:30:49] work: average encoding speed for job is 186.444977 fps
2.00 GB
17min07sec

H.265
[20:27:37] hb_scan: path=/Users/rob/Movies/Movies/21 Bridges/21 Bridges (2019).ts, title_index=1
[20:41:02] work: average encoding speed for job is 201.152725 fps
1.81 GB
13min25sec

M1Max

H.264
[19:33:03] hb_scan: path=/Users/rob/Movies/Movies/21 Bridges (2019)/21 Bridges (2019).ts, title_index=1
[19:45:51] work: average encoding speed for job is 294.679535 fps
2.11 GB
12min48sec

H.265
[20:31:31] hb_scan: path=/Users/rob/Movies/Movies/21 Bridges (2019)/21 Bridges (2019).ts, title_index=1
[20:40:08] work: average encoding speed for job is 313.789276 fps
1.65 GB
8min37sec

Details for nerds:



General
ID                                       : 1 (0x1)
Complete name                            : /Users/rob/Movies/Movies/21 Bridges (2019)/21 Bridges (2019).ts
Format                                   : MPEG-TS
File size                                : 2.73 GiB
Duration                                 : 1 h 47 min
Overall bit rate mode                    : Variable
Overall bit rate                         : 3 619 kb/s

Video
ID                                       : 256 (0x100)
Menu ID                                  : 1 (0x1)
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Codec ID                                 : 27
Duration                                 : 1 h 47 min
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 25.000 FPS
Standard                                 : Component
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : MBAFF
Scan type, store method                  : Separated fields
Scan order                               : Top Field First
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709

Audio
ID                                       : 257 (0x101)
Menu ID                                  : 1 (0x1)
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Muxing mode                              : LATM
Codec ID                                 : 17-2
Duration                                 : 1 h 47 min
Bit rate mode                            : Variable
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Delay relative to video                  : -1 s 179 ms
Language                                 : English

Text
ID                                       : 258 (0x102)
Menu ID                                  : 1 (0x1)
Format                                   : DVB Subtitle
Codec ID                                 : 6
Duration                                 : 1 h 47 min
Delay relative to video                  : 1 s 778 ms
Language                                 : English

Menu
ID                                       : 4096 (0x1000)
Menu ID                                  : 1 (0x1)
Format                                   : AVC / AAC / DVB Subtitle
Duration                                 : 1 h 47 min
List                                     : 256 (0x100) (AVC) / 257 (0x101) (AAC, English) / 258 (0x102) (DVB Subtitle, English)
Language                                 :  / English / English
Service name                             : Service01
Service provider                         : FFmpeg
Service type                             : digital television



General
Complete name                            : /Users/rob/Movies/Movies/21 Bridges (2019)/21 Bridges (2019) [264].mp4
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42 (mp42/iso2/avc1/mp41)
File size                                : 1.86 GiB
Duration                                 : 1 h 47 min
Overall bit rate                         : 2 466 kb/s
Encoded date                             : UTC 2022-07-14 18:16:20
Tagged date                              : UTC 2022-07-14 18:16:20
Writing application                      : HandBrake 1.5.1 2022011000

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4
Format settings                          : CABAC / 2 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 2 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 1 h 47 min
Bit rate                                 : 2 142 kb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.041
Stream size                              : 1.62 GiB (87%)
Encoded date                             : UTC 2022-07-14 18:16:20
Tagged date                              : UTC 2022-07-14 18:16:20
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Commercial name                          : Dolby Digital
Codec ID                                 : ac-3
Duration                                 : 1 h 47 min
Source duration                          : 1 h 47 min
Bit rate mode                            : Constant
Bit rate                                 : 320 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Compression mode                         : Lossy
Stream size                              : 247 MiB (13%)
Source stream size                       : 247 MiB (13%)
Title                                    : Stereo
Language                                 : English
Service kind                             : Complete Main
Default                                  : Yes
Alternate group                          : 1
Encoded date                             : UTC 2022-07-14 18:16:20
Tagged date                              : UTC 2022-07-14 18:16:20
mdhd_Duration                            : 6475963



General
Complete name                            : /Users/rob/Movies/Movies/21 Bridges (2019)/21 Bridges (2019) [265].mp4
Format                                   : MPEG-4
Format profile                           : Base Media / Version 2
Codec ID                                 : mp42 (mp42/iso2/mp41)
File size                                : 1.68 GiB
Duration                                 : 1 h 47 min
Overall bit rate                         : 2 234 kb/s
Encoded date                             : UTC 2022-07-14 19:27:37
Tagged date                              : UTC 2022-07-14 19:27:37
Writing application                      : HandBrake 1.5.1 2022011000

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main@L4@Main
Codec ID                                 : hvc1
Codec ID/Info                            : High Efficiency Video Coding
Duration                                 : 1 h 47 min
Bit rate                                 : 1 909 kb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Bits/(Pixel*Frame)                       : 0.037
Stream size                              : 1.44 GiB (85%)
Encoded date                             : UTC 2022-07-14 19:27:37
Tagged date                              : UTC 2022-07-14 19:27:37
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Codec configuration box                  : hvcC

Audio
ID                                       : 2
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Commercial name                          : Dolby Digital
Codec ID                                 : ac-3
Duration                                 : 1 h 47 min
Source duration                          : 1 h 47 min
Bit rate mode                            : Constant
Bit rate                                 : 320 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 SPF)
Compression mode                         : Lossy
Stream size                              : 247 MiB (14%)
Source stream size                       : 247 MiB (14%)
Title                                    : Stereo
Language                                 : English
Service kind                             : Complete Main
Default                                  : Yes
Alternate group                          : 1
Encoded date                             : UTC 2022-07-14 19:27:37
Tagged date                              : UTC 2022-07-14 19:27:37
mdhd_Duration                            : 6475963

Handbrake Settings:

	Format: 	MP4, Chapter Markers, Web Optimized, Align A/V Start

	Range: 	Title 1, Chapter 1, 1 Foreign Language Search Pass - 

	Dimensions: 	Source: 1920x1080, Output: 1920x1080

	Filters: 	Decomb (Default)

	Video: 	Encoder: (VideoToolbox), Framerate: Same as source (constant), Constant Quality: 57.00 CQ
	Video Options: 	Preset: quality, Tune: none, Profile: auto, Level: auto

	Audio: 	0: English (aac_latm LC) (2.0 ch) (128 kbps) ▸ Encoder: AC3, Mixdown: Stereo, Samplerate: 48 khz, Bitrate: 320 kbps```

I wish it was possible for users to split a conversation to a new thread in the forums.

Thanks! It’s very interesting that H.265 is faster than H.264, and that the M1 Max is so much faster than the M1. It’s even more interesting that compared to the M1, the M1 Max produces a larger H.264 file and smaller H.265 file.

Have you seen or done any objective (VMAF) quality comparisons? The only comments I’ve seen put VideoToolbox + Apple Silicon behind NVENC and QSV for quality.


Re: AAC LATM, it should be possible (and automatic with recent ffmpeg) to repackage for MP4:

FFmpeg Bitstream Filters Documentation

I don’t want to comment further on this thread (perhaps you can ask a mod to move this off-topic exchange elsewhere) but for accuracy the comparisons above are between an M1 Pro and M1 Max. On a different thread I could add the vanilla M1 comparator and any additional details but I do not have an M2 machine to hand.

:coffee:

1 Like

Moved your conversation to a new thread.

Let me know if I missed any of the posts, need to change location, tags, etc.

@FordGuy61 - Thank-you and all looks good to me. :+1:

1 Like

@Volts - Results including the vanilla ASi M1:

21 Bridges (2019) Handbrake M1 Pro vs M1 Max

Original - Plex DVR Broadcast - MPEG-TS 2.93 GB

M1

H.264
[11:21:59] hb_scan: path=/Users/rob/Desktop/21 Bridges (2019)/21 Bridges (2019).ts, title_index=1
[11:38:11] work: average encoding speed for job is 166.893768 fps
2.01 GB
19min08sec

H.265
[11:00:50] hb_scan: path=/Users/rob/Desktop/21 Bridges (2019)/21 Bridges (2019).ts, title_index=1
[11:14:51] work: average encoding speed for job is 192.731827 fps
1.81 GB
14min01sec

M1Pro

H.264
[19:13:42] hb_scan: path=/Users/rob/Movies/Movies/21 Bridges/21 Bridges (2019).ts, title_index=1
[19:30:49] work: average encoding speed for job is 186.444977 fps
2.00 GB
17min07sec

H.265
[20:27:37] hb_scan: path=/Users/rob/Movies/Movies/21 Bridges/21 Bridges (2019).ts, title_index=1
[20:41:02] work: average encoding speed for job is 201.152725 fps
1.81 GB
13min25sec

M1Max

H.264
[19:33:03] hb_scan: path=/Users/rob/Movies/Movies/21 Bridges (2019)/21 Bridges (2019).ts, title_index=1
[19:45:51] work: average encoding speed for job is 294.679535 fps
2.11 GB
12min48sec

H.265
[20:31:31] hb_scan: path=/Users/rob/Movies/Movies/21 Bridges (2019)/21 Bridges (2019).ts, title_index=1
[20:40:08] work: average encoding speed for job is 313.789276 fps
1.65 GB
8min37sec

[Opinion mode - On; easily dismissed!]
I’m not entirely convinced as to the merit of using vmaf on digital broadcast 1080 material. The original broadcast compression may or may not be good (the example used is from BBC HD where they produce a really good quality for the bitrate achieved - others are not so good) but the qualitative and subjective results are dominated in most cases by the eventual upscaling from 1080p to 2160p for the average large-format 4K display.

I find the quality of upscaling broadcast material varies considerably. A number of years ago I would not have imagined that the upscaling quality of a display would eventually rival and in some cases overtake that of a quality AV amp but LG OLEDs from 2019 onwards did just that. Almost all others (still in my view btw) have failed to come close to LG though until Sony managed it recently whilst using the same LG panel (go figure).

I would not be surprised if a dedicated 1080p display in an A to B comparison would reveal the differences as detected by vmaf (and there are many on the forum who can do that far better than I) but with the dominance of 4K in the market it matters little to most.

My settings produce material indistinguishable from the TS original. Others could probably refine them further to produce a faster and/or smaller file size and I enjoy seeing what others use.
[Opinion mode - Off]

You mentioned the difference between ASi and QuickSync and the comments on quality. This certainly appeared to be the case in the early days of M1 vs the latest QSV but things have changed.

M1Pro and M1Max were excellent from the outset and the M1 itself was improved considerably with later macOS revisions and all 3 SoCs rival QSV now. The only oddity is the M1Ultra which has the quality but not quite the expected performance. Given the market this SoC was targeted at this is somewhat surprising.

I’ll have another look at LATM audio ‘management’ so thanks for the tip as learning is never over given tech developments!

:coffee:

That’s what I’m looking for, but I can’t find any such comparison. Samples, comparison material, whether subjective or objective.

I see a few comments about it being improved, or less-bad compared to Quick Sync, but I haven’t seen a real comparison.

I don’t think VMAF is perfect when talking about 3rd generation (and more) re-encodings, but it’s by far the best thing available.

If anybody is aware of anything, please share!

Do you still have those samples you made? Willing to also do the vmaf analysis? Or to share the files?

1 Like

As far as I have read, the future with H.265 and Apple silicon can only be good. So just bring it on…

@Volts - I checked and I do still have these files and the source but I am wary of delving into metricating subjectivity on open forum. The knowledgeable and the wise tend to extricate themselves rapidly when the hubris takes over a thread.

@SE56 probably said it best with
the line on the future and that Apple has bet the farm on the A/V market and its use of dedicated silicon for HW acceleration on every predictable workload. H.264 was always the compromise of ‘fast/compact/good - now pick any 2’. With H.265 on ASi you can have all 3 and that feels pretty good.

To reminisce not that long ago, the following found on the Apple Developers Forum.

What are the chances that H.265 will actually be supported in the Apple OS world besides cellular streaming in FaceTime?

** Accepted Reply:**

H.265 is not currently supported. Please file an enhancement request at bugreporter.apple.com with details as to why you would like to see this addition.

Just 6 Years ago.

Any idea when Apple will support h.265 natively on iOS? Again 6 years ago

Agreed Robbie_UK, it feels real good… :joy: :joy:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.