-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(server): hardware video acceleration for Rockchip SOCs via RKMPP #4645
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you planning do add any documentation for this setting?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a particular reason you added this instead of using getScaling
?
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd prefer to keep the library stuff outside of the server code if possible. But better would be to have a separate image for it. Is there a link for the licensing issue you mentioned? MPP is Apache 2.0 at least.
ffmpeg is LGPL and I think the patched version violates that. Found a comment from the dev team mentioning a license issue: I'd rather not distribute any image with this included. |
Ohhh, it's a copyleft thing. That does make it infeasible to ship it ourselves. |
Yes. Once we settled on the final implementation / configuration (possibly in a follow-up PR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this! That speed-up is really impressive. I still hope there's a cleaner solution for this, but I think this implementation is okay given the limitations.
…immich-app#4645) * feat(server): hardware video acceleration for Rockchip SOCs via RKMPP * add tests * use LD_LIBRARY_PATH for custom ffmpeg * incorporate review feedback * code re-use for ffmpeg call * review feedback
@fyfrey hi, when I want to enable hwaccel-rkmpp.yml for rk3588, I hava this problem, any idea to solve this? thx!
|
@Dark-Existed I have not encountered this error during my tests. It seems like a docker issue. |
This is the lastest hwaccel-rkmpp.yml, may be this two lines cause it mount twice.
The last line should be remove? |
Hi, I'm trying to get this working on RK3588S nodes in a kubernetes cluster, but so far not successful. Needed to diverge from the steps in dockerfile:
With that, I am able to
This succeeds. However, when the process is initiated by immich, it still fails:
The fallback software encoding then succeeds (after a long time). Code 127 should mean "command not found", but I'm puzzled as to why it fails if it succeeds when calling it manually from shell. |
@0x0013 this is a tough one since it runs fine manually in the container... can you try in docker (and not kubernetes)? |
@fyfrey I partially managed to get it to work. It seems the issue somehow stems from I was trying to compare the environment of my manual shell command This prompted me to try adding the variable when running the container:
and with this, it is encoding correctly with RKMPP, though I see the command is being run with double paths (second set added by immich) - I wonder if the library paths constructed end up as something like I'm not sure if adding this path manually for the whole container is a good idea - could this have bad impact elsewhere? |
Setting that env globally means the libraries in it take precedence over libraries elsewhere, such as /lib and /usr/lib. Libraries from those folders will still get loaded if something can't be found, but it can theoretically cause issues if it finds a library with a version or build that isn't actually compatible. |
@0x0013 it seems your kube environment sets Don't set the library path globally, it can cause issues by overwriting some libraries in the container with libs from the host where it is not intended (e.g. libvips for image operations). Try to fix the |
@fyfrey Thanks for your help. I did some more testing: I already hadn't defined
code would mistakenly interpret unset value as undefined, which would then later be set as string when restoring Then, while testing with the workaround I know is working (globally set This made me think - maybe the path doesn't get added on first run? I never tested this, because software encoding runs so slow, I would change settings and try something else, before it had time to retry a second time. So this time, I set the path globally to a random empty directory
I didn't test it without setting anything for |
Your guess is right. The issue is that reading an unset env from |
This PR adds a new type of hardware acceleration for Rockchip SOCs.
The approach differs from the existing options as it requires custom/patched ffmpeg binaries+libraries from the host OS (cannot put them into an image due to licensing issues).
To enable a user must select the new
hwaccel-rkmpp
in docker-compose and choose RKMPP as hardware acceleration in the settings UI.Some performance tests with an RK3588 SoC (4 "fast" ARM cores, 4 "slow" ARM cores, encoding acceleration for H265, HEVC, decoding acceleration for many formats):