English version below
Hallo,
ich benutze mit großem Vergnügen mein Lenovo Thinkpad T430, Baujahr 2012. Zum Glück habe ich dort einen der besten CPU's verbaut, den man für dieses Modell erwerben kann (Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz) (habe ich mal nachgeschaut, dass vorige Aussage stimmt, keine Garantie aber natürlich) und 12GiB RAM hat er auch, sozusagen recht zukunftssicher. Und tatsächlich komme ich durch alles gut durch, was nicht mit Grafikkarte oder massiver Prozessorauslastung (sprich Software compilen oder Rider mit großen Projekten öffnen, aber letzteres dauert zum Glück nur am Anfang lange), VMs sind auch nicht das Gelbe vom Ei, aber da finde ich evtl. noch ein zwei Hacks, aber eine Sache ist noch relevant zu erwähnen: Videos schauen.
Denn der CPU stößt mit 1080p60 auf jeden Fall an seine Grenzen und ich hatte da schon ein zwei unliebsame Überraschungen, gerade wenn Twitch oder Youtube keine vernünftigeren, kleineren Qualitäten hergeben (Bitte nagelt mich da wieder nicht fest, ich bin mir nicht sicher, ob ich den Fall mal auf YT, auf Twitch oder auch nur auf einer lokalen Videodatei hatte). Jedenfalls gibt es aber zum Glück die Möglichkeit, Filme durch die Grafikkarte wiedergeben zu lassen, nennt sich hardware decoding oder hardware video acceleration. Ist nicht in jedem Fall automatisch an, deswegen spreche ich das hier und heute an.
Ich werde heute auf die Kombination Linux und VAAPI eingehen, einfach deshalb, weil ich genau dieses Setup verwende. Der Rest (und im Übrigen alles andere, was ich grob weiß) lässt sich hier nachlesen: https://wiki.archlinux.org/title/Hardware_video_acceleration#Configuring_VA-API
Jedenfalls installiert man sich in seinem Lieblings-Paketmanager das Grafiktreiber-Paket seiner APU (oder GPU), in meinem Fall war das der libva-intel-driver, und noch die libva-tools. Mit letzterem kann man dann mithilfe des Programms vainfo die unterstützten Formate anzeigen. Kommt nur eine Fehlermeldung beim Aufrufen des Programms, so liegt das möglicherweise (ist mir passiert) daran, dass man den aktuellen User noch der Gruppe video hinzufügen muss. Dazu reicht ein
# usermod -a -G video <username>
und ein Neustarten des Rechners (bzw. wer nicht neustarten will, kann auch eine Subshell starten mit su - , aber auf eigene Gefahr. Ausloggen reicht zumindest auf meinem System nicht).
Im Erfolgsfall kriegt ihr eine Ausgabe analog zu sowas:
Interessant sind vorallem die VAEntrypointVLD, die anderen sind soweit ich weiß zum Encoden und nicht im Scope dieser Anleitung.
Jedenfalls sieht man da ganz gut, meine APU kann H.264 in Baseline, High und Main, VC1 in Simple und Main und MPEG2 in Simple und Main. Interessant hier sind für mich ehrlich gesagt nur H.264 in High, was 98% meiner Use Cases abdeckt (und eurer möglicherweise auch). Youtube z.B.. Interessant wäre nur noch, stünde da so etwas wie HEVC, das wäre H.265 und damit der Nachfolger von H.264. Youtube geht immer mehr zu H.265, wovor ich deswegen tatsächlich etwas bange, aber noch sind fast alle Videos im alten Format zu haben.
Jedenfalls eignet sich meine Grafikeinheit, um H.264 zu dekodieren. Damit kann ich quasi bei allen Filmen entsprechenden Formats meinem Media-Player mitgeben, dass dieser die Grafikkarte als Video-Backend verwenden darf. Bei MPV ist das ein
$ mpv --hwdec=vaapi <video file>
, bei VLC müsste da was in den Einstellungen vergraben sein. Noch kurz ein Ausblick über die unterschiedliche Prozessorauslastung
...
Aaach, Vorführeffekt. Selbst mit einem 1080p60 Video ist der Prozessor selten an seinem Maximum, und ich habe jetzt auch keine Lust, perfekt getimede Screenshots anzufertigen. Sagen wir, wenn ihr beim Video schauen öfter mal zu viel Prozessorauslastung habt, dann 1. aus dem Browser raus (ich mache bald nen Post zu youtube-dl) und 2. hwdec anschalten.
Dankeschön!
English version
Hello,
I use with great pleasure my Lenovo Thinkpad T430, year 2012. Luckily I have installed there one of the best CPU's you can buy for this model (Intel(R) Core(TM) i5-3320M CPU @ 2.60GHz) (I checked that previous statement is true, no guarantee but of course) and 12GiB RAM it has also, so to say quite future proof. And actually I get through everything well, which is not with graphics card or massive processor load (speak compile software or open Rider with large projects, but the latter takes fortunately only at the beginning long), VMs are also not the yellow of egg, but there I possibly still find a two hacks, but one thing is still relevant to mention: Watching videos.
Because the CPU is definitely at its limits with 1080p60 and I've already had two unpleasant surprises, especially when Twitch or YouTube do not give a more reasonable, smaller qualities (Please do not nail me there again, I'm not sure whether I had the case on YT, on Twitch or even just on a local video file). Anyway, there is fortunately the possibility to play movies through the graphics card, called hardware decoding or hardware video acceleration. Is not in every case automatically on, so I address that here and today.
Today I will talk about the combination Linux and VAAPI, simply because I use exactly this setup. The rest (and by the way everything else I roughly know) can be read here: https://wiki.archlinux.org/title/Hardware_video_acceleration#Configuring_VA-API.
Anyway, you install the graphics driver package of your APU (or GPU) in your favorite package manager, in my case it was the libva-intel-driver, and the libva-tools. With the latter you can then display the supported formats using the vainfo program. If you only get an error message when you start the program, this might be because you have to add the current user to the group video (this happened to me). This can be done with
# usermod -a -G video <username>
and a reboot of the computer (or if you don't want to reboot, you can also start a subshell with su - , but at your own risk. Logging out is not enough, at least on my system).
In case of success you will get an output analog to something like this:
Interesting are the VAEntrypointVLD, the others are as far as I know for encoding and not in the scope of this tutorial.
Anyway you can see there quite well, my APU can do H.264 in Baseline, High and Main, VC1 in Simple and Main and MPEG2 in Simple and Main. Interesting here for me are honestly only H.264 in High, which covers 98% of my use cases (and yours possibly too). Youtube for example. The only interesting thing would be if there was something like HEVC, which would be H.265 and thus the successor of H.264. Youtube is going more and more to H.265, which I'm actually a bit afraid of because of that, but still almost all videos are available in the old format.
Anyway, my graphics unit is suitable to decode H.264. So I can tell my media player to use the graphics card as a video backend for all movies of the corresponding format. For MPV this is a
$ mpv --hwdec=vaapi <video file>
, with VLC there should be something buried in the settings. A short view about the different processor usage
...
Aaach, demonstration effect. Even with a 1080p60 video, the processor is rarely at its maximum, and I don't feel like making perfectly timed screenshots right now. Let's say, if you often have too much processor usage while watching video, then 1. get out of the browser (I'll do a post on youtube-dl soon) and 2. turn on hwdec.
Thank you!