“Apple VT H264 Hardware Encoder" unlocked for Apple Silicon M1

RustySly

New Member
hey guys, i've been using macbook air m1 16gb for a couple of weeks for streaming and i am generally happy with the performance, m1 is an absolute beast. but, the "x264" encoding in obs' current state (lack of m1 compatibility) leaves a lot to be desired. it's almost impossible to stream at 1080p 60fps with a good quality and hardware encoding is unavailable, so i've been waiting for the arm compatibility patch.

today, i was on discord and saw an issue on github containing a fix for obs to allow using the "apple vt h264 hardware encoder". i built the obs with required changes and managed to unlock the hardware encoding! so far, great performance.

you can see the code here, all credit to polamjag and sharkyrawr: Apple VT H264 Hardware Encoder not available in Apple Silicon (M1) MacBook Pro · Issue #4170 · obsproject/obs-studio · GitHub

i'll attach the "mac-vth264.so" zip file, all you gotta do is replace it with the one in the folder "obs>contents>plugins". of course this is a temporary solution but i thought you could try it for yourself and test it. i don't know if it's ok to share such a file, if not please remove :)
 

Attachments

  • mac-vth264.so.zip
    12.3 KB · Views: 4,125

itrends

New Member
i'll attach the "mac-vth264.so" zip file, all you gotta do is replace it with the one in the folder "obs>contents>plugins". of course this is a temporary solution but i thought you could try it for yourself and test it. i don't know if it's ok to share such a file, if not please remove :)

What other settings are you using? Would you mind posting your full recording and streaming config at all? E.g. the profile... are you using baseline etc
 

itrends

