- Notifications
You must be signed in to change notification settings - Fork350
Vulkan support [APK included]#596
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
sfan5 commentedSep 7, 2022
Added an APK for people wanting to test. It defaults to vo_gpu + Vulkan, vo_gpu_next is present too (both vk and gl) and you can switch by editing mpv.conf as usual. |
eko5624 commentedSep 8, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Device: HuaWei Mate 20 pro MPV crashed when open a file. My mpv.config as below: |
sfan5 commentedSep 8, 2022
I can only diagnose issues withlogcat output. |
eko5624 commentedSep 8, 2022
sfan5 commentedSep 8, 2022
Looks like you're missing support for timeline semaphores which means your phone/GPU is not supported. |
eko5624 commentedSep 8, 2022
Ok, thanks for your explaining. |
rohitghali commentedOct 8, 2022
Any updates on this? And, api is already bumped up right? Can strike off the first check box. |
sfan5 commentedOct 24, 2022
I will revisit this sometime to work on the rest. |
xdilemite commentedDec 14, 2022
I'm looking forward to getting a new modern build once the vulkan issue is fixed. Here's an old debug build from the source with working vulkan.mpv_vukan.apk |
rohitghali commentedDec 14, 2022
How old is this? |
xdilemite commentedDec 16, 2022
2019 but vulkan works. |
sfan5 commentedJan 14, 2023
No surprise,this project might be able to work around the requirement in the future but I haven't investigated that yet.
I can't see any settings being applied in the log but you probably forgot to set
Again no surprise as this is a totally regular build. |
sfan5 commentedJan 16, 2023
|
sommio commentedApr 11, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Thankfully, it is more stable than master when I use I can't even apply |
syphyr commentedMay 22, 2023
When building libplacebo, the build fails when the android toolchain tries to include <shaderc/shaderc.h>. This fixes the issue:syphyr@b8c7260 All of the other pkg-config files have a prefix of "/usr/local". The shaderc pkg-config was the only one with a prefix of "/usr". There must have been some conflict with the Android toolchain and the search path. |
syphyr commentedMay 22, 2023
Even though vulkan does not seem to be supported on my older Android tablet, I also wanted to mention that vo=gpu-next seems to work better than vo=gpu. |
syphyr commentedMay 23, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
There are actually two separate issues i encountered when building libplacebo. The first issue is that $prefix_dir/lib does not get created for shaderc, so it fails copying libs. The second issue is with the path inside the shaderc pkgconfig file mentioned previously. Edit: my build machine does not have any local shaderc.h files, so maybe that is why I'm noticing this problem with the pkgconfig file. |
sfan5 commentedMay 23, 2023
I tested this branch just yesterday and there were no issues with shaderc. |
syphyr commentedMay 23, 2023
The issue i had with the include path for shaderc.h might be because of a difference with my build environment. I also just started noticing that vo=gpu-next is causing random freezing in the video playback, but the audio keeps going. |
alakittty commentedMay 24, 2023
@sfan5 the shaderrc problem is there when building with the github actions build, but is fixed with syphrs patch, yesterday i forked mpv-android to do some dilly-dallying. Btw how to build arm64v8a with gh actions? |
syphyr commentedMay 24, 2023
It looks like you need to add a line before this one to build arm64 variant.
mpv-android/buildscripts/.travis.sh Line 79 inebc2f2a
|
syphyr commentedJun 1, 2023 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
When building libplacebo separately, the build fails when shaderc attempts to copy libs to The Android NDK r25c contains shaderc v2022.1. The official Google shaderc repo has updated to v2023.5. This commit builds libplacebo with latest official google shaderc repo with updated 3rdparty libs. Also, using the google shaderc repo allows for including faster bugfixes and pinning versions. Edit: Updated links to include fixing copying shaderc header files. When |
Doc-4 commentedMar 25, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Happy to help if possible if it's within my ability to do. I'm willing to do just about anything other than wipe or root the phone. Backtrace with symbols means app compiled for debugging or something, yeah? |
Vladdrako commentedApr 6, 2025
peerless2012 commentedJul 12, 2025
Does this need hwdec_aimagereader.c in mpv support vulkan too? In the mapper function, it should map codec frame to vulkan texture? |
sfan5 commentedJul 12, 2025
Zero-copy hwdec is not supported with Vulkan. It could be implemented viaVK_ANDROID_external_memory_android_hardware_buffer but that probably needs to happen inside libplacebo. |
peerless2012 commentedJul 12, 2025
Why not in hwdec_aimagereader.c? It seems cuda support both gl and vulkan texture mapping. |
sfan5 commentedJul 12, 2025
what do you mean? how does cuda get involved here? |
peerless2012 commentedJul 12, 2025
TBO, I am not familiar with this. I am developing hwdec on another platform, and when impl gl, i do just like android do. When I want to impl vulkan mode, I don't know how to do, the only thing is I find out cuda support both gl and vulkan, so I am asking if android and my new platform could do like cuda do or not. |
master255 commentedJul 20, 2025
I have tested three versions (standard one, and the two in the topic header) of MPV on a Hisense Vidda C2 Ultra Android 11 projector and all versions play the 4k Lindsey Stirling - I Wonder As I Wander.webm clip as a slide show. It uses VP9 and Opus codecs. Waiting for new versions for testing. |
sfan5 commentedJul 20, 2025
Log file? |
master255 commentedJul 20, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@sfan5 The projector has ADB logs turned off completely. SU is off. So I don't know where to get the logs. You can send me 100500 versions to test. And I'll tell you which one works. |
sfan5 commentedJul 20, 2025
That's unfortunate, but then there will be no fix. It's not possible to fix something that isn't known. |
master255 commentedJul 20, 2025
@sfan5 On galaxy s22U phone the video does not slow down and shows exactly the same as VLC. But on the big screen of the projector slideshow. |
sfan5 commentedJul 20, 2025
mpv-android is targeted at exactly those devices and use cases that I can make work in my spare time and motivation,not a single bit more than that. |
peerless2012 commentedJul 21, 2025
Do you know what i mean? |
Doc-4 commentedAug 8, 2025
Coming back to this, probably don't spend any effort looking into this. It fixed itself sometime between when I last tested it and now, it must have been an upstream issue. (AOSP, GrapheneOS, maybe some library if one's used? I wouldn't know which.) |
Doc-4 commentedAug 10, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
So I'm back, you should be aware that HW+ decoding is broken for me on the latest VK build and branch built from source, but works fine on the latest non-vk stable release. I'm not sure if this is a bug or a consequence of how this branch works, some things I read implied it's the latter. On a semi-related note, high bitrate HDR HEVC videos run way worse on this build than the older vulkan build or the latest stable master release (HDR tonemapped rather than native on the stable one). More importantly, I spent several hours troubleshooting the build process on 3 distros, Ubuntu, Debian, and Fedora (all in WSL2), followed the instructions for building to the letter, and all of them fail without manual intervention for different reasons. I'd try to fix it myself but I don't understand the intended process well enough, so I've documented the issues I've found below: The download.sh doesn't install jinja2 or jsonschema though it seems they're needed, and once things are mostly working, Ubuntu and Debian fail when checking things about the available vulkan versions. Debian failed checking something about vulkan for libplacebo's build, and Ubuntu later when it got to MPV, reporting that vulkan is out of date (I don't believe the versions in the NDK or deps are). I gave up on Debian at this point. Fedora had issues downloading the dependencies, I had to follow the link to some of them and unpack them manually, then verified they were all present. The script on Fedora asks for latest openjdk devel regardless of 21.0.8 being present, and trying to use the version it wanted causes problems I was unable to resolve when getting to building mpv-android itself, such needing a flag to bypass something unnamed which I passed to java but the part immediately following mpv's build failed for another reason I didn't fully understand, it seemed related to a mismatch between gradle and something else. Complete! Something seems to be faulty about the version check on vulkan in debian based distros, I only got it to build on Ubuntu by first replacing the vulkan headers files downloaded with latest ones found elsewhere (I believe there are two sets present in the build here, one within the NDK and one within libplacebo), and modified the build script to skip that single check and got a successful, working build (can play video well and successfully utilize vulkan features like HDR.) I did not check the results of skipping the check without replacing the files. Absolutely nothing I did to the environment or files seemed to fix it detecting that version 1.3.0 was the only one available. Please test the buildscript on a blank install of ubuntu (the one that was the least troublesome overall) and verify any issues for yourself. |
master255 commentedAug 11, 2025
@sfan5 Good news. My new Vidda C3 Ultra projector shows ADB logs. I will send them soon. |
sfan5 commentedAug 11, 2025
HW+ has never worked for Vulkan.
You can see that the CI indeed fails with an error (it works for me locally), but that doesn't match any of your descriptions:https://github.com/mpv-android/mpv-android/actions/runs/16883601860/job/47825477007?pr=596
JRE and JDK are not the same. Make sure javac is available.
Could be, I use Java 17 myself. The build instructions are best-effort and not tested to the letter regularly. |
Doc-4 commentedAug 11, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
I'll try using 17 for future builds. The one recommended on Fedora was 24 (but I believe that particular package is updated to the latest as released), Ubuntu I think 21. I'm sure I didn't mistake JRE for JDK on Fedora, though perhaps the openjdk version I installed was missing javac? I don't know if not all JDK packages are more or less equal with stuff like that. Yeah, the CI error isn't one I ran into, shaderc never failed to build. It may be unrelated, but I see that it mentions armv7a. I only told it to build 64bit in my tests. |
sfan5 commentedAug 12, 2025
It now builds successfully in CI as you can see. Compared to building the normal mpv-android nothing special should be needed (except python3 itself). |
Uh oh!
There was an error while loading.Please reload this page.
Opening this PR to keep track of the required changes to merge Vulkan support.
Checklist:
Figure out if we can avoid bumping the API minimum¹(no)¹ Raising the API to 24 would lose us 0.5% of our Google Play install base.
⬇️ APK Download ⬇️
🔨 Bugs?
If you want to report a problem make sure to include the logcat output, or your report will useless.
If the player does not launch at all make sure you havesupport for Vulkan 1.3 or newer on your device.
Note thatHW+ will not work with Vulkan enabled due to missing support for this in mpv and/or libplacebo.