jshridha / docker-blueiris

Blueiris in a docker using wine!
Apache License 2.0
105 stars 53 forks source link

Question: Does this enable HW decoding? #4

Open Fellhahn opened 5 years ago

Fellhahn commented 5 years ago

Hi,

Up to now I've been running Blue Iris on Windows Server in a (Hyper-V) virtual machine. One big drawback to this is that the virtualization layer does not allow the guest OS access to the hosts integrated graphics card, so no Intel QuickSync.

I'm fairly new to containerization. Can someone clarify for me, does running Blue Iris in a container like this project allow it to make use of Intel Quick Sync and improve video decoding efficiency?

Or do containers not allow pass through/access of iGFX either?

jshridha commented 5 years ago

Containers can allow access to GPUs, but they need to be set up appropriately. The one I have provided is still in early beta and I have not added in any ability for GPU support. I'm not positive on whether it can access the iGFX. My guess is that it would be highly unlikely to work in this situation especially since Blueiris does not have native Linux support and is running under windows emulation through wine.

I know Unraid allows for passthrough of host's integrated card into virtual machines, so I'd guess other KVM/QEMU based virtualization would also be able to do that. That would be my suggestion. Alternatively, your purchase a cheap, low power GPU that you can pass through to the guest VM.

labalicious commented 5 years ago

Running BlueIris in a virtual machine through unraid. I can confirm it allows pass through. I am running on a Xeon processor so I'm unable to use iGFX though.

On Mon, Feb 25, 2019, 6:28 AM Jay notifications@github.com wrote:

Containers can allow access to GPUs, but they need to be set up appropriately. The one I have provided is still in early beta and I have not added in any ability for GPU support. I'm not positive on whether it can access the iGFX. My guess is that it would be highly unlikely to work in this situation especially since Blueiris does not have native Linux support and is running under windows emulation through wine.

I know Unraid allows for passthrough of host's integrated card into virtual machines, so I'd guess other KVM/QEMU based virtualization would also be able to do that. That would be my suggestion. Alternatively, your purchase a cheap, low power GPU that you can pass through to the guest VM.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jshridha/docker-blueiris/issues/4#issuecomment-467031210, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGNWg5Os11WeoxW1eJJZizFwcmtRjWiks5vQ_MUgaJpZM4bO_u_ .

Fellhahn commented 5 years ago

Guys thank you both for taking the time to answer this, I appreciate it. I'm coming to the conclusion that discrete GPU pass through is indeed what's required. Starting to wish I knew my way around Xen or KVM as Discrete Device Assignment in Hyper-V looks to be very finicky and not well documented.

@labalicious can I ask what model of GPU you are using for pass through? AMD/nVidia, chip etc. And it's definitely allowing HW decoding in BI?

labalicious commented 5 years ago

I'm currently not doing a pass through because it's a headless server. However, I know it works because of the device LinusTechTips built where he had 8 people sharing one PC and playing video games on it. Here it is for your reference. https://youtu.be/uKJw8IKVYQ8

On Mon, Feb 25, 2019, 6:52 PM Fellhahn notifications@github.com wrote:

Guys thank you both for taking the time to answer this, I appreciate it. I'm coming to the conclusion that discrete GPU pass through is indeed what's required. Starting to wish I knew my way around Xen or KVM as Discrete Device Assignment in Hyper-V looks to be very finicky and not well documented.

@labalicious https://github.com/labalicious can I ask what model of GPU you are using for pass through? AMD/nVidia, chip etc. And it's definitely allowing HW decoding in BI?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jshridha/docker-blueiris/issues/4#issuecomment-467232734, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGNWj5EfaCCrAwtx2_4tWaGxNjipPFwks5vRHc0gaJpZM4bO_u_ .

Fellhahn commented 5 years ago

@jshridha please close this issue if you like, my question has been answered, thanks again.

OscarVanL commented 4 years ago

Any updates on this issue? I'd love to run this on my Synology NAS, but there's no way it's powerful enough unless it can use the iGPU.

Fellhahn commented 4 years ago

I haven't tried the BlueIris docker image yet, but I have moved most of my services to containers just in the last month.

I can say with certainty the Plex instance saw a HUGE improvement transcode performance, which leads me to believe that the containers can access native CPU capabilities.

OscarVanL commented 4 years ago

That's reassuring to know. Although in Plex's instance it does natively support GPU acceleration, whereas I'm not sure if @jshridha 's container has GPU acceleration disabled/not implemented entirely.

It's a shame it seems he's abandoned this container (not updated it in over 6 months) when it looks so promising.

It would allow me to shut down a computer I run 24/7 alongside my NAS for the sole purpose of running Blue Iris, wasting loads of electricity in the process.

jshridha commented 4 years ago

@OscarVanL Currently I have not tested to see if the hardware acceleration is working. This container is running wine to emulate windows api calls, and I'm not sure if wine fully supports hardware acceleration. It is certainly something to look into though.

