Bug 488461 - encoding at 18fps, never uses more than 20% cpu, and vaapi does not work.
Summary: encoding at 18fps, never uses more than 20% cpu, and vaapi does not work.
Status: REPORTED
Alias: None
Product: kdenlive
Classification: Applications
Component: Rendering & Export (show other bugs)
Version: 24.05.1
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Jean-Baptiste Mardelle
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-13 18:18 UTC by ThemBees
Modified: 2024-08-25 08:47 UTC (History)
1 user (show)

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


Attachments
Kdenlives detects hardware (218.35 KB, image/png)
2024-06-13 18:18 UTC, ThemBees
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ThemBees 2024-06-13 18:18:50 UTC
Created attachment 170478 [details]
Kdenlives detects hardware

render 1080p video, using either h264, h265 or AV1, using Kdenlive's built-in rendering preset gives me about 18-19fps while rendering, never uses more than 15-20% of my CPU, and uses 0% GPU.

Also, if the video is longer than 15 minutes, once my 64gb of RAM gets maxed out (usually around 80% rendered) the render crashes, as long as the video is less than 15 minutes they usually work okay, but still take 3-4 hours to render a 10 minute video, with my hardware something is not working correctly, but the render log just says:
`
Started render process: /usr/bin/melt-7 -progress /tmp/kdenlive-IxKhVn-1.mlt
No LADSPA plugins were found! Check your LADSPA_PATH environment variable.mlt_repository_init: failed to dlopen /usr/lib/mlt-7/libmltmovit.so (libmovit.so.8: cannot open shared object file: No such file or directory)mlt_repository_init: failed to dlopen /usr/lib/mlt-7/libmltrtaudio.so (librtaudio.so.7: cannot open shared object file: No such file or directory)mlt_repository_init: failed to dlopen /usr/lib/mlt-7/libmltsox.so (libsox.so.3: cannot open shared object file: No such file or directory)[libopus @ 0x7d6234202e80] Value 16666.000000 for parameter 'frame_duration' out of range [2.5 - 120][libaom-av1 @ 0x7d6234201e00] Application has requested 32 threads. Using a thread count greater than 16 is not recommended.[libopus @ 0x7d6234203240] Value 16666.000000 for parameter 'frame_duration' out of range [2.5 - 120][swscaler @ 0x7d61bc338d40] deprecated pixel format used, make sure you did set range correctly[swscaler @ 0x7d61bfa28740] deprecated pixel format used, make sure you did set range correctly[swscaler @ 0x7d614c004d00] deprecated pixel format used, make sure you did set range correctly[swscaler @ 0x7d6144004040] deprecated pixel format used, make sure you did set range correctly[swscaler @ 0x7d6140003ec0] deprecated pixel format used, make sure you did set range correctly[swscaler @ 0x7d6138003d80] deprecated pixel format used, make sure you did set range correctly[swscaler @ 0x7d6104003e40] deprecated pixel format used, make sure you did set range correctly[swscaler @ 0x7d60fc003d80] deprecated pixel format used, make sure you did set range correctly[swscaler @ 0x7d60f0003d80] deprecated pixel format used, make sure you did set range correctly[swscaler @ 0x7d60e4003d80] deprecated pixel format used, make sure you did set range correctly[swscaler @ 0x7d60dc003e40] deprecated pixel format used, make sure you did set range correctly[swscaler @ 0x7d60c8003d80] deprecated pixel format used, make sure you did set range correctly[swscaler @ 0x7d60c0003d80] deprecated pixel format used, make sure you did set range correctly[swscaler @ 0x7d60b4003d80] deprecated pixel format used, make sure you did set range correctly[swscaler @ 0x7d60a8003e40] deprecated pixel format used, make sure you did set range correctly[swscaler @ 0x7d60a0003d80] deprecated pixel format used, make sure you did set range correctly[swscaler @ 0x7d6094003d80] deprecated pixel format used, make sure you did set range correctly[swscaler @ 0x7d6088003d80] deprecated pixel format used, make sure you did set range correctly[swscaler @ 0x7d6080003e40] deprecated pixel format used, make sure you did set range correctly[swscaler @ 0x7d6074003d80] deprecated pixel format used, make sure you did set range correctly[swscaler @ 0x7d6068003d80] deprecated pixel format used, make sure you did set range correctly[swscaler @ 0x7d6058003d80] deprecated pixel format used, make sure you did set range correctly1	20	1
`

