More storage for media : organize files using ChatGPT : part4, processing on Gentoo

hexfloor

hexfloor

Posted on October 31, 2024

More storage for media : organize files using ChatGPT : part4, processing on Gentoo

Main article

Introduction

Let's get the maximum performance and install ImageMagick and ffmpeg on Gentoo.
I will use WSL for demo, hence some functionalities will be limited.

Setup Gentoo

Let's get the latest stage3 tarball from the Gentoo Downloads
powershell:

Invoke-WebRequest -Uri "https://distfiles.gentoo.org/releases/amd64/autobuilds/20241027T164832Z/stage3-amd64-openrc-20241027T164832Z.tar.xz" -OutFile "$env:USERPROFILE\Downloads\stage3-amd64-openrc-20241027T164832Z.tar.xz"

mkdir "$env:LOCALAPPDATA\WSL\Gentoo" -Force

wsl --import Gentoo "$env:LOCALAPPDATA\WSL\Gentoo" "$env:USERPROFILE\Downloads\stage3-amd64-openrc-20241027T164832Z.tar.xz"
Enter fullscreen mode Exit fullscreen mode

Let's enter Gentoo:

wsl -d Gentoo
Enter fullscreen mode Exit fullscreen mode

Follow the Gentoo in WSL to setup a user! I will skip this part and will continue with root (not secure).

Hi ChatGPT, could you please suggest the compiler flags and USE flags for Gentoo to have the maximum performance, my use case is ffmpeg with HEVC and ImageMagick with HEIC. Short answer, thank you !

Image description

Image description

Image description

Now let's set compiler and USE flags, I have entered as root:

cat /etc/portage/make.conf
Enter fullscreen mode Exit fullscreen mode

Image description

A bit of magic:

echo -e "COMMON_FLAGS=\"-O2 -pipe\"\nCFLAGS=\"-march=native \${COMMON_FLAGS}\"\nCXXFLAGS=\"\${CFLAGS}\"\nFCFLAGS=\"\${COMMON_FLAGS}\"\nFFLAGS=\"\${COMMON_FLAGS}\"\nLC_MESSAGES=C.utf8" | tee /etc/portage/make.conf > /dev/null
Enter fullscreen mode Exit fullscreen mode

Setting USE flags:

echo 'USE="ffmpeg hevc imagemagick heic x264 vaapi vdpau opencl threads jpeg png tiff gpl libx264 libx265 libfdk-aac libmp3lame libopus libvpx nonfree"' | tee -a /etc/portage/make.conf > /dev/null

echo "media-gfx/imagemagick heic libheif" | tee /etc/portage/package.use/imagemagick > /dev/null

echo "media-video/ffmpeg gpl libx264 libx265 libfdk-aac libmp3lame libopus libvpx nonfree" | tee /etc/portage/package.use/ffmpeg > /dev/null

Enter fullscreen mode Exit fullscreen mode

Image description

Let's sync and update, at this point you will likely embrace the philosophy of Gentoo:

emerge --sync
emerge --update --deep --newuse @world
emerge --depclean
emerge dev-vcs/git
Enter fullscreen mode Exit fullscreen mode

At this point we have a media server, let's pack it.

ImageMagick on Gentoo

With the USE flags set from the setup:

emerge media-libs/libheif media-libs/libpng gnome-base/librsvg
git clone https://github.com/ImageMagick/ImageMagick.git
cd ImageMagick
./configure --with-heic=yes
make
make install
ldconfig

magick -list format | grep HEIC
Enter fullscreen mode Exit fullscreen mode

Image description

ffmpeg on Gentoo

With the USE flags set from the setup:

emerge media-libs/x264 media-libs/x265 media-libs/fdk-aac media-sound/lame media-libs/opus media-libs/libvpx

git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
./configure --enable-gpl --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-libvpx --enable-nonfree
make
make install

ffmpeg -codecs | grep hevc
Enter fullscreen mode Exit fullscreen mode

Image description

Final step

It is the time you have wasted for your Gentoo that makes your Gentoo so important.
Let's add new user:

useradd -m -G users -s /bin/bash <username>
passwd <username>
Enter fullscreen mode Exit fullscreen mode

And reboot Gentoo, now you can enter as <username>:

wsl -u <username> -d Gentoo
Enter fullscreen mode Exit fullscreen mode

Summary

If you are afraid to use Gentoo, come back when you are not afraid or use it while being afraid.
Image description

Image description

💖 💪 🙅 🚩
hexfloor
hexfloor

Posted on October 31, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related