Setup and Installation

If you currently run your site based on Elevated-X CMS (using php templates), it is rather easy to integrate it with Xvid MediaHub. We can:


So let's start with  setting up the necessary pieces...

Step 1: Create an application to use with your site in your Xvid MediaHub account

An application sets up a set of alternative "login" credentials allowing you to delegate API access under your account to one (or more) applications (e.g. a script, your website, etc.). This way you don't need to leak your actual username and password into an application config file and you can also at any time disable API access of a certain application or re-create the entire application with new credentials in case an app got compromised or insecure without harming your overall account or any other app in your account. 

So let's switch to the "Apps" tab and click "Add App", then enter a name for your new app and click "Create" (you can just leave the "CNAME Alias" field blank):


 

The newly created app will now show up in the grid. To obtain the corresponding application credentials, click on the "Edit" button. From the popup-window, copy&paste your Client ID and Client Secret. We'll need them in the next step:
 

Step 2: Create two new FTP accounts to be used as the input and output locations for the Xvid MediaHub transcoder service

Step 3: Download and install the Xvid MediaHub Elevated-X integration files

Step 4: Configure Xvid MediaHub features in your Elevated-X site

Open the 'cmsinclude.ini.php' config file in your site (typically at 'public_html/members/cmsinclude.ini.php'). During the script installation, a new section "[xvid]" is already added with some default settings. It should typically look like this:

[xvid]
ENABLE_MEDIAHUB_CDN_AND_AUTOGRAPH = 1
CDN_BASE_URL = "https://api.xvid.com"
 
APP_CLIENT_ID = ""     ;<--- Put your application Client ID here
APP_CLIENT_SECRET = "" ;<--- Put your application Client Secret here

NOTIFICATION_EMAIL = "" ;<-- Put your email address here

INPUT_DOWNLOAD_ROOT_DIR = "/home/nerds4nerds/xvid_input/" ; <--- Put the path to the FTP input folder here
OUTPUT_UPLOAD_ROOT_DIR = "/home/nerds4nerds/xvid_output/" ; <--- Put the path to the FTP output folder here
ELEVATEDX_UPLOAD_ROOT_DIR = "/home/nerds4nerds/public_html/members/content/upload/"

USERNAMES_ARE_CASE_SENSITIVE = 0
PREVENT_LINK_SHARING = 1
EXCLUDE_USERS_FROM_LINK_SHARING_PROTECTION = "testuser1,testuser2" ; <-- comma-separated list of usernames
SET_CHMOD_PERMISSIONS = 755
LOGFILE_PATH = "/home/nerds4nerds/public_html/cms_admin/xvid/xvid.log"
DBFILE_PATH = "/home/nerds4nerds/public_html/cms_admin/xvid/xvid.db"
 
;MYSQL_HOST = "127.0.0.1" ; <--- If you have a MySQL database, you can configure the access details here
;MYSQL_DB = "xvid"        ; By default, the MYSQL options are commented out and a local SQLite database is used then
;MYSQL_USER = "xvid"
;MYSQL_PWD = "password"

FORCE_UPDATE_TOKEN = "SUBX5K7_zJfPIyxGyBHGY5ySUbVUmL" ; <--- Trigger update by invoking: http://yourdomain.com/ping.php?force_update=FORCE_UPDATE_TOKEN 

Make sure that you:

Note: Please make sure that your webserver user (that's the context our script runs in) has full write access to the locations you have configued in the cmsinclude.ini.php. This in particular includes:

MySQL: If you have a MySQL database you can optionally configure it so that MySQL will be used by the script instead of the default SQLite database. In order to use MySQL create a new database (e.g. 'xvid') and a new database user that has full access to this new 'xvid' db. Then uncomment the MYSQL_HOST, MYSQL_DB, MYSQL_USER and MYSQL_PWD options and set them to appropriate values.

Step 5: Create a custom Pipeline in your Xvid MediaHub account using your new 'xvid_input'/'xvid_output' FTP accounts

After logging on to the Xvid MediaHub web app, go to the "Pipelines" tab and click on the "Add New" button (refer to the below screenshot as an example). Make sure that you:


Step 6: Add a 'templates.json' file to your 'xvid_input' directory

The 'template.json' is a template file containing one or more job json objects. Every new video file you upload into the 'xvid_input' directory will be automatically processed as new input file by the Xvid MediaHub transcoder service according to the job options specified in the template. You will want to customize this according to your needs, in particular adjust to which output formats and resolutions you want to convert your video (with e.g. 480p and 720p resolution video in respective subfolders under the folder of your Elevated-X content set - note, if you have configured different subfolder names in Elevated-X to host the different resolutions of your video, you need to adjust the "output_name" fields in the templates.json accordingly). As a quick start, you can use the sample templates.json below (it has AutoGraph watermark protection enabled) and then customize it further:

[{
    "template_name": "ElevatedX TEST", 
    "match_pattern": "*.mp4",
    "client_id": "59f11566e4b09fef4358125e",
    "client_secret": "XXXXXXXXXXXXXXXXXXXXHpRrdQbMLtrRJp2OhvZ6ExQ",
    "jobs_to_run": [{
                        "autograph" : { "watermark_strength" : "light" }, 
                        "output_prefix" : "{input_name}/", 
                        "outputs" : [ { 
                                          "preset" : { "id" : "52a6bbdfa2ca79055aaa787a" }, 
                                          "output_name" : "480p/{input_name}_480p"
                                      },{ 
                                          "preset" : { "id" : "52a6bbdfa2ca79055aaa787a" }, 
                                          "output_name" : "720p/{input_name}_720p"
                                      } 
                                    ] 
                   }]
}]


Now that's all! From now, whenever you want to publish a new video title on your site and want it distributed with Xvid AutoGraph protection enabled, you just need to: