Enable vaapi in preview player

I use shotcut in Manjaro/Archlinux but the video is quite slow without proxy in the player, so is there any configuration to properly enable vaapi for preview in shotcut.
I have a Lenovo Thinkpad P14s gen5 ryzen 7 with amd 780m igpu which is able to display 4k video @60 fps without any lag in VLC or MPV when VA-API is correctly configured. I’d like to reproduce the same thing in shotcut.

At the moment, a 15-second rush is unreadable!
image

I tried to activate some hardware improvements by checking :

  • Project => GPU effects
  • Detecting hardware encoding. But it doesn’t have much to do with encoding. I’d like to be sure to activate vaapi in the decoding: reading the video file.

Copie d'écran_20241028_121251

Could someone help me enable this hardware decoding without creating proxies.

Any idea where to look ? MLT or Shotcut ?

I dont think you can preview 4k60 smoothly in shotcut as you do in vlc/mpv because that would not allow you to add any effects on it as any edit would require the video to be passed between the gpu and cpu’s memory for every frame.

You need to use proxy for smooth 4k playback.

1 Like

But for derush it is usefull without effect.
With ffmpeg you could pass decode then encode and pipe to ffplay so it could be possible. Preview is definitively not efficient in Shotcut or there are some improvements … Do I have to look at MLT or Shotcut for that ?

I assume Shotcut, but have no idea, this is just what I remember from a previous post on the forum. Maybe a dev will point you in the right direction but if it was easy I’m sure they’d have implemented it already.

Yes I have checked, it is in shotcut.
I have tested with ffmpeg and for example this command is pretty unusable like in shotcut :

ffplay ~/Vidéos/2024_10_26_OneEye/DJI_2024
1026100350_0129_D_3D.MP4

Whereas this one is pretty fast :

ffmpeg -hwaccel vaapi -i ~/Vidéos/2024_10_26_OneEye/DJI_2024
1026100350_0129_D_3D.MP4 -vcodec rawvideo -acodec copy -f matroska -
| ffplay -i -

Faster:

ffmpeg -hwaccel vaapi -i ~/Vidéos/2024_10_26_OneEye/DJI_20241026100350_0129_D_3D.MP4 -vcodec libx264 -tune film -preset ultrafast -vprofile high -crf 22 -r 25 -pix_fmt yuv420p -g 250 -f matroska - | ffplay -i -

Less energy consumption : usefull on battery:

ffmpeg -hwaccel vaapi -i ~/Vidéos/2024_10_26_OneEye/DJI_20241026100350_0129_D_3D.MP4 -vcodec libx264 -tune film -preset ultrafast -vprofile high -crf 22 -r 25 -pix_fmt yuv420p -g 250  -s 960x540 -f matroska - | ffplay -i -

The goal is to try to change this settings in shotcut then make it available as option … I thin kit is feasible

Read the FAQ

Thank you, it doesn’t really help :wink:

Read from this part of the FAQ. It is not as simple as a setting in Shotcut. It means you need to change the code if you want it, but also you need to figure out the changes yourself.

“Not my problem” as well ! I can change it … I just look for some hints, but if you don’t want to give some pointers where to look … welcome to contributions !

Here is where the code in MLT downloads images from a hwaccel surface to an image in CPU RAM (no setting in Shotcut to turn that on):

Here is where images are transferred between CPU RAM and OpenGL textures for the image processing pipeline (“GPU Effects” in Shotcut):

Here is where images are uploaded from system RAM to OpenGL textures for the preview display in Shotcut on Linux.

Windows uses Direct 3D 11 for the display in Shotcut, and macOS uses Metal. Any contribution needs to at least not break those.

Transferring full uncompressed 4K60 video (your properties) between CPU and GPU is slow. If you simply turn on hwaccel in MLT, it will transfer twice to display it in Shotcut. If you combine that with GPU Effects in Shotcut (Movit in MLT), it will transfer 4 times to display it in Shotcut. These are in addition to initially sending the compressed video bitstream to the GPU.

This topic was automatically closed after 90 days. New replies are no longer allowed.