OscarVanL commented 4 years ago

I've been doing some investigating into getting GPU Acceleration to work on my Synology 918+ NAS.

This has a Celeron J3455 (Apollo Lake) with Intel HD Graphics 500 and does support Intel Quick Sync.

Permissions

First I gave rwx perms to the NAS's /dev/dri folder:

sudo chmod 777 /dev/dri

(Note: On Synology NAS this gets reset at every reboot, so you will need to put this in a boot script)

Docker args

Here is an example docker run command I've been experimenting with variations of:

sudo docker run -d \
 --name="BlueIris" \
 -p 8080:8080 \
 -p 5900:5900 \
 -p 81:81 \
 -v /volume1/docker/BlueIris:/root/prefix32:rw \
 --device /dev/dri:/dev/dri \
 -e BLUEIRIS_VERSION=4 \
 jshridha/blueiris:dev

I have experimented with combinations of the following:

 --device /dev/dri/renderD128:/dev/dri/renderD128 \
 --device /dev/dri/card0:/dev/dri/card0 \
--device /dev/dri:/dev/dri \

Logs:

I opened a bash prompt to the container: sudo docker exec -it BlueIris /bin/bash

In all cases the correct Intel VGA controller is detected: apt-get install pciutils lspci -q | grep 'VGA'

This gives 00:02.0 VGA compatible controller: Intel Corporation HD Graphics 500 (rev 0b) This matches the result in the normal Synology bash and in the container's bash.

To run Blue Iris with Wine debugging enabled:

  1. Disable the autostart script: cd ~ mv blueiris.sh blueiris-disabled.sh

  2. Close Blue Iris's window in VNC.

  3. Start Wine with GPU logs enabled (as per: https://wiki.winehq.org/3D_Driver_Issues)

WINEDEBUG=+wgl wine prefix32/drive_c/Program\ Files/Blue\ Iris\ 4/BlueIris.exe &> wine-gpu.bi.log

All variations of the above docker --device values give the same logs in this log file.

ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4528:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5007:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM default
0067:fixme:file:FindFirstFileExW flags not implemented 0x00000002
0067:fixme:file:FindFirstFileExW flags not implemented 0x00000002
0067:fixme:file:FindFirstFileExW flags not implemented 0x00000002
0077:fixme:wininet:InternetSetOptionExW Flags 00000000 ignored
0077:fixme:wininet:InternetSetOptionW INTERNET_OPTION_SEND/RECEIVE_TIMEOUT/DATA_SEND_TIMEOUT 15000
0077:fixme:wininet:InternetSetOptionExW Flags 00000000 ignored
0077:fixme:wininet:InternetSetOptionExW Flags 00000000 ignored
0077:fixme:wininet:InternetSetOptionW INTERNET_OPTION_SEND/RECEIVE_TIMEOUT/DATA_SEND_TIMEOUT 15000
0072:fixme:avifile:AVIFileExit (): stub!
007f:fixme:win:EnumDisplayDevicesW ((null),0,0x419c384,0x00000000), stub!
007f:trace:wgl:X11DRV_WineGL_InitOpenglInfo GL version             : 3.1 Mesa 19.0.8.
007f:trace:wgl:X11DRV_WineGL_InitOpenglInfo GL renderer            : llvmpipe (LLVM 8.0, 128 bits).
007f:trace:wgl:X11DRV_WineGL_InitOpenglInfo GLX version            : 1.4.
007f:trace:wgl:X11DRV_WineGL_InitOpenglInfo Server GLX version     : 1.4.
007f:trace:wgl:X11DRV_WineGL_InitOpenglInfo Server GLX vendor:     : SGI.
007f:trace:wgl:X11DRV_WineGL_InitOpenglInfo Client GLX version     : 1.4.
007f:trace:wgl:X11DRV_WineGL_InitOpenglInfo Client GLX vendor:     : Mesa Project and SGI.
007f:trace:wgl:X11DRV_WineGL_InitOpenglInfo Direct rendering enabled: True

According to the 3D Driver Issues page the GL renderer should say something like "Intel HD 500", but it seems only a generic driver is there.

The GPU acceleration still doesn't work in Blue Iris.

It's quite possible Synology don't include the proper Intel 3D/OpenGL/Quick Sync drivers in the OS in the first place, since it is a headless NAS device. I really have no idea, and wouldn't know what commands to enter on the NAS to check.

I'm not knowledgeable about Linux GPU drivers, docker, and wine to even start diagnosing the problem. Hopefully someone else who knows more about this might be able to help.

OscarVanL commented 4 years ago

Upon more research: Xvfb used in this container does not support GPU acceleration.

(See here)

There's a table showing which X server supports GPU acceleration with that particular container here.

So it looks like a dead-end while this container uses Xvfb.

How big a job would it be to substitute Xvfb for an alternative that does support GPU acceleration?