ffmpeg is a command-line utility or tool which is used by various video processing applications and video editors. And because it is open source, this is used under the hood by various services such as iTunes and YouTube.
Since a Jellyfin server set up on a Raspberry Pi cannot handle the workload of streaming HEVC x265 videos, it is advised to convert your HEVC video into a less resource-hungry format such as x264.
In this article, we will take a look at the installation process of ffmpeg and learn how to encode videos from x265 HEVC video format to x264 video format. It will be then easier to stream our videos from our Jellyfin server to numerous devices simultaneously without increasing the workload.
Installing ffmpeg on Linux
This process is straightforward as the application is available in the official repositories of all the Linux distributions. However, if you find using the Terminal a little scary, then don’t worry, it will take just a couple of commands.
In Debian and Ubuntu-based distributions
Make sure that you have the universe repository enabled in Ubuntu Linux, and then you can easily install ffmpeg using the following command :
sudo add-apt-repository universe
sudo apt update
sudo apt install ffmpeg
However, because of the 2-year 6-month release cycle of Debian and Ubuntu respectively, and the distributions which branch off from both the distributions, you might get an older version of the application.
To install the latest version, you should add the PPA to get the latest release. Just type the following commands :
sudo add-apt-repository ppa:jonathonf/ffmpeg-4
sudo apt update
sudo apt install ffmpeg -y
On Fedora Workstation
Just type the following command in the terminal :
sudo dnf install ffmpeg
On Arch Linux and Arch-based distributions
There are 3 versions of ffmpeg available for Arch Linux, they are ffmpeg, ffmpeg-git and ffmpeg-full. Out of which the first one can be installed using the pacman package manager and the rest are available using an AUR helper such as yay or paru.
I’ll recommend you to install the official version unless you know what you’re doing. Install it by typing the following commands in the Terminal :
sudo pacman -S ffmpeg
Start Encoding
Let’s assume you have a video named Videox256.mkv in a directory, now you will have to navigate in the directory using cd command then type the following command :
ffmpeg -ss 00:00:00 -i "Videox265.mkv" -t 00:00:50 -map 0 -c copy -c:v libx264 -crf 18 "OutputVideox264.mkv"
In the above command, -map0
selects all the streams from the input file, -c copy
copies all the streams which are selected and then -c:v libx264
finally encodes the video in x264 format. 00:00:00 and 00:00:50 defines the beginning and end of the output file from the original video.
Please note that this could be a time and resource-consuming process and only proceed with it if you have mid to high hardware specifications (mainly GPU).
Conclusion
ffmpeg is a powerful tool that can be used to convert videos from one format to another. In this article, we saw how to install ffmpeg on various Linux distributions and use it to convert a video from x265 HEVC format to x264 format which is less resource-hungry.
This will make sure that you don’t have any buffering issues while streaming from your Jellyfin server. Also, keep in mind that this process is time and resource-consuming, so make sure you have the required hardware specifications before you start encoding videos.
Do you have any suggestions or feedback? Please let us know in the comments below. Thank you for reading! 🙂