How to Set Up WordPress HTTP Live Streaming (HLS) HTML5 Videos

HTTP Live Streaming (HLS) is a new technology developed by Apple allowing delivering videos more easily and smoothly. It improves not only user experiences but also privacy. Your videos will be split into multiple small and short pieces (.ts files) and delivered via the .m8u8 file.

In this article, we will show you how to convert MP4 videos to HLS format and stream it with PDA Protect Videos extension.

  1. Convert MP4 videos to HLS format
    1. Use FFmpeg 
    2. Use Amazon Elastic Transcoder
  2. Stream videos via PDA shortcode


  • PDA Protect Videos extension version 1.3 or greater
  • Prevent Direct Access Gold version 3.0.0 or greater

1. Convert MP4 videos to HLS format

Method 1: Use FFmpeg

FFmpeg is known as the best free solution to convert audios and videos. It supports Linux, macOS as well as Windows system. In the scope of this article, we will guide you on how to convert videos in Linux.

Step 1: Create a key to protect your video by running the command line below:

openssl rand 16 > your-video-name.key

Step 2: Use Text Editor to create a new file named, then insert 2 following lines:


Step 3: Create a new folder storing your mp4 file, your-video-name.key and

Step 4: Run the following command line to convert the mp4 file to HLS format:

ffmpeg -i your-video-name.mp4 -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -hls_key_info_file -f hls ./your-video-name.m3u8

As a result, an m3u8 file and a list of .ts files are generated.

Just upload all of them to your S3 bucket and go to step 2.

Method 2: Use Amazon Elastic Transcoder

While FFmpeg is free and easy to use, it isn’t an ideal method if you have a lot of videos. To save time, you should consider using Amazon Elastic Transcoder which converts the media files and stores them on the S3 bucket automatically. You need to set up it for the first time only.

In order to use Elastic Transcoder,  you need an AWS account and have an Amazon S3 bucket to store your input and output videos. You can also use the different buckets for this purpose. For example,

  • an input bucket (e.g. named input.protected-videos) to which you upload the video files you want to transcode
  • an output bucket (e.g. named output.protected-videos) to receive the transcoded vides

Step 1: Log in to your AWS account and navigate to Elastic Transcoder console

Step 2: Click on “Create a new Pipeline” button to create a pipeline with the following pieces of information:

  • Pipeline Name
  • Input Bucket
  • Output Bucket
  • IAM Role: If you choose to Create console default role, Elastic_Transcoder_Default_Role will be created automatically.

You can leave other options as default values.

Step 3: Create a job to transcode your protected video into HLS format.

2. Stream videos via PDA shortcode

Insert the following shortcode to play your m3u8 video on your website:

[pwv_hls url="Input the Amazon S3 URL of your m3u8 file here" width="512" height="308"]

You can also use our auto-generate shortcode tool under the plugin’s settings page.

Lasted updated on February 23, 2020