• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

ExtendScript Change Text in mogrt

Community Beginner ,
Oct 31, 2019 Oct 31, 2019

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.

TOPICS
SDK , User interface or workspaces

Views

2.8K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Adobe Employee , Nov 01, 2019 Nov 01, 2019

Scripts cannot be embedded in / invoked from .mogrts.
PProPanel successfully inserts an instance of a .mogrt, and modifies its parameters.

Votes

Translate

Translate
Adobe Employee , Nov 07, 2019 Nov 07, 2019

Each trackItem has a projectItem; projectItems have markers.

Votes

Translate

Translate
Adobe Employee ,
Nov 01, 2019 Nov 01, 2019

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 01, 2019 Nov 01, 2019

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Nov 04, 2019 Nov 04, 2019

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 06, 2019 Nov 06, 2019

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Nov 06, 2019 Nov 06, 2019

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.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 06, 2019 Nov 06, 2019

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Nov 06, 2019 Nov 06, 2019

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 07, 2019 Nov 07, 2019

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Nov 07, 2019 Nov 07, 2019

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 07, 2019 Nov 07, 2019

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Nov 07, 2019 Nov 07, 2019

Copy link to clipboard

Copied

Each trackItem has a projectItem; projectItems have markers.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 08, 2019 Nov 08, 2019

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. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 10, 2020 Dec 10, 2020

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 10, 2020 Dec 10, 2020

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? "

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Dec 10, 2020 Dec 10, 2020

Copy link to clipboard

Copied

I meant audio effect / VST plug-ins, within PPro.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 10, 2020 Dec 10, 2020

Copy link to clipboard

Copied

LATEST

Ahhh got it, thanks for the clarification! 👍

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines