Copy link to clipboard
Copied
I'm trying to programmatically change text in MOGRT that I've created in Premiere Pro, with the goal of creating an MOGRT with text that changes based on an audio trigger.
I've written code that will change the value in the ExtendScript Toolkit, but the MOGRT in the open project does not change. I've looked at the PPro API and the PPro Panel sample but neither are helpful; I want the script to be part of the MOGRT, not invoked by a panel/button.
Any help is welcome.
Scripts cannot be embedded in / invoked from .mogrts.
PProPanel successfully inserts an instance of a .mogrt, and modifies its parameters.
Each trackItem has a projectItem; projectItems have markers.
Copy link to clipboard
Copied
Scripts cannot be embedded in / invoked from .mogrts.
PProPanel successfully inserts an instance of a .mogrt, and modifies its parameters.
Copy link to clipboard
Copied
Would there be another way in PPro to create a counter effect…similar to timecode…that is driven/triggered by an audio clip(s)?
For example: I have a video sequence that has additional identical audio clips at regular intervals and a text title. Could the PProPanel script increment the text in the title (i.e. a number) when the audio clip sounds?
Copy link to clipboard
Copied
The only part that'd be tough is getting the audio amplitude, within ExtendScript. That data is readily available to audio filters, but would need to be exported or saved somewhere else, for a script to access it. Maybe timeline markers?
Once you know when to place those titles, yes, you can update their contents.
Copy link to clipboard
Copied
There are markers for each occurence of the audio file in the project. I'd like to create a single title with a counter that updates each time the marker is passed. Is that something that can be done in PPro? Or would it be better to work on this in After Effects?
Copy link to clipboard
Copied
> There are markers for each occurence of the audio file in the project.
Markers, attached to what; source clips? The containing sequence? Also, you say "audio file in the project"; I think you mean "audio file in the sequence", right?
> I'd like to create a single title with a counter that updates each time the marker is passed.
I doubt that'll work; if you change the text for a given .mogrt, I think that text will change for all times of that .mogrt. You'll be better off inserting a new instance of the .mogrt at each marker, and updating the counter in each.
PPro is the right place.
Copy link to clipboard
Copied
Apologies for the confusion.
In the PPro project there are two short audio clips, each of which has a marker. In the project sequence there is one audio track, into which either of the two files is placed, multiple times. So if sequence: =, audio1: ++ and audio2: +++ then a section of the sequence looks like this:
++ ++ +++ ++ +++ ++ ++ ++
==================================
Right now, the counter is hundreds of manually placed individual sequential titles, each with a different number that increments up or down based on the audio clip. My goal is to create a replacement that either a) a time/count effect (like timecode) that has numbers that can key off of the audio clip name and/or marker, or b) an AE graphics template with parameters for the audio file names and/or markers, and increments/decrements a number based on said parameters.
I've experimented with the Timecode effect in PPro but couldn't figure out how to make it increment/decrement based on audio clip markers (or names) in a sequence. I've written a script that will change the text of a basic title in PPro, but the change only works in the ExtendScript toolkit console window...any attempts to call setValue(newValue, boolUpdateUI) crashes PPro.
>I doubt that'll work; if you change the text for a given .mogrt, I think that text will change for all times of that .mogrt. You'll be better off inserting a new instance of the .mogrt at each marker, and updating the counter in each.
In the PPro Essential Graphics panel there are .mogrt files that count down/up, with various options (none of which work for what I'm trying to do). Can adding new .mogrt instances by audio clip counter be scripted in PPro?
Copy link to clipboard
Copied
Does this pseudo-code look correct?
For each video track in active sequence
For each trackItem
If it is [a trackItem I care about],
insert .mogrt on {current video track + 1}
update .mogrt text to show info from trackItem
You mention 'replacement'; you can disable the trackItems, as you go.
Copy link to clipboard
Copied
It's close. It's more like this:
For (var i=0; i < activeSequence.videoTrackItem.duration; i++)
For each audioTrack in activeSequence //keys of audio track clips
For each audioTrackItem
If [ audioTrackItem.hasMarker()]
insert .mogrt at Marker { current video track +1 }
update .mogrt text to increment number //just number increment needed
Also, while I've been able to write code that targets the audio tracks, I'm not seeing any attribute/property that exposes the time of said marker. There's .hasMarker(), but that's a boolean value
Copy link to clipboard
Copied
Since you're already iterating over all existing trackItems, I don't think looping across the sequence.duration (your outermost loop) will do any good.
Copy link to clipboard
Copied
>Since you're already iterating over all existing trackItems, I don't think looping across the sequence.duration (your outermost loop) will do any good.
I'll leave out the outer loop. Should I be able to get the audioTrackItem marker via script? I don't see any attributes of the audioTrackItem that expose the marker time...there's .hasMarker() but that's a boolean.
Copy link to clipboard
Copied
Each trackItem has a projectItem; projectItems have markers.
Copy link to clipboard
Copied
Thanks. I've found the markers and have written the code for putting them in the collection. In case anyone else has the same issue:
var oAS = app.project.activeSequence;
var oTrks = app.project.activeSequence.videoTracks; //V1, V2
var oVCS = oTrks[1].clips; //we want V2, adjust accordingly
var oAuds = app.project.activeSequence.audioTracks; //A1, A2, A3
var oACSOne = oAuds[0].clips; //we want A1, adjust accordingly.
var markers = []; //new array
for (var i=0; i < oACSOne.numItems; i++){markers.push(oACSOne[i].projectItem.getMarkers());} //for each audio marker, add to array
var mkOne = markers[0].getFirstMarker();
I'm seeing issues when inserting an .mogrt file; will post another thread after I troubleshoot.
Copy link to clipboard
Copied
Hey Bruce, I'm curious about this. When you say this data is available to audio filters, do you mean calling up something like ffmpeg to analyze the clip's source audio file? Or is there some more tightly integrated way to do access this data via the API?
Copy link to clipboard
Copied
( I'm referring to this quote - sorry, wasn't aware that my reply would end up way down here, out of context):
"The only part that'd be tough is getting the audio amplitude, within ExtendScript. That data is readily available to audio filters, but would need to be exported or saved somewhere else, for a script to access it. Maybe timeline markers? "
Copy link to clipboard
Copied
I meant audio effect / VST plug-ins, within PPro.
Copy link to clipboard
Copied
Ahhh got it, thanks for the clarification! 👍