Create VOD files from videos on your local drive with Open Source Cloud
In a previous blog post we described how you can create VOD files with a processing pipeline in Open Source Cloud. In that example it was assumed that the source video file was already accessible online. That is not always the case so in this post we will describe how you can do the same but from source video files on your local drive.
Prerequisites
Before we start you need an Open Source Cloud account. If you don’t have one you can create one here. You also need to have at least 5active services available on your subscription plan (Business or above) to get started. For best performance we recommend the Enterprise plan with some reserved capacity purchased. Contact us at sales@eyevinn.se for more information on this.
As in the previous example the VOD files will be distributed via an AWS Cloudfront accelerated S3 bucket.
Verify that you have version 0.11.2 or higher of the OSC command line tool installed.
% osc --version
0.11.2
Setup Processing Pipeline
First thing we will do is to setup the video processing pipeline in your Open Source Cloud tenant.
Setup secrets
Go to the web user interface and in the navigation menu on the left choose Settings. Click on the tab API and copy the Personal access token to the clipboard. Store this token in your terminal’s environment. Replace <personal-access-token>
below with your token in the clipboard.
% export OSC_ACCESS_TOKEN=<personal-access-token>
Go back to the web user interface and navigate to the service called Encore Packager. Click on the tab Service Secrets and the button New Secret.
Create a secret called osctoken
and here you paste the same token that you stored in your terminal. If the token is still in the clipboard you can just paste it in the Secret Value input field.
For access to AWS S3 where the VOD files will be transferred you also need to store the AWS access key id and AWS secret access key as service secrets. Store the AWS Access Key Id in a service secret called awsaccesskeyid
and the AWS Secret Access Key in a service secret called awssecretaccesskey
.
Create pipeline
Use the command line tool to create a pipeline. Replace <s3-output-bucket>
with the name of your S3 bucket where you want to transfer the result. The VOD files will be stored in the subfolder /vod/
in this example.
% osc pipeline create s3://<s3-output-bucket>/vod/
When the pipeline is created you should have the following running. You can verify in the web user interface.
- Valkey store called packaging.
- Encore instance called node1.
- Encore callback listener called node1.
- Encore packager called packager.
Create upload storage
We will need to have a place in Open Source Cloud to upload the file we want to process. For this we will be using MinIO, an open source project that offers an S3 compatible storage service and available as a service in Open Source Cloud.
Setup secrets
Create two service secrets in the MinIO service in the OSC web user interface.
user=blog
password=mysupersecretblogpassword123
The user and password just to serve as an example.
Create storage service
Create a storage service with this command in your terminal.
% osc create minio-minio transcoding \
-o RootUser="{{secrets.user}}" \
-o RootPassword="{{secrets.password}}"
We will now create a storage bucket in the storage service we created. First we will download and install the MinIO client using Homebrew.
% brew install minio/stable/mc
Create an alias for the storage service you created where <tenant>
is the id of your tenant.
% mc alias set transcoding\
https://<tenant>-transcoding.minio-minio.auto.prod.osaas.io \
blog \
mysupersecretblogpassword123
Added `transcoding` successfully.
Now we can create a bucket that we call input
% mc mb transcoding/input
Bucket created successfully `transcoding/input`.
Upload and Transcode
Now we have everything in place to be able to upload the file and start the video processing (transcode) in the pipeline.
We will be using the AWS command line S3 client to upload the file. You can use any other S3 compatible client (e.g. Cyberduck) if you prefer.
Set the username and password for the storage service as AWS S3 credentials in your terminal environment.
% export AWS_ACCESS_KEY_ID=blog
% export AWS_SECRET_ACCESS_KEY=mysupersecretblogpassword123
Upload video file and generate a signed HTTPS URL to it.
% aws --endpoint-url=https://demo-transcoding.minio-minio.auto.prod.osaas.io \
s3 cp ./stswe-tvplus-promo.mp4 s3://input/
upload: ./stswe-tvplus-promo.mp4 to s3://input/stswe-tvplus-promo.mp4
% aws --endpoint-url=https://demo-transcoding.minio-minio.auto.prod.osaas.io \
s3 presign s3://input/stswe-tvplus-promo.mp4 \
--expires-in 86400
<signed URL>
Initiate the transcoding process by running the following command. Replace the <signed URL>
with the URL returned by the presign command above.
% osc pipeline transcode '<signed URL>'
Note the quotes around the URL. The video processing will now be running in your pipeline in Open Source Cloud and you can start uploading and transcoding the next file in line.
What is Open Source Cloud
A software as a service based on open source with a unique transparent model where revenue is shared with the open source authors. Open Source Cloud offers media industry companies a quick way to incorporate open source in their solutions and the option to run the same software in-house as the source code is publicly available.
Documentation References
- VOD transcoding in Open Source Cloud
- MinIO Getting Started Guide
- API and CLI documentation: https://api.osaas.io
- Javascript Client Library reference documentation: https://js.docs.osaas.io/