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

Mark in/out + add to Media Encoder?

Explorer ,
Nov 04, 2017 Nov 04, 2017

After working on scripts for AE, I'm trying to get things going in Premiere.

However, the documentation here lacks severely, and finding the right functions isn't a walk in the park either. So I wanted to check if these two things are possible before I try to delve deeper:

  • Is it possible to set mark in and out (like when using shortcuts i + o) via extendscript?
  • Can that mark in/out selection be added to the Media Encoder queue? This would be the equivalent of pressing ctrl + m, and choosing "queue")

Bruce Bullis -- could you please shed a light on my questions?

Thanks in advance!

TOPICS
SDK
4.2K
Translate
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 1 Correct answer

Explorer , Nov 04, 2017 Nov 04, 2017

After testing my script, there is a strange anomaly.

I have a sequence with split (extended) markers that show a range inside the sequence.

When I run this script:

var activeSequence = app.project.activeSequence;

if (activeSequence) {

var markers = activeSequence.markers;

if (markers) {

var numMarkers = markers.numMarkers;

if (numMarkers > 0) {

var marker_index = 1;

for(var current_marker = markers.getFirstMarker();

current_marker !== undefined;

current_marker = markers.getNextMarker(current_marker)){

    

...
Translate
Explorer ,
Nov 04, 2017 Nov 04, 2017

Ok, to answer my own question - and creating a new question:

Yes, it's possible - by iterating through the markers and setting the inPoint and outPoint.

However, I cannot seem to get the encoding of the "workarea" (set by the in/out range) working:

app.project.activeSequence.setInPoint(1);   

$.writeln("In:"+app.project.activeSequence.getInPoint());

app.project.activeSequence.setOutPoint(5);   

$.writeln("Out:"+app.project.activeSequence.getOutPoint());

app.encoder.encodeSequence(app.project.activeSequence,"output.mp4", "preset.epr", app.encoder.ENCODE_WORKAREA, 1);

The sequence is 11 seconds long, I select from 1 - 5 seconds, put it the renderqueue and render with ENCODE_WORKAREA -- it always renders 11 seconds for me.

Bruce Bullis​ -- is there a problem with this approach?

Translate
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
Explorer ,
Nov 04, 2017 Nov 04, 2017

And the last piece of the puzzle is now ready:

There are three different parameters when encoding:

  • app.encoder.ENCODE_WORKAREA
  • app.encoder.ENCODE_ENTIRE
  • app.encoder.ENCODE_IN_TO_OUT

So this works fine, when iterating through the markers, setting the in/out points, and rendering out with the correct parameter:

app.project.activeSequence.setInPoint(1);  

$.writeln("In:"+app.project.activeSequence.getInPoint());

app.project.activeSequence.setOutPoint(5);  

$.writeln("Out:"+app.project.activeSequence.getOutPoint());

app.encoder.encodeSequence(app.project.activeSequence,"output.mp4", "preset.epr", app.encoder.ENCODE_IN_TO_OUT, 1);

Translate
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
Explorer ,
Nov 04, 2017 Nov 04, 2017

After testing my script, there is a strange anomaly.

I have a sequence with split (extended) markers that show a range inside the sequence.

When I run this script:

var activeSequence = app.project.activeSequence;

if (activeSequence) {

var markers = activeSequence.markers;

if (markers) {

var numMarkers = markers.numMarkers;

if (numMarkers > 0) {

var marker_index = 1;

for(var current_marker = markers.getFirstMarker();

current_marker !== undefined;

current_marker = markers.getNextMarker(current_marker)){

                                var selectIn = current_marker.start.seconds;

                                app.project.activeSequence.setInPoint(selectIn);   

                                var getIn = app.project.activeSequence.getInPoint();

                                $.writeln("In: "+marker_index+" -> "+getIn);

                                var selectOut = current_marker.end.seconds;

                                app.project.activeSequence.setOutPoint(selectOut);   

                                var getOut = app.project.activeSequence.getOutPoint();

                                $.writeln("Out: "+marker_index+" -> "+getOut);

                                app.encoder.encodeSequence(app.project.activeSequence,"test-"+marker_index+".mp4",

                                "preset.epr", app.encoder.ENCODE_IN_TO_OUT, 1);

                                alert();

}

}

}

}

All is fine - the encoder fires up, adds the sequence to it, shows me an alert - and after I click it it goes through all the sequences - and exports the correct ranges perfectly.

When I comment the alert(); -- I runs through all the markers, and adds them to the queue all using the same in/out point.

It seems like when the alert fires, the window is brought to the front and the selection is done correctly - but when it's done in the background there is something going wrong.

Bruce Bullis​ -- is this a bug? Or is there another way to do this more efficiently?

Translate
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, 2017 Nov 04, 2017

The "if I remove the alert" behavior sounds like an AME bug; I'm not sure you're going to get useful behavior out of your "current_marker =" line.

Specifically, it seems like you're relying on a JavaScript-y practice of declaring a function as the handler for the result of another (in this case, getNextMarker() hopefully returns a marker; no function handler will be invoked upon return. [I may be reading too much into it, but that second paren (search for "current_marker))") raises suspicions.

Translate
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, 2017 Nov 04, 2017

To your first question(s): Yes, you can set in/outs, for items open in the source monitor, and yes, you can use encodeSequence() to render sequences in AME; you can use transcode() to render individual files, and yes, you can specify in/out points for those files.

Translate
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
Explorer ,
Nov 04, 2017 Nov 04, 2017

Yes, indeed that sounds like a bug. Where do I file bugs? Or is this being forwarded by you to the development team?

Using exportAsMediaDirect, it works perfectly. So I have a backup for this problem right now.

Thanks for the tips on the functions!

Translate
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
Explorer ,
Nov 10, 2017 Nov 10, 2017

Hello SWAX,

Can you please post an example of using exportAsMediaDirect?

Translate
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 10, 2017 Nov 10, 2017

Here's some exportAsMediaDirect() sample usage, in case you don't want editors to get back to work as fast as they can, if you render in AME.

Samples/Premiere.jsx at master · Adobe-CEP/Samples · GitHub

Translate
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
Explorer ,
Nov 10, 2017 Nov 10, 2017

Thanks Bruce.

I have used the following functions for a simple Sequence IN/OUT sending to Encoder.

app.encoder.launchEncoder();

app.encoder.encodeSequence()

The Encoder launched properly,  but the jobs are not being adding to Encoder queue.

Translate
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
Explorer ,
Nov 10, 2017 Nov 10, 2017

Looks like its a bug as SWAX pointed.

Without Alert, its writing the same IN/OUT points.

Some kind of CLEAR function is needed. Or does it exist?

Translate
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
Participant ,
Sep 09, 2018 Sep 09, 2018
LATEST

I understand what you mean. I have seen other things happen too fast when alert() is not part of the script. This is my first attempt at getting Premiere to work with Media Encoder with a script. When I run your script with alerts firing I don't see anything happen to Media Encoder. The Exstend Script TooIkit give me back the long string saying the encoder commands were successful. I have tried having Media Encoder open and closed. Is there some of  steps that have to be done to Media Encoder to get this to work? Thanks

Translate
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