Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Aleksid1

macrumors member
Nov 14, 2017
98
51
Do you know, is there any patch for FFmpeg (libx264) for encoding H.264 video on M1 Macs? Something similar as NEON arm64 optimizations for HEVC.
 

Botts85

macrumors regular
Feb 9, 2007
229
175
I'm really looking forward to picking up an M1 Pro or Max Mac mini in the spring, and comparing their encode blocks to the quality of CPU-based x265. Now my Mac mini encodes at about the same speed as an eight-core AMD Ryzen 4750G — getting 70% more from an M1 Pro or Max will blow away AMD's x86.
The encode blocks are the same as they are in the M1. It is notably worse than software x265 for the same bitrate.
I could send you a copy of Tears of Steel, or BBB encoded with both if you wanted to see.

I could also benchmark the M1 Pro vs the M1 on software x265 if you wanted.
 

Admiral

macrumors 6502
Mar 14, 2015
408
992
The encode blocks are the same as they are in the M1. It is notably worse than software x265 for the same bitrate.
I could send you a copy of Tears of Steel, or BBB encoded with both if you wanted to see.

I could also benchmark the M1 Pro vs the M1 on software x265 if you wanted.

A kind offer, but don't ruin the surprise!
 

jfx-2021

macrumors newbie
Sep 1, 2021
27
1
Hello, by using Videotoolbox there is not the RF setting than there is a CQ Setting slider.
Do you can say which setting there is good for 4K? Maybe in 264. and 265.

Thank you very much
 

stuartfuk

macrumors member
Sep 24, 2020
35
60
The encode blocks are the same as they are in the M1. It is notably worse than software x265 for the same bitrate.
I could send you a copy of Tears of Steel, or BBB encoded with both if you wanted to see.

I could also benchmark the M1 Pro vs the M1 on software x265 if you wanted.
On my M1 Max MacBook Pro using VideoToolBox with CQ70 on the latest Handbrake nightly I get a significantly larger file on the Max when compared with my M1 Mac mini for the same h265 encode

I think that Apple may have tweaked the encoders for the M1 Max and Pro to improve quality at lower setting

I had to drop my CQ to get a similar file size and subjectively video quality seems the same
 

stuartfuk

macrumors member
Sep 24, 2020
35
60
Hello, by using Videotoolbox there is not the RF setting than there is a CQ Setting slider.
Do you can say which setting there is good for 4K? Maybe in 264. and 265.

Thank you very much
I use CQ 70 on the M1 Mac mini for h265 but this does create quite a large file

What is interesting is that CQ 55, 65 give very similar encode times
 

jfx-2021

macrumors newbie
Sep 1, 2021
27
1
But only VideoToolBox is fast or? When I use (Have only iMac M1) the normal settings without VTB it is extreme slow. Is that right?
 

jfx-2021

macrumors newbie
Sep 1, 2021
27
1
What cores are working when VTB are active? I have no idea. But the system run than ton 50-60 % GPU 10-20.
I have no idea what cores than work on this projects.

And by the way what is now better to use: FR/CQ or the middle bit rate (for example 5000 kbps)?
 
Last edited:

stuartfuk

macrumors member
Sep 24, 2020
35
60
What cores are working when VTB are active? I have no idea. But the system run than ton 50-60 % GPU 10-20.
I have no idea what cores than work on this projects.

And by the way what is now better to use: FR/CQ or the middle bit rate (for example 5000 kbps)?
In my experience CPU and GPU cores are also active when using VTB and allocated as needed

I only use CQ with Frame Rate set to original so cannot comment on data rate
 

jfx-2021

macrumors newbie
Sep 1, 2021
27
1
The Pro and Max have a Video encoder incl. A bit like afterburner.
The M1 has nothing like this or a smaller version too?
 

stuartfuk

macrumors member
Sep 24, 2020
35
60
The Pro and Max have a Video encoder incl. A bit like afterburner.
The M1 has nothing like this or a smaller version too?
The Afterburner card speeds up Pro-Res decode and playback but not encode

The standard M1 has no Pro-Res engine that would provide similar functionality to Afterburner

The M1 Pro has an engine that accelerates Pro-Res encode, decode and playback
The M1 Max has two of these engines for Pro-Res encode, decode and playback

Separate to this there are engines for video encode/decode

The M1 has dedicated silicon to support H264/H265 encode and decode engines
The M1 Pro has the same but I think from my own experience the engines have has been improved from M1 at the same CQ setting but I could be wrong

