Jump to content

Enable hardware acceleration on FreeBSD


Duffyx

Recommended Posts

Regarding HW acceleration, I noticed that my plugin installation (v 4.4.3) on FreeNAS 11.3U4.1 shows VAAPI as an available encoder:

443_Plugin_HWEnc.png.3f885c6fe83c5c0a5f1bc09871a43697.png

whereas my manual jail installation (4.5.0.17) does not:

450_Jail_HW.png.917b8a4859f55a5345bf92458aee4059.png

Is the plugin in fact capable of HW encoding? Do I need to do something different on the jail to get it working?

I followed @MRobi instructions here:

I'm using an older Radeon R5 230 card in the server.

Thanks,
CFC

 

Edited by CFC
Link to comment
Share on other sites

Well they both have the vaapi libs included, we're just not yet sure what the issue is with the jail version. It could just be that the jail needs to be given access to the GPU, but we're not sure yet.

Link to comment
Share on other sites

Doesn't work here either. Tested with FreeNAS 11.3.U4.1 and 12 (TrueNAS). That system has both Intel HD630 and Nvidia GTX1660Ti hardware.

When this finally gets resolved, I will move to that server as the main Emby server. Until then, with only software encoding, no point.

Link to comment
Share on other sites

MRobi
19 hours ago, CFC said:

 

Is the plugin in fact capable of HW encoding?

 

In simplest terms, no. FreeNAS 11.3 does not have stable support for GPU passthrough. I've seen people using the TrueNAS beta having success with certain GPU's but it doesn't seem like everything is compatible yet.(Appears to be only older intel CPU's)

 

https://github.com/kern2011/Freenas-Quicksync

Edited by MRobi
Link to comment
Share on other sites

I tried TrueNAS, and Intel nor Nvidia worked. So not sure what hardware people found to work, if they actually did. I am sure the issue is with Emby being able to work with GPU hardware.

Link to comment
Share on other sites

2 hours ago, MRobi said:

In simplest terms, no. FreeNAS 11.3 does not have stable support for GPU passthrough. I've seen people using the TrueNAS beta having success with certain GPU's but it doesn't seem like everything is compatible yet.(Appears to be only older intel CPU's)

 

https://github.com/kern2011/Freenas-Quicksync

Thanks.

That's too bad. I was optimistic since VAAPI was actually showing up as an option for "Preferred Hardware Encoder".

For now I'll use my FreeNAS server for simple storage and keep using Emby Server on my Windows box to take advantage of Quicksync.


CFC

Link to comment
Share on other sites

MRobi
21 hours ago, dcol said:

I tried TrueNAS, and Intel nor Nvidia worked. So not sure what hardware people found to work, if they actually did. I am sure the issue is with Emby being able to work with GPU hardware.

I don't see how it can be an Emby issue if FreeNAS doesn't allow GPU passthrough to the jails....

From what I've read the FreeNAS drivers currently supports Intel CPU's Gen 2 through 7 and your chipset and board must support iGPU. So it's very limited at this point in time. That's got nothing to do with Emby being able to work with a GPU or not, that's a FreeNAS restriction that will limit Emby from even being able to see a GPU.

Link to comment
Share on other sites

So is it FreeNAS or FreeBSD? All socket 1151 desktop motherboards will support iGPU and Emby is not showing any transcode hardware.

My guess at this point is it will happen in a year or so. Maybe when FreeBSD goes to version 13. For now Emby on FreeNAS is only good for LiveTV recording and libraries that do not need transcoding.

Link to comment
Share on other sites

MRobi
5 hours ago, dcol said:

So is it FreeNAS or FreeBSD? All socket 1151 desktop motherboards will support iGPU and Emby is not showing any transcode hardware.

My guess at this point is it will happen in a year or so. Maybe when FreeBSD goes to version 13. For now Emby on FreeNAS is only good for LiveTV recording and libraries that do not need transcoding.

