This post provides insights on the new features available in Cinegy Convert v11. With powerful pre- and post-scripting events it is possible to extend your workflow way further the out-of-the-box functionality, for example, automatically publish videos on Facebook on user’s behalf. Source codes are also available for the reference.


The idea behind Hacking Cinegy presentations during TechCon 2017 is to demonstrate tips and tricks that can be used to extend functionality of your products using open Cinegy architecture and APIs. The latest demo showed the following features:

Cinegy Convert Processing Scripts

During the demo, Cinegy Convert pre- and post-processing script capabilities are shown in order to:

  • Generate new metadata as a pre-processing step;

  • Upload a video file to Facebook as a post-processing step.

All sources are available for download on Cinegy GitHub in the Uploading video to Facebook via Convert and Generating TrafficID using Convert pre-processing events sections.


Cinegy Convert v11 provides an option to perform additional initialization steps when the task is about to be processed. This allows, for example, scanning source media to generate additional metadata, perform sanity checks, and cancel the task when necessary, etc.

Pre-processing profile

The sample script demonstrates how an operator can access task logs to generate additional informational messages, access already existing metadata, and generate new ones.

The script input parameter provides access to the Cinegy.Media.Linker.Strategies.ScriptOptimizationProvider interface, which is a common access point to other available capabilities. For example, the Cinegy.Logging.ILogger interface is accessible via $provider.Logger. Once logger access is received, additional log messages can be added to the task processing logs via $logger.Info / $logger.Warn / $logger.Error / $logger.Fatal / $logger.Trace calls.

The available metadata can be accessed via $provider.Metadata['<macro>'], where <macro> defines the name of a metadata item to be retrieved, for example, {}. The new metadata generated during the pre-processing script execution can be registered using $provider.AddMetadata(<macro>', $value). Once registered, the new metadata can be referenced, for example, in the profile parameters:


The demo script shows how to generate new TrafficProgrammId metadata from the source file name truncating the special substring NRHD when necessary.


Cinegy Convert v11 provides an option to perform additional steps when the task is completed. This allows you, for example, to move the generated media to another location, send notification messages about new media available, publish media in the WEB, etc.

The sample script demonstrates how an operator can automatically upload media to Facebook and register a new post on behalf of the selected user.

In order to simplify the demo, the process of receiving the Facebook authorization token for the media upload is left out of scope for the script. Nevertheless, the manual token generation process is described.


In order for an application to publish content on Facebook user’s behalf, several steps should be performed:

  • application registration;

  • authentication token generation on user’s behalf;

  • uploading the media using Facebook SDK.

Application Registration

In order for the application to have access to Facebook API, it has to be registered with Facebook. To do this, you have to be promoted to the "Facebook developer" role.

Once registered as a developer, you will be able to create applications that can access the Facebook API:

Facebook App

The details of the new application should be specified:

Facebook App Register

Authentication Token

Once the application is created, you are able to access its details and generate test authentication tokens on user’s behalf. To do this, use the Access Token Tool from Facebook.

You are able to generate user access token with limited life time:

Facebook UAT Limited

Although the default life time is limited, for the practical purposes you will have either to renew an access token via API or generate the token with extended life time (30 days):

Facebook UAT Extended

Once the extended user access token is generated, copy the provided data and save it as a Convert-Facebook-AccessToken.txt file in the folder specified in the PowerShell script.

Facebook API

There are a lot of ways to access Facebook API. In order to simplify the script, we used Facebook SDK.

Once NuGet package is downloaded, specify the path to Facebook.dll in the PowerShell script.

Running the Script

When all preliminary steps are done, the rest is very simple. The script just loads a Facebook SDK assembly, creates a Facebook.FacebookClient object to access the API, specifies the previously generated access token, and uploads the media file generated by Cinegy Convert using the $fb.Post("/me/videos", $parameters) call. As simple as that 😊!