The M1 Max has an extra H264/H265 encode engine over the M1 Pro (x2) with the same single decode engine as the M1 Pro

Hopefully I got that right!

Stuart
 

jfx-2021

macrumors newbie
Sep 1, 2021
27
1
Ah ok. is that than possible that this encored/decode Systems from M1 / Pro / Max work wehen Video Toolbox is running?
And when not the normal CPU's/GPU work more?


But I think it funny, that when I use 264 VTB on M1 iMac and on my old 2013 MBPr 15" 2,3 Ghz i7 QC than both systems are nearly same fast. Only when I use not VTB the iMac is 3-5 times faster. What in hell is Video Tool Box?
 
Last edited:

Ethosik

Contributor
Oct 21, 2009
8,144
7,120
I don't think you want to transcode from H.264 to H.265. If you had the original source then transcoded it to H.265 you will get better results... H.264 is already compressed (it threw information away to compress it that is lost forever). Trying to compress a compressed format only throws more information away. The results will be sub-optimal.

I doubt you want to give up quality for disk space... because if you did, you would have used a more aggressive compression format from the start.
I have done this so many times, and I have not noticed any difference compressing H.264 to H.265. If I target about 60% of the H.264 bitrate, it looks nearly identical. I am sure if I put it side by side in a photo editor and REALLY LOOK I can see a difference, but just by general watching? No difference at all. And I have 60% space used out of 20 TB (so just by getting H.265 files I saved 8TB) which is a LOT. Definitely worth it even if there was a minor difference but I certainly cannot notice it.
 
  • Like
Reactions: marshalleq

jfx-2021

macrumors newbie
Sep 1, 2021
27
1
Thx but the speed is the same. Really funny, that an nearly 6-7 year older i7 can do same speed with VTB. And it has no T2 or encoders like M1. Only the system runs max out 100% on the i7. Who take than a lot more power like the little Watts on an M1.
 

Ethosik

Contributor
Oct 21, 2009
8,144
7,120
Thx but the speed is the same. Really funny, that an nearly 6-7 year older i7 can do same speed with VTB. And it has no T2 or encoders like M1. Only the system runs max out 100% on the i7. Who take than a lot more power like the little Watts on an M1.
I think we are pretty much at the limit of this type of video work. I used a 2010 Mac Pro for H.264 work and upgrading to a 2019 i9 iMac did not help at all. It does seem to be better if I have the source in ProRes and export in ProRes then use compressor to directly HEVC. But having my "source" as H.264 and exporting to HEVC is still pretty slow these days.
 

Botts85

macrumors regular
Feb 9, 2007
229
175
Hello, by using Videotoolbox there is not the RF setting than there is a CQ Setting slider.
Do you can say which setting there is good for 4K? Maybe in 264. and 265.

Thank you very much
Based on my testing, that CQ slider is fake. It's just a proxy for constant bitrate.
 

Botts85

macrumors regular
Feb 9, 2007
229
175
On my M1 Max MacBook Pro using VideoToolBox with CQ70 on the latest Handbrake nightly I get a significantly larger file on the Max when compared with my M1 Mac mini for the same h265 encode

I think that Apple may have tweaked the encoders for the M1 Max and Pro to improve quality at lower setting

I had to drop my CQ to get a similar file size and subjectively video quality seems the same
That's intriguing. I tried it on an M1, and M1 Max and saw identical file sizes. That was a nightly from a couple weeks back. Same version of Handbrake on both?
The M1 Pro has an engine that accelerates Pro-Res encode, decode and playback
The M1 Max has two of these engines for Pro-Res encode, decode and playback

Separate to this there are engines for video encode/decode

The M1 Max has an extra H264/H265 encode engine over the M1 Pro (x2) with the same single decode engine as the M1 Pro
The M1 Max has an extra ProRes engine, but there's been no indication of additional H264/H265 encode/decode hardware.
 

marshalleq

