Skip to main content
Inspiring
October 23, 2017
Answered

export frame from premiere pro

  • October 23, 2017
  • 1 reply
  • 3334 views

Hey,

I'm trying to export a frame from a sequence, based on a code i found in the examples,

app.enableQE();

var activeSequence = qe.project.getActiveSequence(); // note: make sure a sequence is active in PPro UI

if (activeSequence) {

var time = activeSequence.CTI.timecode; // CTI = Current Time Indicator.

var outputPath = new File("~/Desktop");

var outputFileName = outputPath.fsName + $._PPP_.getSep() + time + '_' + activeSequence.name;

activeSequence.exportFramePNG(time, outputFileName);

} else {

alert("No active sequence.");

}

And it doesn't do anything. It doesn't throw any errors either, i played around a bit and it's clear that the function exportFramePNG exists, and that the parameters are ok, but nothing happens.

when I do

$.writeln(activeSequence.exportFramePNG(time, outputFileName));

it returns false.

What's wrong, what can I do?

Thanks

This topic has been closed for replies.
Correct answer magarik

false = function was unable to export file, to path.

Yes, it could be permissions-related. Also, are you exporting to a directory that already exists? The function won't automatically make a new containing directory:

C:\\Users\\UserName\\Desktop\\ThisNewDirWillNOTBeCreated\\example.png"


I found problem!

In the examples, timecode is always used as part of the filename of the image.

In windows the following characters aren't allowed to be used as filenames.  \/:*?"<>|, that means in order to put timecode inside filename the colons have to be substituted for _ or - or whatever.

Please Please please, add somewhere in the example text a tiny note for windows users, or change the filename in the example.

And in same opportunity, in the example add the trailing "/" or "\\" to the desktop outputPath, otherwise clip will be exported to user directory and will have a name starting with "desktop".

Or better yet, replace the desktop example with

var outputPath = Folder.selectDialog("Choose output folder").fsName + "\\";

Thank you

1 reply

magarikAuthor
Inspiring
October 24, 2017

Actually I installed and ran the whole PProPanel extension, and even there nothing that uses exportFramePNG works.

I'm using Premiere version 2017.2.

Bruce Bullis
Legend
October 24, 2017

Ok, I've just confirmed that it does work, on two different systems.

Let's figure out what the difference between our configurations is.

Before attempting to invoke exportFrameAsPNG(), do you have a sequence active?

If you set breakpoints before and after the call, does it 1. get good parameters (time and output file path), and 2. return anything interesting?

magarikAuthor
Inspiring
October 24, 2017

Thank you for helping,

sequence is active, and both parameters are ok,

except that at least on windows, the "~/Desktop" path added to the desired filename omits a necessary slash,

like "C:\user\desktopfilename.png".

but even if I correct that, and also when used the path resulting from an open folder dialog, it's the same.

The function only returns "false".

im on windows 10, i'm going to check if it matters what video card i use (till now was nvidia 660m).