Okay
  Print

[StreamTube] Transcode and Encrypt Video With FFmpeg

Before get started, make sure that you have installed the FFmpeg software, after activating the WP Video Encoder plugin, navigate to Appearance > Customize > WP Video Encoder panel and configure your encoder.

Activating required plugins https://phpface.ticksy.com/article/19782

Install FFmpeg

Installing FFmpeg is straightforward, especially on Ubuntu. Simply open the terminal and type:

sudo apt-get install ffmpeg

Alternatively, Install FFmpeg from source

  1. Download the latest FFmpeg version https://launchpad.net/ubuntu/+source/ffmpeg
  2. Extract the zipped file
  3. Navigate to the extracted folder in the terminal
  4. Run the following commands to configure, compile, and install FFmpeg:
$./configure --enable-libx264 --enable-gpl --enable-libwebp
$ make
$ sudo make install

Please note that the specific commands to run may vary depending on your system and the version of FFmpeg you downloaded. Make sure to consult the documentation provided with FFmpeg for detailed installation instructions, additionally, reaching out to server technical is recommended.



Configure plugin

Navigate to Appearance > Customize > WP Video Encoder section and configure necessary options.

Encrypt Video


Step 1: Generate an encryption key from your terminal console

$ openssl rand 16 > encryption.key

Step 2 (Optional): Generate an IV string

$ openssl rand -hex 16
3a01eee2ce4a76047265c1ab56e587f1

Step 3: Navigate to Appearance > Customize > WP Video Encoder panel.

  1. Check on HLS Encryption checkbox to enable the feature.
  2. HLS Encryption File Info Endpoint: This option allows you to change the default file info endpoint, leave it as default or change to a unique string, the string does not include special characters, space, or uppercase words.
  3. HLS Encryption File URL: put your encryption file URL which you have generated above. This encryption file is crucial for the HLS video encoding feature. It is necessary to keep the file accessible at all times during the lifetime of your website. If the URL for this file changes or the file is lost, the encrypted videos will not be decrypted and will be permanently inaccessible. It is recommended to upload the file to a secure and accessible location to ensure it remains available.
  4. HLS Encryption File: upload the encryption file.
  5. HLS Encrypt Initialisation Vector (optional): Put the IV string which you have generated.
  6. Save changes.

After enabling Encryption or changing the file info endpoint, you have to update permalinks at Settings > Permalinks.

If you prefer to rely on a streaming service with low cost and high bandwidth, you may consider trying either Bunny Stream or Cloudflare Stream, as their APIs are already integrated