Bug 480204 - The AppImage Kdenlive can't render with Intel VAAPI, while non-AppImage works
Summary: The AppImage Kdenlive can't render with Intel VAAPI, while non-AppImage works
Status: RESOLVED FIXED
Alias: None
Product: kdenlive
Classification: Applications
Component: Rendering & Export (show other bugs)
Version: git-master
Platform: Appimage Linux
: NOR normal
Target Milestone: ---
Assignee: Jean-Baptiste Mardelle
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-23 06:56 UTC by red_Arti
Modified: 2024-01-29 09:07 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description red_Arti 2024-01-23 06:56:30 UTC
SUMMARY
AppImage Kdenlive fails when trying to render with Intel VAAPI. While Kdenlive installing from Flatpub or from Linux distro repo works. (Movit disabled all the way)

STEPS TO REPRODUCE
1. Run Kdenlive AppImage
2. Open any project
3. Export. Choose "Hardware accelerate" -> VAAPI intel H264

OBSERVED RESULT
[AVHWDeviceContext @ 0x7fc378006740]
Failed to initialise VAAPI connection: -1 (unknown libva error).
Failed to create VAAPI device.
[consumer avformat]
Failed to initialize VA-API: -5
[h264_vaapi @ 0x7fc378002040]
A hardware frames reference is required to associate the encoding device.

EXPECTED RESULT


SOFTWARE/OS VERSIONS
I've tested 
1. Kdenlive 23.08.4 AppImage 
2. Kdenlive 24.04.70 AppImage, CI build 7256

ADDITIONAL INFORMATION
Only the AppImage package fails. Movit disabled all the way.

My Linux host:
$ vainfo
libva info: VA-API version 1.16.0
libva info: Trying to open /usr/lib64/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_1_13
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.16 (libva 2.15.0)
vainfo: Driver version: Intel i965 driver for Intel(R) Ivybridge Mobile - 2.4.1
Comment 1 red_Arti 2024-01-24 01:32:08 UTC
I found a workaround. Extract the AppImage file and delete extracted libva*.so

I guess there's some problem with the packed libva library

Before delete, I use the extracted `melt` with `-debug` :
[AVHWDeviceContext @ 0x7f9810205ac0] libva: VA-API version 1.20.0
[AVHWDeviceContext @ 0x7f9810205ac0] libva: Trying to open /builds/sysadmin/ci-management/linux-64-gcc/lib/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x7f9810205ac0] libva: va_openDriver() returns -1
[AVHWDeviceContext @ 0x7f9810205ac0] libva: Trying to open /builds/sysadmin/ci-management/linux-64-gcc/lib/dri/i965_drv_video.so
[AVHWDeviceContext @ 0x7f9810205ac0] libva: va_openDriver() returns -1
[AVHWDeviceContext @ 0x7f9810205ac0] Failed to initialise VAAPI connection: -1 (unknown libva error).
Failed to create VAAPI device.
[consumer avformat] Failed to initialize VA-API: -5

Run `kdenlive.AppImage --appimage-extract` , then `rm squashfs-root/usr/lib/libva*`

After delete so it can use system's libva:
[AVHWDeviceContext @ 0x7f99cc205ac0] libva: VA-API version 1.16.0
[AVHWDeviceContext @ 0x7f99cc205ac0] libva: Trying to open /usr/lib64/dri/iHD_drv_video.so
[AVHWDeviceContext @ 0x7f99cc205ac0] libva: Found init function __vaDriverInit_1_16
[AVHWDeviceContext @ 0x7f99cc205ac0] libva: /usr/lib64/dri/iHD_drv_video.so init failed
[AVHWDeviceContext @ 0x7f99cc205ac0] libva: va_openDriver() returns 1
[AVHWDeviceContext @ 0x7f99cc205ac0] libva: Trying to open /usr/lib64/dri/i965_drv_video.so
[AVHWDeviceContext @ 0x7f99cc205ac0] libva: Found init function __vaDriverInit_1_13
[AVHWDeviceContext @ 0x7f99cc205ac0] libva: va_openDriver() returns 0
[AVHWDeviceContext @ 0x7f99cc205ac0] Initialised VAAPI connection: version 1.16
....
[AVHWDeviceContext @ 0x7f99cc205ac0] VAAPI driver: Intel i965 driver for Intel(R) Ivybridge Mobile - 2.4.1.
[AVHWDeviceContext @ 0x7f99cc205ac0] Driver not found in known nonstandard list, using standard behaviour.
detected 4 logical cores
....
[h264_vaapi @ 0x7f99cc202000] Using VAAPI profile VAProfileH264High (7).
[h264_vaapi @ 0x7f99cc202000] Using VAAPI entrypoint VAEntrypointEncSlice (6).
[h264_vaapi @ 0x7f99cc202000] Using VAAPI render target format YUV420 (0x1).
[h264_vaapi @ 0x7f99cc202000] Driver supports RC modes CQP, CBR, VBR.
[h264_vaapi @ 0x7f99cc202000] Driver does not support ICQ RC mode.


Use the extracted `AppRun` to run kdenlive.
Comment 2 Jean-Baptiste Mardelle 2024-01-24 07:54:50 UTC
Thanks for your detailed report, I can confirm the issue.
We will try to fix the libva packaging!
Comment 3 Julius Künzel 2024-01-28 16:27:55 UTC
Hi thanks for your report again!

Could you please try the following:

1. Extract the Appimage as you already did for your tests (--appimage-extract)
2. Start Kdenlive via squashfs-root/AppRun and do the steps you described to ensure the bug exists
3. Close Kdenlive
4. Open squashfs-root/apprun-hooks/craft-runenv-hook.sh in a text editor and append the following two line:
LIBVA_DRIVERS_PATH=/usr/lib/dri:/usr/lib64/dri:/usr/lib/x86_64-linux-gnu/dri:/usr/lib/aarch64-linux-gnu/dri
export LIBVA_DRIVERS_PATH
5. Repeat step 2 (start Kdenlive) and try to reproduce the issue again. Is it fixed?
Comment 4 Julius Künzel 2024-01-28 19:04:29 UTC
Git commit ce5096a51ce1f9009ba98c339894aaceb79fc5ef by Julius Künzel.
Committed on 28/01/2024 at 19:04.
Pushed by jlskuz into branch 'master'.

[Kdnelive] Fix VAAPI rendering with Appimage

M  +1    -0    kde/kdemultimedia/kdenlive/kdenlive.py

https://invent.kde.org/packaging/craft-blueprints-kde/-/commit/ce5096a51ce1f9009ba98c339894aaceb79fc5ef
Comment 5 red_Arti 2024-01-29 01:06:35 UTC
After adding the two lines, bug has gone. VAAPI works.
Comment 6 Julius Künzel 2024-01-29 09:07:26 UTC
Perfect, thanks for testing. It should be fixed in the nightly now and will be in the next release