FreeNAS is based off of FreeBSD and is often behind. Example, FreeBSD 12 released at the end of 2018 and FreeNAS/TrueNAS is just releasing it into beta now. And if FreeNAS/FreeBSD is not passing the GPU through to the jail, of course Emby won't show any transcode hardware. A jail is segregated from the main system, it's like it's running on it's own little mini server, and if that little mini server has no GPU, it won't detect one.

I transcode multiple streams with Emby on FreeNAS on a daily basis. But I've got the hardware to do it. Dual e5-2690 processors transcode whatever I need without breaking a sweat so I wouldn't say it's only good for LiveTV and libraries that don't need transcoding. 

Link to comment
Share on other sites

I would like to see a screen shot of your hardware transcoders in Emby. I have the same GPU and do not see any

Link to comment
Share on other sites

Just now, dcol said:

I would like to see a screen shot of your hardware transcoders in Emby. I have the same GPU and do not see any

I think he's implying that he has enough processing power to be able to do CPU transcoding, so his server has more purpose than just Live TV and storage for Emby.

CFC

Link to comment
Share on other sites

bingemeister

I don't think FreeBSD or FreeNAS are the problem here. As I wrote in March, I am able to transcode files using ffmpeg directly and my iGPU within a jail. You only need to apply the right devfs ruleset to expose the device files to the jail. You can then make use of it when running ffmpeg.

Link to comment
Share on other sites

Oh, that makes more sense. I have 32 threads in the FreeNAS box and it was a dog with software encoding when other NAS functions were occurring.

Link to comment
Share on other sites

It is, at this point, not worth the effort it would take to tweak FreeNAS when Windows handles everything just fine.

Link to comment
Share on other sites

MRobi
On 8/14/2020 at 5:46 PM, CFC said:

I think he's implying that he has enough processing power to be able to do CPU transcoding, so his server has more purpose than just Live TV and storage for Emby.

CFC

Correct, currently at the cottage and transcoding and streaming a 1080p file with cpu usage at under 10% LOL

 

On 8/14/2020 at 5:51 PM, bingemeister said:

I don't think FreeBSD or FreeNAS are the problem here. As I wrote in March, I am able to transcode files using ffmpeg directly and my iGPU within a jail. You only need to apply the right devfs ruleset to expose the device files to the jail. You can then make use of it when running ffmpeg.

So you have gpu transcoding working within a jail? I'd love to hear more.

While I say my cpu has more than enough to handle whatever I throw at it, once the option is available I'll definitely be sticking a graphics card in there because well.... why not?

Link to comment
Share on other sites

  • 2 months later...

I've recently installed TrueNAS Core 12 and the Emby plugin.

Within the transcode settings it finds VAAPI H.264 Encoder (I have A10-5700 CPU with AMD HD 7660D GPU).

However, transcoding still reverts to software. I didn't see anything in this thread to help, is there anything I can try to get hardware encoding?

image.png.bea7ec928ce1eaa7d2ed84fad641d653.png

image.png.953704d725a826ae7fa7e1c43a538701.png

Link to comment
Share on other sites

4 hours ago, Wesss said:

I've recently installed TrueNAS Core 12 and the Emby plugin.

Within the transcode settings it finds VAAPI H.264 Encoder (I have A10-5700 CPU with AMD HD 7660D GPU).

However, transcoding still reverts to software. I didn't see anything in this thread to help, is there anything I can try to get hardware encoding?

image.png.bea7ec928ce1eaa7d2ed84fad641d653.png

image.png.953704d725a826ae7fa7e1c43a538701.png

Hi there, do you have Emby Premiere? Please attach the emby server, hardware detection, and ffmpeg logs. thanks.

Link to comment
Share on other sites

I also have TrueNAS and tried the Emby plugin and never got transcoding to work. This system has Intel HD630 and Nvidia RTX4000 which are not recognized as decoders or encoders by Emby. I thought it was a FreeBSD limitation. I think FreeBSD needs something added to it. I am not a Linux guy, so I don't have a clue what to do. But I do know the default installation doesn't support hardware acceleration.

Let me know if you get that working and how

Edited by dcol
Link to comment
Share on other sites

19 hours ago, Luke said:

