Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evaluate current state of hardware transcoding support #88

Closed
TheNickOfTime opened this issue Jul 29, 2024 · 4 comments · Fixed by #191
Closed

Evaluate current state of hardware transcoding support #88

TheNickOfTime opened this issue Jul 29, 2024 · 4 comments · Fixed by #191
Assignees
Labels
priority/2-med type/feature New feature or request
Milestone

Comments

@TheNickOfTime
Copy link
Owner

I believe it should just work by default, but I have not tested this. Additionally documentation needs to be made for setting up a worker container with hw transcoding support.

@TheNickOfTime TheNickOfTime added the type/feature New feature or request label Jul 29, 2024
@TheNickOfTime TheNickOfTime self-assigned this Jul 29, 2024
@TheNickOfTime TheNickOfTime added this to the v0.7 milestone Jul 29, 2024
@TheNickOfTime TheNickOfTime moved this to Todo in Development Jul 29, 2024
@TheNickOfTime TheNickOfTime moved this from Todo to In Progress in Development Aug 22, 2024
@TheNickOfTime
Copy link
Owner Author

TheNickOfTime commented Aug 22, 2024

NVENC Support

Tested on windows via WSL2 and Docker Desktop with an RTX 3070. NVENC seems to work out of the box if the proper compose config is used:

  handbrake-worker:
    image: ghcr.io/thenickoftime/handbrake-web-worker:latest
    container_name: handbrake-web-worker
    user: 1000:1000 #edit to run as user (uuid:guid) with permissions to access your media. 0:0 to run as root.
    environment:
      - WORKER_ID=windows-worker #give your worker a unique name
      - SERVER_URL=handbrake-server #set to the url or ip of your server, prefix with http:// or https://
      - SERVER_PORT=9999 #if using a reverse proxy, this may be different than what is set above
    volumes:
      - ./data:/data
      - ./media:/video #ensure this path is the same across all containers
    depends_on:
      - handbrake-server
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: 1
              capabilities:
                - gpu
                - compute
                - video

It seems that NVENC works fine, but NVDEC does not - this does mean that the CPU gets slammed despite using NVENC. I think I may be able to fix this in the future by doing a custom build of HandBrake.

@TheNickOfTime TheNickOfTime linked a pull request Aug 22, 2024 that will close this issue
@TheNickOfTime
Copy link
Owner Author

QSV Support

Tested on an Intel NUC with a Pentium J5005 processor (with integrated graphics). It was necessary to edit the worker Dockerfile to install both the mesa and intel gpu drivers. The following compose file passes thru intel gpu devices to the container:

  handbrake-worker:
    image: ghcr.io/thenickoftime/handbrake-web-worker:latest
    container_name: handbrake-web-worker
    user: 1000:1000
    environment:
      - WORKER_ID=handbrake-worker
      - SERVER_URL=http://handbrake-server
      - SERVER_PORT=9999
    volumes:
      - ./data/data:/data
      - ./data/media:/video
    devices:
      - /dev/dri:/dev/dri
    depends_on:
      - handbrake-server

Additionally there are a few other issues users may encounter when setting this up:

  1. QSV would appear as available to handbrake, but fail once a job is started. It may be necessary for some users to add the video group to their compose file. You can get this number on your host machine via getent group video - mine was 44, but your may be different.
    group_add:
      - 44
  2. It seems that some iGPUs will fail to encode with QSV no matter what unless the following is added to your preset's advanced video options:
    lowpower=0
    
    More information about this can be found at HandBrake's documentation here.

All that said, I am not super confident that this setup will apply to all intel GPUs, especially the discrete ARC GPUs. If you encounter any issues, please open a new issue!

@TheNickOfTime
Copy link
Owner Author

AMD VCN Support

Tested on my custom NAS with a Ryzen 5600g. Unfortunately HandBrake does not have generic VAAPI support for AMD GPUs on linux, however they do list support for AMD VCN on their docs. I was unable to get this working unfortunately. Encodes would error out with the following:

ERROR: Unknown video codec (0x1001000e)

I think it may be possible to get this working, but it would require tinkering with my NAS a bit too much for my liking since it's stability is very important to my daily operation. This will have to be tackled at a later date, and I am satisfied to support NVENC and QSV for the time being.

@TheNickOfTime
Copy link
Owner Author

Other Hardware Support

I am not currently aware of any of the other encoders that HandBrake has support for are compatible with linux. Those are:

Additionally I don't believe I have hardware that I can use to test either of these, so these will be unsupported for the foreseeable future.

@github-project-automation github-project-automation bot moved this from In Progress to Done in Development Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/2-med type/feature New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant