22 - OpenSUSE Tumbleweed, Codec Issues

I like to experiment with my Linux distributions, like anyone would, so, I've been rocking OpenSUSE Tumbleweed w/ KDE for a few years now. It's been an overall pleasant experience - I like how YaST works and there are plenty of packages available. But there have been a couple of weird obstacles along the way that I cannot help but to think, this would not have happened with Fedora or Ubuntu.

OpenSUSE does not include a complete version of the Mesa/VAAPI codecs. For some reason, they have decided to provide a gutted version that will cause Firefox to perform terribly and downgrade to software decoding. On an economy laptop like the Framework 12, this sucks and the experience is pretty miserable trying to watch a 4k@60fps video.

There are two fixes to this …

  1. transcode all of your videos to H264 1080p@30fps for maximum compatibility
  2. swap package vendors to a complete, ungutted version of Mesa/VAAPI

I did both. In case I had visitors from other jank distributions visiting my site, I wanted them to be able to watch the videos and not think that the blog is broken.

To do this, run the following (it will prompt you several times to install the packages):

sudo zypper install opi
sudo opi codecs 

But, you will probably never run into a problem like this again.

# transcode videos to h264, 1080p@30fps and maintain their aspect ratio.

ffmpeg -i INPUT.mp4 \
  -vf "scale='min(iw,if(gt(iw,ih),iw,1080))':'min(ih,if(gt(iw,ih),1080,ih))':force_original_aspect_ratio=decrease:force_divisible_by=2,fps='min(30,source_fps)'" \
  -map 0:v:0 -map 0:a:0? \
  -c:v libx264 -preset slow -crf 21 -profile:v high -level 4.2 -pix_fmt yuv420p \
  -c:a aac -b:a 128k -ac 2 -movflags +faststart \
  OUTPUT.mp4

A more thorough explanation can be found here -  Re-enable VA-API hardware video acceleration on openSUSE Tumbleweed