Using the Adobe Premiere Extension mechanism, PremiereRemote provides a framework to trigger your own Premiere CEP-based functionality from outside of Premiere, e.g., by using AutoHotkey. This is achieved with a server that is started inside of Premiere on your local machine. Any custom functionality can then be triggerd using a local http request.
Let's take a custom function like locking a video track inside of Premiere Pro. Unfortunately, there are no shortcuts available without modification. With CEP, you can define your own javascript function using extendscript:
function lockVideoLayer(layerNumber) {
app.enableQE();
var activeSequence = qe.project.getActiveSequence();
var someTrack = activeSequence.getVideoTrackAt(layerNumber);
someTrack.setLock(true);
}
Using PremiereRemote, you can now easily trigger this function from outside of Premiere Pro with a http request. The required endpoint is generated automaticaly. In the case of the default port 8081
and the function lockVideoLayer
presented above:
$ curl "http://localhost:8081/lockVideoLayer?layerNumber=3"
Of course, you can also embed this line of code in a AHK-script or even remote control your Premiere instance from another computer. Sounds interesting? Let's get started!
This short guide will show how to install and use the PremiereRemote framework.
-
Preconditions: Please make sure that your Adobe Premiere Pro version matches the version shown in the README file. Other versions might work but could break things. Also, this framework requires NodeJS. Please install the current version, and verify that it is usable by, e.g., typing
npm --version
. -
Start by cloning or downloading this repository. There is a ready-to-use-version available.
-
Follow this documentation to install the extension. Basicaly, you have to:
-
Install the required dependencies to use PremiereRemote.
- Open a console window in the
PremiereRemote\client
folder. Executenpm i
to install all dependencies. These dependencies are used to run the local web server inside of Premiere. - Open a console window in the
PremiereRemote\host
folder. Executenpm i
to install all dependencies. These dependencies are used for the development workflow. - In the same console window in the
PremiereRemote\host
folder, executenpm run build
. This should generate a folder calledbuild
, where your custom functionality is contained.
- Open a console window in the
-
(Re) start Adobe Premiere Pro.
-
Now, you should see the Framework under
Window
->Extensions
. If there is no entry, you might recheck the documentation and compare your premiere version / setup with themanifest.xml
- file, located inside theCSXS
- folder. -
Double click the extension window. This should open the plugins
host
- folder. Inside the foldersrc
, you can add your own functionality, e.g., in theindex.tsx
. Please stick to the format already used to ensure correct parsing and server setup from the framework-side. A semi-minimalindex.tsx
-file looks like this:export const host = { kill: function () { // This method is only there for debugging purposes and shall not be replaced. }, yourNewFunction: function(param1, param2) { alert(param1 + " " + param2); } }
After making changes in any
.tsx
files, repeat the process of runningnpm run build
from inside thePremiereRemote\host
folder. You also have to close and repoen the PremiereRemote extension viaWindow
->Extensions
. Note, that a restart of Premiere Pro is usually not required.There is more custom functionality available as inspiration or to directly use here.
Now, you are ready to call your own Premiere CEP functions, defined in the host
variable of the index.tsx
-file remotely. Test the endpoints in the browser of your choice, as shown above. For example, use Chrome and the url:
http://localhost:8081/yourNewFunction?param1=Hello¶m2=World
There is support for a Swagger-based user interface (UI) to trigger your functionality. This UI is generated based on the annotations of the functions inside the host
variable of the index.tsx
file. By default, it is also hosted by the internal Premiere Pro server at http://localhost:8081/api-docs/
. It is highly recommended to annotate your functions to simplify their usage (also, by you :)).
On Windows 10 and later, you can easily trigger the URLs using the curl
-functionality. AutoHotkey code wrapping the curl
process would look like this:
F11::
Run curl ""http://localhost:8081/yourNewFunction?param1=Hello¶m2=World"",,hide
return
Quite easy, isn't it? Of course, you can change the port on your localhost. Have a look at the index.html
- file for this. Also, AutoHotkey is only one example on how your custom Premiere Pro functionality can be called. Any application that can execute HTTP-requests is capable of triggering your functions.
Additionally, it is possible to return values from inside of Premiere Pro, by returning their serialized representation at the end of a function inside the index.tsx
file. An example JSON-based result can look like this:
{"message":"ok.","result":"5"}
Here is my workflow for easy development and debugging of your own CEP-based functionality:
- Start developing your new function using the ExtendScript Debugger extension for Visual Studio Code. Just specify Adobe Premiere as targed and you're ready to go with your own javascript CEP code.
- After finishing with the development and testing of your new function, copy & paste the code inside the
index.tsx
-file. Alternatively, you can use multiple files to organize your code, as demonstrated here. - After making changes in any
.tsx
files, repeat the process of runningnpm run build
from inside thePremiereRemote\host
folder. - Then, reopen the PremiereRemote extension via
Window
->Extensions
and test it again, e.g., by using a browser, as shown above. - Optional: This extension enables debugging by default. Using chrome web debugger, you can simply connect to
http://localhost:8004
(by default) and see the javascript console output in real time.
Custom functionality inside the host
folder is written in TypeScript and is based on Types-for-Adobe.
If you want learn more about using the Adobe CEP SDK or AutoHotkey, have a look at this:
- Adobe CEP Premiere Samples: https://github.com/Adobe-CEP/Samples/blob/master/PProPanel/jsx/PPRO/Premiere.jsx
- Premiere On Script, a Premiere CEP youtube channel: https://www.youtube.com/channel/UCmq_t_-4GLFu_nYaEDDModw
- Taran Van Hemert, a macro specialist: https://www.youtube.com/user/TaranVH
- And my own twitch channel, were I develop with these techniques, sometimes: https://www.twitch.tv/skate702
If there are more questions, you can contact me on Twitter or via mail.