Open-source video transcoding with Handbrake
This guide will show you how to deploy HandBrake, an open-source video transcoder, to metalstack.cloud.
Setup
You can install it with our basic Helm chart, which is based on this container image.
You can find the installation instructions for Helm in the official documentation.
Once you have installed Helm run kubectl cluster-info
to find out your cluster’s host name.
The output should look similar to this:
Kubernetes control plane is running at https://api.handbrake.f8e67080ba.k8s.metalstackcloud.io
CoreDNS is running at https://api.handbrake.f8e67080ba.k8s.metalstackcloud.io/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
Here, the part that comes after https://api.
is the relevant part.
You can set an environment variable for it like so export HOSTNAME=handbrake.f8e67080ba.k8s.metalstackcloud.io
.
It will look different for you.
Next, add the handbrake
and ingress-nginx
Helm repositories and install.
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx \
helm install ingress-nginx ingress-nginx/ingress-nginx \
--version 4.9.1 \
--namespace ingress-nginx \
--create-namespace \
helm repo add handbrake https://iljarotar.github.io/handbrake-helm-charts/docs \
helm install handbrake handbrake/handbrake \
--set clusterName=demo.$HOSTNAME
If everything worked out, you should be able to access HandBrake under https://demo.<your-host-name>
.
It can take some time till the url is accessible.
Converting Videos Automatically
To convert videos with HandBrake, you need to upload them either to the storage
directory or to the watch
directory.
The storage
directory can be accessed from within the UI.
The converted videos will be put into the output
directory, from where you can download them.
To automate the conversion, you can upload videos to the watch
directory.
HandBrake then automatically starts converting the videos from the watch
directory using the preset you specified with the AUTOMATED_CONVERSION_PRESET
environment variable.
This way, you don’t even need to enter the UI.
To share files between your local computer and HandBrake, you can use the kubectl cp
command.
First, find out the name of your HandBrake Pod.
kubectl get pod
NAME READY STATUS RESTARTS AGE
handbrake-7c5cdbcd85-j9qnj 1/1 Running 0 7m40s
You could put some videos into an example directory called videos
and run:
kubectl cp videos handbrake-7c5cdbcd85-j9qnj:/storage
The files should appear in the file browser if you click the Open Source
Button in the UI.
If you want to work without the UI run:
kubectl cp videos handbrake-7c5cdbcd85-j9qnj:/watch
After a while, HandBrake should be finished with converting the videos and you can copy them from the Pod’s output
directory into your local output
directory.
kubectl cp handbrake-7c5cdbcd85-j9qnj:/output output \
ls output
example-vid.mp4