New Member
Update : I closed OBS. It 'crashed' after closing. Now when trying to launch it just bounces forever. Suspect this may not be ready to use. :(

UPDATE 2: Logged out. Logged in and it booted again. Presently unsure if related but leaving this here in case others see the same.
 

Bada

New Member
I've tested it on a M1 Mac mini and it seems to be working, but you actually can't stream to Twitch or Youtube. I'm not sure what the problem is. I was able to record it btw. Can you upload the full build of OBS? Here's what Twitch say on the Inspector:
스크린샷 2021-02-04 오전 10.42.40.png
 

thmsdj

New Member
I've tested it on a M1 Mac mini and it seems to be working, but you actually can't stream to Twitch or Youtube. I'm not sure what the problem is. I was able to record it btw. Can you upload the full build of OBS? Here's what Twitch say on the Inspector:View attachment 66910
Yeah, I have the same issue. It seems that it somehow can't lock the bitrate :( Hopefully there will be a fix soon. Can't wait to get my M1 Air streaming some sweet 1080p video.
 

maximilianmuc

New Member
i'll attach the "mac-vth264.so" zip file, all you gotta do is replace it with the one in the folder "obs>contents>plugins". of course this is a temporary solution but i thought you could try it for yourself and test it. i don't know if it's ok to share such a file, if not please remove :)


Thank you for this post?

I am new to the Mac.
For those who do not know where to put the file:

.so is a plugin file.

In Finder, go to "Applications", then to OBS Control+click (right-click), view package contents: There then Contents/PlugIns. There is already such a file, overwrite it - but maybe save it first...
 

Bada

New Member
Tested again using a custom rtmp server:

Apple VT Hardware encoder -> NGINX RTMP server -> restream it to Twitch is working. There's no additional encoding process at all, So I don't think this is a bitrate problem.

스크린샷 2021-02-05 오전 8.50.15.png
스크린샷 2021-02-05 오전 8.53.55.png

(Incompatible is normal for VT encoder)
 

Koen Willems

New Member
I was thinkering: considering the architecture of the Apple Silicon M1, is there really a difference between software or hardware encoding at all?
 

Yangtse

New Member
i'll attach the "mac-vth264.so" zip file, all you gotta do is replace it with the one in the folder "obs>contents>plugins". of course this is a temporary solution but i thought you could try it for yourself and test it. i don't know if it's ok to share such a file, if not please remove :)
This is genius, man! Thanks a mille! Worked right from the start and reduced CPU load on my MB Air from around 50% to less than 10%! Even streaming to youTube in 1440p60 worked like a charm. This is the future. I hope that the OBS developer community will soon integrate it into an official release (can't be that hard since the essential coding has obviously been done already. A big hand to those guys!)
 

komplik

New Member
i'll attach the "mac-vth264.so" zip file, all you gotta do is replace it with the one in the folder "obs>contents>plugins". of course this is a temporary solution but i thought you could try it for yourself and test it. i don't know if it's ok to share such a file, if not please remove :)

HI, great stuff. It works great, just tried it to record some footage. I was able to record smooth 1080p with x264 superfast, so poor overall quality and my MBA was throttling with mostly 100°C. With HW acceleration I can use it to record 1080p with higher quality and low CPU utilization and after hour it averages at 60°C.
 

rd1

New Member
idk why but it works now… did you update the file?
@Bada
It will not record audio If you set checkmark "Limit bitrate" in advanced output settings.
Without checkmark audio is recorded properly.
Also I have not tested streaming yet, only recording.

@RustySly
Thank a lot for this fix! You are awesome!
 

vicantu

New Member
Thanks @RustySly !

I have a Mac Mini with the silicon M1, 16 GB Ram and 512 GB SSD, I am using elgato cam-link 4K USB connected to a Sony a6400 at 10p 60fps, for my case, I just need to record locally the video produced by the last version of OBS, not streaming for the moment.

The problem I have after using your solution is that if I select Apple VT H264 Hardware Encoder no matter which bitrate I selected for Recording (I used 10,000 20,000 and 30,000 kbps for example), the MOV file generated is huge because it do not respect the bitrates I selected, I can see the bitrate inside the file is on the hundred of thousands.

This is normal with this "hack" or there is something I can do?

thanks
 

JonesTheHulk

New Member
This is awesome! Replaced in the plugin folder and works perfectly on the Macbook Pro M1 2020. Streaming Warzone in a bit so we shall see how we get on! :)
 

Bada

New Member
@Bada
It will not record audio If you set checkmark "Limit bitrate" in advanced output settings.
Without checkmark audio is recorded properly.
Also I have not tested streaming yet, only recording.

@RustySly
Thank a lot for this fix! You are awesome!

Oh Thanks for the information, yeah. It seems you have to uncheck the "limit bitrate" option for now.
 

CKayJr

New Member
I am streaming and recording LIVE to Facebook w/a Sony 4K cam, HQ HDMI cable (15 ft) to BMG UltraStudio 3G, TB3 to 16" MBP, i9/32GB RAM/8GB Video Card. This is for a live church service. Cam is about 60-70 feet away in balcony. 20X optical zoom. I am using VT H264 hardware encoding for stream. CPU resources is 10% or lower. I am streaming and recording at same time. Don't have the hardware option for encoding on the record settings. However, my video is not smooth, looks like it is dropping frames like 1 of every 2 or so with visual motion (a tad jerky, but not terrible). But driving me nuts! Cam is on a rock solid Monfretto tripod. My actual encoded stream or recording is not showing hardly any dropped frames. It is the actual capture or throughput to the MBP that seems to be the problem. I have both Cam and OBS set to 1080/30p. I have the Sony cam steady-shot feature set to off (thinking it was messing w/video). Could it be an exposure issue w/cam set to auto? Also, what should my keyframe interval be for recording? I'm including some screenshots. Tell me what I need to fix! I really need some help. Thx!!
 

Attachments

  • Screen Shot 2021-02-28 at 9.20.27 PM.png
    Screen Shot 2021-02-28 at 9.20.27 PM.png
    717.9 KB · Views: 899
  • Screen Shot 2021-02-28 at 9.19.03 PM.png
    Screen Shot 2021-02-28 at 9.19.03 PM.png
    699.9 KB · Views: 893
  • Screen Shot 2021-02-28 at 9.19.24 PM.png
    Screen Shot 2021-02-28 at 9.19.24 PM.png
    603 KB · Views: 824
  • Screen Shot 2021-02-28 at 9.19.43 PM.png
    Screen Shot 2021-02-28 at 9.19.43 PM.png
    569.6 KB · Views: 808

BenMitchell

New Member
Hello! I have just recompiled OBS for apple silicon using the latest code from the master branch on the OBS GitHub. I've also added the virtual camera to the build too.

You will need qt@5 and ffmpeg installed to use it:
`brew install qt@5 ffmpeg`

In order to open it you will have to right click and press open, you might have to do this twice because the build is not signed or notarised.

Download: link
 

kellemar

New Member
Hello! I have just recompiled OBS for apple silicon using the latest code from the master branch on the OBS GitHub. I've also added the virtual camera to the build too.

You will need qt@5 and ffmpeg installed to use it:
`brew install qt@5 ffmpeg`

In order to open it you will have to right click and press open, you might have to do this twice because the build is not signed or notarised.

Download: link

I'm getting these errors when I try to start a stream using your M1 build. Any ideas?

13:58:24.216:
13:58:26.072: Output 'adv_stream': Tried to set a delay value on a non-encoded output
13:58:26.072: Stream output type 'rtmp_output' failed to start!
 
Top