Pymiere: Python for Premiere Pro
Use Python to interact with Adobe Premiere Pro, gather data, check, edit and automate your projects.
If you just want to create a Premiere file programmatically, you can generate and use an XML file (see Open Timeline IO to XML). But that involves manually exporting and importing files, potentially losing data and with no visual feedback.
Pymiere was created to enable video editors and 3D/VFX studios to automate some of their workflows using Python rather than Adobe's custom scripting language ExtendScript.
Install Python if you haven't already.
Pymiere via pip:
python -m pip install pymiere
Pymiere Link extension for
.\ExManCmd.exe /install D:\path_to_extension\pymiere_link.zxp
./ExManCmd --install /path_to_extension/pymiere_link.zxp
Window > Extensionsyou should see
Pymiere Link(clicking on it will do nothing)
import pymiere print(pymiere.objects.app.isDocumentOpen())
Open or create a Premiere Pro project containing a Sequence with at least one video Clip. You can then run or step through demo.py which demonstrates some basic code. pymiere/wrappers.py contains more code examples.
Basically you start by creating a
project object to interact with the opened Premiere Pro application (it needs to be running), after which you can get/set its attributes and call its methods like
project = pymiere.objects.app.project
For more snippets and examples see pymiere documentation.
For any support, questions or interest please contact me: email@example.com
In outline, this is how
Pymiere interacts with Premiere Pro:
Pymiereconverts a Python command (getting a property, executing a function etc.) to ExtendScript code.
Pymieresends the ExtendScript code to the
Pymiere Linkextension via the requests library using HTTP (*)
Pymiere Linkextension is essentially a node.js server which receives the ExtendScript code and executes it within Premiere Pro.
Pymiere Linkwill return data as a JSON encoded response back to
Pymierewill then decode the JSON response for further processing in Python.
(*) NB: You must have Premiere Pro running for
Pymiere to work - it's can't run "headlessly". If your script needs to know if Premiere Pro is running, or start it, some functions are included in
pymiere/exe_utils.py for that.
pymiere.objects are the entry point to access all Premiere Pro objects and functions and can learn more the old school way by browsing the docstrings.
Alternatively, you'll be pleased to know
Pymiere supports code completion and type hinting so it should be easy learn more about these objects dynamically as you code using most modern IDEs.
Pymiere includes a mirror of all Premiere Pro ExtendScript objects in Python which were autogenerated from the Extendscript objects interface. If you'd like more detail about how I did this, please read my detailed article here.
separate the generic part handling communication between python and ExtendScript from the specific code for Premiere Pro, enabling its use in other applications (Photoshop, Encoder...)
add more examples & more wrappers functions
add support for Premiere events
add more documentation, docstrings...
build one Python mirror of ExtendScript objects by Premiere version, as each version adds new objects/functions/properties
add a way to simply customize a panel to call python functions
I'd like to thank everybody that contributed to
Pymiere by reporting bugs, imrpoving the documentation, sending ideas etc. but especially:
Isaac brown (https://github.com/ikebenbrown)
Roy Nieterau (https://github.com/BigRoy)
Peter Fison (https://github.com/Pfython)