macrumors newbie
Aug 1, 2015
2
2
I have done this so many times, and I have not noticed any difference compressing H.264 to H.265. If I target about 60% of the H.264 bitrate, it looks nearly identical. I am sure if I put it side by side in a photo editor and REALLY LOOK I can see a difference, but just by general watching? No difference at all. And I have 60% space used out of 20 TB (so just by getting H.265 files I saved 8TB) which is a LOT. Definitely worth it even if there was a minor difference but I certainly cannot notice it.
Yeah, I've done quite a bit now and find that I average a 70% space saving. I've had way more than that and occasionally less, but mostly around 70. I just tried an optimised ffmpeg for M1, it was fast but reading this I decided to go back to tried and true software based encoding. My experience was that it was the same as a 10 year old xeon limited to 4 cores which is a bit of a surprise, but perhaps there are more optimisations to come. (Xeon E5-2620 v3 at 2.4GHz). I used the home-brew copy of ffmpeg (version 5.01) in case someone can point out I need a different one! A 4 core xeon at 2.4GHz should not perform better than a 10 core at 3.2GHz I would have thought - so there must be some optimisations missing or something I did wrong!
 

Admiral

macrumors 6502
Mar 14, 2015
408
992
The encode blocks are the same as they are in the M1. It is notably worse than software x265 for the same bitrate.
I could send you a copy of Tears of Steel, or BBB encoded with both if you wanted to see.

I could also benchmark the M1 Pro vs the M1 on software x265 if you wanted.

One of the things being lost in most of these replies is that many of us, including me, have been curious about M1 Pro's performance with x265 CPU-based (software) encoding, rather than the performance of Apple's encode blocks. I prefer CPU-based encoding for quality reasons, as well as smaller file sizes.

Well, I bought a 16" MacBook Pro with 10-core M1 Pro CPU, and tested. It seems that double the performance cores in M1 Pro yields a 70-80% performance increase in x265 CPU-based encoding at the same settings in Handbrake. Not bad. Since the only difference between M1 Pro and M1 Max is the number of GPU cores, and GPU cores are not used by ffmpeg/Handbrake for encoding, anyone primarily interested in CPU-based encoding can settle for M1 Pro.

I'd love to see if your benchmark matches my experience.

Since I have previous experience with VideoToolbox encoding using Apple's T2 coprocessor and the encode blocks on M1, I tested that out as well. While there was clearly a quality difference between the files, the quality improvement in VideoToolbox encoding is rather impressive (the VideoToolbox hardware-encoded file at CQ 34, the default setting, was 25% smaller than the CPU-encoded file, too; at CQ 50 the file sizes were basically the same). With some adjustments, it might turn out that VideoToolbox can match CPU-based encoding.

Later in the summer, I may spring for a Mac Studio with M1 Ultra, or whatever's shipping then. What would the increase in CPU performance cores mean for CPU-based encoding? There seems to be an accepted truism about Handbrake (and therefore ffmpeg) that it doesn't get much performance gain after eight cores, which is the number of performance cores in the M1 Pro and Max. But at the same time, there is a setting in Handbrake to allow multiple parallel encodes. Also, does Handbrake/ffmpeg take advantage of the M1 Ultra's two encoding blocks for hardware-based HEVC encoding, either making single encodes that much faster, or separately powering parallel encodes? That will be interesting to find out. If not now, I'll bet someone — possibly Apple — is working hard on getting that into ffmpeg right now.
 
Last edited:

Hedo

macrumors regular
Jan 12, 2016
101
115
I'm bumping an older thread as I can get a cheap Macbook Air M1 (2020) from a friend who's upgraded and my question is about the same as this topic. I use my currenct Windows laptop (Lenovo Slim 7 i5-1240P) on the go to reencode video files to h265 with Intel Quicksync and on medium settings with Vidcoder I can shrink a 4GB 1080p h264-file to under 1 GB with decent quality (avg bitrate 2000) in 10ish minutes.

How would a Macbook Air with M1 fare with such reencoding jobs, will it be able to do a decent hardware encoding job such as Intel Quicksync or Nvidia NVenc within the same timeframe as my currenct laptop? And besides Handbrake, are there any apps like Vidcoder on the Mac that's recommended?
 

steve62388

macrumors 68040
Apr 23, 2013
3,100
1,962
I'm bumping an older thread as I can get a cheap Macbook Air M1 (2020) from a friend who's upgraded and my question is about the same as this topic. I use my currenct Windows laptop (Lenovo Slim 7 i5-1240P) on the go to reencode video files to h265 with Intel Quicksync and on medium settings with Vidcoder I can shrink a 4GB 1080p h264-file to under 1 GB with decent quality (avg bitrate 2000) in 10ish minutes.