Hi there, do you have Emby Premiere? Please attach the emby server, hardware detection, and ffmpeg logs. thanks.

Hi Luke!  Yes, I'm Premiere. Here are the logs.

Looks like this is the failure point:

ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with FreeBSD clang version 8.0.1 (tags/RELEASE_801/final 366581) (based on LLVM 8.0.1)
[...]
[AVHWDeviceContext @ 0x8009fe200] No VA display found for device /dev/dri/renderD128.
Device creation failed: -22.
Failed to set value 'vaapi=vad0:/dev/dri/renderD128' for option 'init_hw_device': Invalid argument
Error parsing global options: Invalid argument

hardware_detection-63739205311.txt embyserver.txt ffmpeg-transcode-1f6e6c95-f1c3-4897-a660-876989b2f27e_1.txt

Link to comment
Share on other sites

2 hours ago, Wesss said:

Hi Luke!  Yes, I'm Premiere. Here are the logs.

Looks like this is the failure point:

ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with FreeBSD clang version 8.0.1 (tags/RELEASE_801/final 366581) (based on LLVM 8.0.1)
[...]
[AVHWDeviceContext @ 0x8009fe200] No VA display found for device /dev/dri/renderD128.
Device creation failed: -22.
Failed to set value 'vaapi=vad0:/dev/dri/renderD128' for option 'init_hw_device': Invalid argument
Error parsing global options: Invalid argument

hardware_detection-63739205311.txt 111.5 kB · 0 downloads embyserver.txt 370.39 kB · 0 downloads ffmpeg-transcode-1f6e6c95-f1c3-4897-a660-876989b2f27e_1.txt 28.14 kB · 0 downloads

This plugin wasn't packaged by us and isn't using our ffmpeg build, so it will be hard to troubleshoot. Did someone say there were two emby plugins for truenas?

Link to comment
Share on other sites

That's right, an "Emby" and an "Emby Server" plugin, and I chose the "Emby" one.

However, what I can find seems to indicate they may be identical other than one defaults to DHCP and the other to NAT. https://github.com/ix-plugin-hub/iocage-plugin-index .

How can I download the ffmpeg and what location should it be placed so that your freebsd ffmpeg version is used?

From https://www.truenas.com/plugins/:

image.thumb.png.4acfeb987020ed414a65f96e950739e3.png

Link to comment
Share on other sites

25 minutes ago, Wesss said:

That's right, an "Emby" and an "Emby Server" plugin, and I chose the "Emby" one.

However, what I can find seems to indicate they may be identical other than one defaults to DHCP and the other to NAT. https://github.com/ix-plugin-hub/iocage-plugin-index .

How can I download the ffmpeg and what location should it be placed so that your freebsd ffmpeg version is used?

From https://www.truenas.com/plugins/:

image.thumb.png.4acfeb987020ed414a65f96e950739e3.png

You can't, but you can try the process @MRobi mentioned here: 

 

Link to comment
Share on other sites

I updated to the latest beta release via shell commands and the hardware acceleration was still not recognized. It is something within FreeBSD that needs patching. It's not ffmpeg, it's FreeBSD.

If you figure it out please post. I am not using the plugin until hardware accel is working.

Link to comment
Share on other sites

bingemeister

Hardware encoding works fine for me with ffmpeg on FreeBSD, even within a jail. The command I used to test it:

ffmpeg -vaapi_device /dev/dri/card0 -i input.mp4 -vf 'format=nv12,hwupload' -c:v h264_vaapi output.mp4

I don't have a dedicated GPU, but it's still twice as fast and consumes only a third of CPU power compared to CPU-only encoding. So I don't think there is anything wrong with FreeBSD. It's just that emby doesn't recognize it properly.

If you try it from within a jail you of course need to expose the device files to the jail which can easily be done through devfs rules.

Link to comment
Share on other sites

17 minutes ago, dcol said:

It is something within FreeBSD that needs patching. It's not ffmpeg, it's FreeBSD.

What makes you think that? For the moment I am using Plex, in a jail, with hardware acceleration.
I haven't touched the FreeBSD sources at all to make this work.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...