
Transcoding is a process of converting media files from one format to another. Depending on the source file size, transcoding requires a lot of CPU and GPU resources that can be beyond a local computer’s specifications. To solve this, dedicated transcoding servers effectively handle media transcoding processes with hardware acceleration, fast, and powerful processing capabilities.
HandBrake is an open-source video transcoder that can be set up as a dedicated transcoding server to convert media files from one format to another. When used with FileBrowser, HandBrake allows you to leverage cloud GPU resources to perform fast and efficient transcoding operations.
This guide explains how to set up a transcoding server with Handbrake using a Vultr A16 Cloud GPU instance. You will use the dedicated NVIDIA NGC marketplace application to run HandBrake and FileBrowser as Docker containers.
Before you start:
Deploy an A16 Vultr Cloud GPU Instance with the NVIDIA NGC App from the Vultr Marketplace.
Create two subdomain records to securely access HandBrake and FileBrowser.
In this article, the subdomains
filebrowser.example.com,handbrake.example.comare used. Replace all occurrences with your actual domains.
Access the server using SSH.
Create a non-root user with sudo privileges, and switch to the user.
Add the user to the Docker group:
Restart your SSH session to load changes.
Install Nginx.
You will set up Nginx as a reverse proxy to securely access HandBrake and FileBrowser as described in this article.
Verify that Docker Engine is up and running.
Run Handbrake as a new docker container using the following command.
The above command creates a new system home directory handbrake-user as required by the application, and creates the HandBrake container that listens on the host port 8000.
Verify that the HandBrake container is created and the status is Up.
Your output should look like the one below.
Test that HandBrake is listening on port 8000.
Create a new directory to store FileBrowser files.
For compatibility and file discovery. The FileBrowser directory must be stored in the same path as the HandBrake directory.
Create the host FileBrowser database file.
Run FileBrowser as a new container using the following command.
The above command creates the FileBrowser container that listens on the host port 8001.
Verify that the FileBrowser container is created, up, and healthy.
Your output should look like the one below.
Test that FileBrowser is listening on port 8001.
In this section, set up Nginx as a reverse proxy to forward traffic to the Internal host port 8000 for Handbrake, and port 8001 for FileBrowser to securely access the applications as described below.
To avoid port conflicts, delete the default Nginx host configuration file.
Using a text editor such as nano, create a new Nginx host configuration file for HandBrake.
Add the following configurations to the file.
Save and close the file.
The above configuration forwards HTTP requests to the HandBrake host port 8000 using the proxy_pass directive, and also supports the HandBrake websocket declared by the websockify path.
Test the Nginx configuration for errors.
Create a new Nginx host configuration file for FileBrowser.
Add the following configurations to the file.
Save and close the file.
The above configuration forward all HTTP requests to the FileBrowser port 8001 through the filebrowser.example.com domain.
Test the Nginx configuration for errors.
Restart Nginx to save changes.
To secure your server, you need to configure the necessary firewall rules and allow access to handle incoming requests on the Nginx HTTP port 80. To fasten your setup, allow access to the HTTPS port 443 and redirect all HTTP requests by setting up trusted SSL certificates as described in this section.
By default, Uncomplicated Firewall (UFW) is active and running on Vultr servers. Verify the firewall status.
Allow incoming traffic to the HTTP port 80.
Allow the HTTPS port 443.
Restart UFW to load changes.
To add an extra layer of security, you can configure the Vultr Firewall to filter traffic before forwarding it to UFW.
HandBrake offers a direct unprotected web-based user interface. To protect your application from being used by unauthorized users, enable basic authentication in your Nginx configuration file to grant specific users access to the application as described below.
Using the htpasswd utility, create a new passwords file, and generate a new password for the user admin as below.
When prompted, enter a strong password for the user to secure the account.
Edit the HandBrake Nginx configuration file.
Add the following content to the location / { section.
The above configuration enables basic authentication with the alert message "Private area, only allowed users", and uses usernames from the /etc/nginx/passwords file.
The edited location / { block should look like the one below.
Save and close the file.
Test the Nginx configuration for errors.
Restart Nginx to save changes.
Generate trusted SSL certificates from a certificate authority (CA) such as Let’s Encrypt to use in your Nginx configuration. If you have certificates from another CA, add them to your Nginx configuration, or, follow the steps below to generate free Let’s Encrypt SSL certificates.
Using snap, install the Certbot Let’s Encrypt client.
Activate the Certbot command.
Generate the SSL certificates.
Replace handbrake.example.com, filebrowser.example.com, and user@example.com with your actual domains and email address respectively.
When successful, your output should look like the one below.
Test that your certificates auto-renew after 90 days.
You have installed HandBrake and FileBrowser as active docker containers, then configured Nginx as a reverse proxy to serve requests to the Internal host ports. Verify that you have access to both applications and start transcoding media files using HandBrake.
Using a web browser such as Google Chrome. Visit the FileBrowser domain.
Enter the default administrator username admin and password admin to log in to FileBrowser.
Within the FileBrowser dashboard, click New Folder on the left navigation menu.
Enter a name for your new directory. For example HandBrake-uploads, and click Create to save.
Within the directory, click the Upload ↑ button on the top right bar.
In the popup dialog, click File to browse and upload a media file on your computer.
When the upload is complete, verify that your file is available within the directory to start the transcoding process with HandBrake.
In your web browser, visit the Handbrake domain.
Enter the username and password as set in your Nginx configuration password file.
Within the HandBrake web interface, click Open Source to locate your media file.
Navigate to the Files directory where you uploaded the media file, and click Open to load it.
Click the Presets button on the top right bar, and select your desired transcode preset, for example, Creator 2160p60 4K from the dropdown list. Click X to close the popup dialog.
In the Summary section, click the Format dropdown and set your destination format.
In the Video section, click Video Encoder to set your desired encoder and framerate.
Adjust the Audio, Subtitles, and Tags for your media file.
In the bottom Save As: field, enter a new name for your transcoded file and select the destination directory in the TO: dropdown. For this article, click the dropdown, scroll to select other, in the file manager, click storage, and set the Files directory as your output destination.
Click Start to begin the transcoding process.
When the process is complete, open FileBrowser to download the files.
Log in to FileBrowser.
Verify that the new transcoded file is available in your main directory Files.
Click the file, then click the Download ↓ button on the top right bar.
The download should start automatically, verify that the file downloads directly to your computer.
Save the file on your computer.
You have set up a transcoding server with Handbrake and a Vultr Cloud GPU. By leveraging the GPU processing power, you can transcode multiple files at the same time, and generate the best quality files downloadable through FileBrowser. Depending on your transcoding requirements, you can scale your GPU instance to get more processing power and convert files fast and efficiently. For more information about HandBrake, visit the official documentation, to scale your server's storage space, attach a block storage volume.
0 Comments
Be the first to comment and share your perspective with the community.