Encoding Video
Making Senza-suitable video
Senza is designed to play Adaptive Bitrate Video (ABR) in a DASH format. See the Content Media Format page for detailed specifications.
If you have a video file in a format like MP4, you'll need to convert it to DASH format to play it on Senza. One option is to use a cloud-based tool like AWS MediaConvert to process the file.
MediaConvert works with content in S3 storage. It reads input files from one folder and writes output files to another folder.
Getting Started
If you don't already have one, you'll need to create an AWS account .
Then you'll want to add the S3 and MediaConvert services to your account.
Uploading Video
For this tutorial, we'll convert an MP4 file. MediaConvert supports a wide range of input formats.
Use the S3 interface to upload the file to a storage bucket. For this demo, we'll upload the target input file to s3://senza-developer/mp4/sample-app.mp4
.
Creating a Job
On the MediaConvert home page, click Get Started to create a job.
First, you'll need to create an IAM role with the necessary permissions on the AWS Integration tab.
Under Inputs, add an input and set the input file URL to the S3 path to your MP4 file:
Under Outputs, create an output and set the destination to where you'd like the new video files to be created:
Further down the page, add name modifiers for the video and audio tracks like these:
In the sidebar, click on video and configure the settings like this:
- Video codec: MPEG-4 AVC (H.264)
- Rate control mode: QVBR
- Max bitrate: 5000000
When you're ready to go, click Create!
The Jobs page will then let you monitor the progress of your job, which will take a few minutes to complete.
S3 Configuration
You can serve your video directly from S3. First, you'll need to make few configuration changes to your bucket.
- Set permissions for website access so that anyone can load files from the bucket.
- Turn off the Block Public Access feature.
- Add a bucket policy to grant public read access.
- Configure cross-origin resource sharing (CORS) so that you can play the video from any website.
Once the job completes, in the output folder you'll see a number of files. Select the one ending in .mpd
and click the Copy URL button.
Playing Your Video
Then you can drop that URL into your Senza app and play the video like this:
let videoUrl = "https://senza-developer.s3.amazonaws.com/streams/sample-app/sample-app.mpd";
async function playVideo(url) {
await hs.remotePlayer.load(url);
hs.remotePlayer.play();
}
playVideo(videoUrl);
Now that you've learned how to encode MP4 videos in DASH format, you can play all your video content on Senza!
Updated 4 months ago