More  CPU/GPU should be utilized to give me some slightly better fps while rendering? Even if I render it with the built in "MP4-H264/AAC" preset I only get 18-19fps which is what's making me think something is terribly wrong.

Hardware: AMD Ryzen 9 7950X3D, and a 7900XTX, 64GB DDR4 6000mhz.

Software: Kdenlive 24.05.1, MLT 7.24.0, ffmpeg 6.1.1, linux-zen 6.9.4, mesa 1:24.1.1-1, KDE Plasma 6.0.90, Wayland, Arch. 64gb of swap.

I'm not even doing any effects or anything, I'm simply stitching together clips, maybe a crossfade here and there, and that's it.

I've also tried to enable VAAPI, using either the av1_vaapi or hevc_vaapi encoders and both use 0% gpu, here is the latest av1_vaapi settings I was attempting to use:

f=mp4 vcodec=av1_vaapi vb=%bitrate+'k' vglobal_quality=%quality vq=%quality vmaxrate=%bitrate+'k' vbufsize=0 acodec=aac ab=%audiobitrate+'k' hwaccel=vaapi hwaccel_output_format=vaapi -vaapi_device /dev/dri/renderD128

as for the Encoder, I have tried everything from veryslow to ultrafast and it doesn't even seem to change anything, file size and time it takes to render is exactly the same.
Threads I have tried setting to both 0/auto and 32.
Parallel Processing is enabled and set to 32 threads. 


STEPS TO REPRODUCE
1.  open Kdenlive and create a 10 minute video of whatever
2. render using either the built in MP4-H264/AAC, MP4-H265, or AVS preset
3.  set threads=32 and parallel processing to 32 and click render

OBSERVED RESULT
12-15% CPU usage, rendering at 15fps, and your 10 minute video takes 4 hours to render (if it doesn't use your ram and crash first)

EXPECTED RESULT
50+% CPU usage, rendering at 20+fps, not crashing when it uses 64gb of ram (or just not using 64gb of ram)

SOFTWARE/OS VERSIONS
Hardware: AMD Ryzen 9 7950X3D, and a 7900XTX, 64GB DDR4 6000mhz.

Software: Kdenlive 24.05.1, MLT 7.24.0, ffmpeg 6.1.1, linux-zen 6.9.4, mesa 1:24.1.1-1, KDE Plasma 6.0.90, Wayland, Arch. 64gb of swap.

ADDITIONAL INFORMATION
Using different programs to render (handbrake, ffmpeg) uses 50+% CPU and the transcodes finish normally on my system. Also gaming and performance in other applications such as Blender is working as expected.
Comment 1 ThemBees 2024-06-13 22:28:20 UTC
adding that Kdenlive creating proxy clips with ffmpeg seems to use 40-60% CPU. 

Whatever the issue is seems to only effect the final rendering. mlt ?
Comment 2 ThemBees 2024-06-15 13:36:40 UTC
adding:

Changing "Preferred track composition method" from "auto" to "qtblend" or "frei0r.carioblend" makes no difference in rendering. 

Changing encoder threads from 32 to 0, 16, 8, or otherwise makes the cpu usage much higher, but instead of rendering at 18-19fps, it renders at 8-9fps. 

Toggling "Parallel Processing" on or off, and setting threads to 16 (max it lets me set it to) to 0, 8, 4, or otherwise does not seem to make any difference.