Containerizing HandBrake with Docker and Kubernetes

preview_player
Показать описание
Handbrake is a fantastic open source transcoder. It allows you to transcode, or convert, your video files into different formats. It has a nice UI that's easy to use and helps you transcode videos very easily. It supports profiles that are optimized for your target devices. And because this is open source and cross compiled, you can run this on Windows, macOS, or Linux... but did you also know you can self host a containerized version of this with Docker and Kubernetes?

Huge thank you to the open source project jlesage/docker-handbrake

(Affiliate links may be included in this description. I may receive a small commission at no cost to you.)

00:00 - Intro
00:39 - What are we going to do today?
01:14 - Can you containerize hand brake with Docker?
01:40 - Does the docker version of handbrake have a UI?
02:22 - What are we going to set up?
02:36 - What is Rancher and Kubernetes?
02:54 - Where do we get the docker image for handbrake?
03:17 - Docker commands for Handbrake container
04:59 - Convert Docker command to Kubernetes workload in Rancher
05:23 - Port mapping
05:50 - Scaling and upgrade policy
06:16 - Mapping your volumes
07:02 - Create our folders on the server
07:43 - Creating the rest of our mount paths
08:28 - Environment variables for security and others
10:48 - Automatic conversion preset
11:34 - Launch our handbrake pod
12:18 - Docker Handbrake demo
12:56 - Converting a video with Docker Handbrake
13:48 - Server resources
14:19 - Batch conversion of watched folders with Docker Handbrake
15:36 - Comparing compression results with Handbrake
16:59 - Creative ways to use Handbrake
18:06 - Stream Highlight - Michiana, Ohioana, Kentuckiana, oh my!

"Red Lotus" is from Harris Heller's album Trouble.

#HandBrake #SelfHosted #TechnoTim

Thank you for watching!
Рекомендации по теме
Комментарии
Автор

What do you transcode with Handbrake? Movies? Home Videos? 🍍?

TechnoTim
Автор

This is great! I've decided to look in to a docker SAMBA server so I can upload videos to a share, and have this dockerized handbrake autoconvert over several days and dump to an output folder on the SAMBA container for me to pick up later. Shared storage is wonderful.

hiddenfromyourview
Автор

7:10 one-liner: mkdir -p handbrake/{config, storage, watch, output}

Vogel
Автор

This is slick Tim, didn't know the docker image had a GUI with it. Will definitely be deploying this in the homelab!

Animeskter
Автор

I'm currently running a Handbrake instance in a container using Rancher based on your previous Rancher video. I am passing my P2000 Quadro through to this box because it is also responsible for running my PLEX server and Rancher/Containers let me share it with both services. I'm a big fan of your stuff! See you on Discord :)

mattlawrence
Автор

Take a look at Tdarr, a Handbrake Queue Manager with a WebUI. Tdarr is a Node Manger as well, you can share your Transcode queue with multiple Nodes, respectively multiple VMs or Servers. I used to use Handbrake in docker, but Tdarr is awsome!

davidstegmuller
Автор

I originally dismissed this because I didn't want to learn docker and didn't understand how useful this would be.

For me, I want to take large video files from my desktop, quickly send them over to the SSD of my media server and from there, Handbrake can transcode and output to the servers ZFS pool to be served up by Jellyfin.

I struggled with trying to find some way of using handbrake on this headless server without all the arduous arguments of Handbrake CLI. This is literally the perfect solution for my use case and could be setup from no containers or docker to working handbrake in a few minutes.

adamgarlow
Автор

You should check out Tidarr. Similar concept, but more geared for the Sonarr/Radarr crowd. It is a lot more automated

stephenreaves
Автор

Hey Tim. Hats off to you.
Do you ever think of the security implication yet alone running into a behind the scenes issue in using any if these containers or are we just run NID/snort on our pfsense.

These containers make life convenient indeed. However this is comparable to someone who visits a fish market instead of a fresh pond.

Hope that makes sense.
You are killing it.

My advise to noobs ---> force yourself to understand everything is a file. Learn where these files are at. Use the man pages and rest assured the world is yours

bigappleplug
Автор

Amazing, I didn't expect this to be possible.

Tarbard
Автор

I never use handbrake before, may be use in future. Thanks for this post.

shetuamin
Автор

Great video man! I tried this as well a couple of months ago, I've now switched focus on what I consider to be the "next/overkill" version of this setup, maybe you will give it a try as well!

The basic concept: This setup is great for leaving your server on and transcoding all the time, but it can still only transcode one thing at a time (or multiple, but it then slows down all of them_, so then I started thinking about horizontally scaling this setup. What I want to do is: instead of watching the watch folder, I want to use something like rabbitmq (message queue) to monitor a folder where the video files will be added (it has to be on a NAS), then if a new video file is detected the message que will reflect that added file, then another application that is subscribed to that message queue will pick up that information and schedule a node in the rancher/Kubernetes cluster to start up a container to transcode that file with the handbrake container, it provides it with the path of the video file, the desired config of it and the desired output file. Now you have achieved horizontal scalability for transcoding (My idea is to use this in combination with cloud providers for when I have a project, sure it costs some money but to get quick results it's an option)


Then for maybe down the line, wouldn't it be cool if you could transcode 1 video file on multiple containers that are running on multiple nodes? I was reading up on this and the basic idea is to before you start transcoding determine exactly how many containers you could run (let's say you got 3 separate nodes on which there could run 10 containers, that's 30 containers total) then you divide the video stream in the video file by 30, let's say the video stream is 30 min long, you could tell each container to only transcode 1 minute of is sequentially, afterwards you stitch all of them together and you have your final file (which is waayyy fast than one container doing it by itself). I want to try this as a future project

shekharnandkoemarsing
Автор

"Did you also know you can run it on Docker and Kubernetes"

*mic drop*

Javier_Corado
Автор

Downside, I can't get this container to use GPU :-( Any suggestions Tim? Can't get NVidia runtime to work with the container or Handbrake is just not setup to work with it. Intel Quick Sync available from the documentation but I'm running this container on Docker in a Proxmox Debian VM with IOMMU passthrough for NVidia (this works on my Plex container). Can I enable intel_iommu on this VM too?

GaryBarclay
Автор

Enjoyed the video as is usual with all your videos..
Handbrake is great, but once you dive into Tdarr you will probably never go back.
Great video either way..

jadehawk
Автор

Does Docker have some sort of IOMMU err hardware passthrough? Like to assign say a GPU to a container or cluster for specific tasks?

JohnWeland
Автор

newbie question... what is the functional difference between the storage folder, and the watch directory?

nightopsever
Автор

The things you could do with ffmpeg alone running in docker (tonemapping)... It only miss a friendly UI, and probably some regex based automatic sorting the manage video files (on top of media info)

Moukrea
Автор

Wish you covered using a cdrom mount. I can't for the life of me get it to find titles on a disc.

phaelax
Автор

Very nice videoguide. Nice!
But can anyone help me, why everything worked but still de "Auto deletion after successfully converted" feature dont work? Is there a rights issue? I have set = 0" but still no files will be deleted.

daes