How would a Macbook Air with M1 fare with such reencoding jobs, will it be able to do a decent hardware encoding job such as Intel Quicksync or Nvidia NVenc within the same timeframe as my currenct laptop? And besides Handbrake, are there any apps like Vidcoder on the Mac that's recommended?
Handbrake supports hardware encoding on Apple Silicon. However you will always get compromised quality or size when using it (same with Quicksync or nvenc). I use software encoding but it takes longer.
 

Honza1

macrumors 6502a
Nov 30, 2013
940
441
US
I'm bumping an older thread as I can get a cheap Macbook Air M1 (2020) from a friend who's upgraded and my question is about the same as this topic. I use my currenct Windows laptop (Lenovo Slim 7 i5-1240P) on the go to reencode video files to h265 with Intel Quicksync and on medium settings with Vidcoder I can shrink a 4GB 1080p h264-file to under 1 GB with decent quality (avg bitrate 2000) in 10ish minutes.

How would a Macbook Air with M1 fare with such reencoding jobs, will it be able to do a decent hardware encoding job such as Intel Quicksync or Nvidia NVenc within the same timeframe as my currenct laptop? And besides Handbrake, are there any apps like Vidcoder on the Mac that's recommended?
I have M1 mini (8GB/512GB) which I use for encoding. Handbrake, as noted above, offers two options - hardware encoder for 265 or software one. Hardware encoder is shockingly fast, forgot what it was, but it was few minutes per 2 hour movie. There are very few controls for quality on this, though, and I did not like the quality for something I wanted to save for longer time. So I opted to use 2 pass software encoding, which runs faster than real time on this base hardware. I am fine with that.
I suspect that Google can find some comparisons between M1 and Intel encoders to tell you how the quality compares.
 

ignatius345

macrumors 604
Aug 20, 2015
7,646
13,096
I'm bumping an older thread as I can get a cheap Macbook Air M1 (2020) from a friend who's upgraded and my question is about the same as this topic. I use my currenct Windows laptop (Lenovo Slim 7 i5-1240P) on the go to reencode video files to h265 with Intel Quicksync and on medium settings with Vidcoder I can shrink a 4GB 1080p h264-file to under 1 GB with decent quality (avg bitrate 2000) in 10ish minutes.

How would a Macbook Air with M1 fare with such reencoding jobs, will it be able to do a decent hardware encoding job such as Intel Quicksync or Nvidia NVenc within the same timeframe as my currenct laptop? And besides Handbrake, are there any apps like Vidcoder on the Mac that's recommended?
One thing to remember with an Air is that there's no fan and it's passively cooled. So under sustained loads it might throttle and any comparison you see where someone is using (say) an M1 Mini, you might not see the same results. I don't have much recent experience with transcoding and can't say what kind of heat load it's likely to build up, but just something to consider if you're wanting to throw a giant pile of h.264 files to re-encode on that particular machine.
 

Admiral

macrumors 6502
Mar 14, 2015
408
992
Handbrake recently (well, a year ago) released version 1.6 which incorporates the new SVT-AV1 library in ffmpeg, and it's really impressive. On M1 MacBook Pro (eight performance cores), 4K content encodes proceed about 14-16 fps with very good quality and file sizes considerably smaller than h265 hardware encoding — 30-40% smaller.

SVT-AV1 encodes are considerably more performant than x265 software encodes, which on my machine top out around 6-8 fps. This is a surprise given that image quality is the same or better, and the file sizes so much smaller. At 14-16 fps it's considerably slower than h265 hardware encoding, which on my machine averages about 50-55 fps for 4K content. But for the me the image quality/file size tradeoff still makes AV1 the winner.

M3 Max is reportedly 50-80% faster than M1 Pro. Unless the hardware encoder for h265 is also 50-80% faster (some bleeding-edge guys will have a report for us soon), AV1 encoding at 20-30 fps seems like a no-brainer.

I wonder what M3 Ultra will do for these SVT-AV1 encodes? I hope someone's going to do a report. Right now I am thinking I will sit out M3 on the desktop because I just bought an M2 Max Mac Studio in June.

The downside is that M1 and M2 do not have hardware decoding for AV1. It's not an issue for normal playback because M1/M2 have a lot of power, but when starting a playback while an encode is underway there can be some stutter at the beginning. Apple did introduce AV1 hardware decoding in this week's new M3 machines, which will probably improve the playback experience even while an encode is going on; we might get so lucky to see hardware encoding in M4.

For this reason, it sure does seem like AV1 is better choice for right now.

But h266 is coming too.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.