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

Performances Question - Code - Same project file -> multiple tracks items VS sub clipping?

Engaged ,
Feb 04, 2024 Feb 04, 2024

Hello,

I am having trouble adding 1000 times the same project item (with different attributes each time) as track items.

At the same time, adding other hundreds of project items (all different this time), and at the same time doing prints in the console.

(Visual code got a bit unresponsive with telling me 3 times though pop up windows: "visual has.., do you wish to continue, cancel,..etc?")

 

I was wondering, what would be the best practices, to make visual code + Premiere Pro work well and be able to treat the same proj item 1000 times for example while doing other stuff and succeed?

(While I writing this test, the script is still "running"' while nothing happening. And I doubt anything will happen)

 

The code is fine, It was working with 5 items.

Would making 1000 subclips (which I don't know well yet, is it actually creating "new files"?), better than trying to treat the SAME PROJECT ITEM 1000 times?

 

Anyway, What Can I do to "help" and "augment" the performances in general? What are the best practices,  and what I do in general to make my script complete its run, instead of stopping? at the moment it is supposed to insert items into the tracks..

 

I have a powerful GPU card by the way, Okay CPU. Right now while the code is running and NOTHING is happening and After saying "yes continue running" 3 times to visual code, the cpu is at 13% and GPU is at low use.

 

Was Premiere Pro Overwhelmed hence it does not know what to do?

(For the record, the logs show that my code reached the part where the projects items are inserted, and the logs shows that the script run through that "inserting part" many times. Finally when the logs end (supposedfly after 1000 insertion has been passed), .. my premiere pro projectr.. does not "get modified" (no item is added unfortuantely), again, the code worked just fine with 5 items.

 

Thanks,

Best

 

Edit:

I tried a "cancel" it showed a message "Canceled" but it is still struglling stoping the script now:

Bed30321077z973_0-1707092045530.png

 

The script is still running (while nothing really happening).

Bed30321077z973_1-1707092084204.png

 

Its as if Visual Code, .. broke.

Not sure what to do to prevent this, while keeping being able to treat the project item 1000 times and adding it 1000 times.

(edit2: added performances tag aswell)

TOPICS
Performance , SDK
318
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 ,
Feb 04, 2024 Feb 04, 2024

Please describe (from a user's perspective) the workflow, in which your script needs to import thousands of items into the project, then add each of those projectItems(?) to a sequence, thousands of times...?

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
Engaged ,
Feb 04, 2024 Feb 04, 2024

(rewrting)

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
Engaged ,
Feb 05, 2024 Feb 05, 2024
  • User open empty project, or create a new project in premiere pro.
  • User imports manually one projectItem to the mediaLibrary
  • User launch a script
  • Script does computation to that single projectItem in a loop that has 1000 iteration
  • Within the same iteration, computation is followed by insert() project item (the same one) into track,
  • Prints logs saying "adding project item . name into track, at time ..."
  • Iteration ends, a new iteration begins
  • New computation, insert() again, new log
  • And so on, until the loop ends.


What was observed in the logs?

  1. Visual code shows 2-3 times with a pop up window saying that it is unresponsive (taking too long to respond) and asking me if I want to cancel (close the window) or wait for it
  2. Logs continue appearing thourgh these pop up messages, after I say "wait for it/continue running",
  3. After the third pop windows, All logs end up appearing (to the hundreds up to the end) "adding project item . name into track, at time ..."
  4. But the button to stop running the code becomes unresponsive (althought It was able to print a red "canceled" on the logs as seen in the screenshot from the original post)


Observation in Premiere: Nothing, not a single item added.
Note: Items are actually added normally with no probelm, if its a loop of 5 items.

Waiting does not solve the problem, CPU and GPU are not at 100%, again GPU I have is powerful.

 

Extra note: I tried canceling instead of continuing running the script once (when the window pops up asking me what to do), and visual closed its main window, and when I opened it again I had lost my "workspace", its as if its closed.. abnormlly, I had to re find my workspace. (Visual ALWAYS open on your last workspace, but not this time).

 

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 ,
Feb 05, 2024 Feb 05, 2024

I still don't understand why it would ever be desirable to add thousands of projectItems, then create thousands of trackItems...

What is the user trying to accomplish, by using your script?

Again, no meaningful comment is possible without your ExtendScript code.

It doesn't sound like you've set any breakpoints in your code, and are instead just waiting for everything to finish; is that the case? 

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
Engaged ,
Feb 05, 2024 Feb 05, 2024

>It doesn't sound like you've set any breakpoints in your code, and are instead just waiting for everything to finish; is that the case?

Would that help? I will try it, maybe I could run the loop in 3 times (from 0 to 333, then 333 to 667 then from 667 to 1000), and betwene them use breakpoints? Interesting!

 

Its one single project item though! (And I make multiple tracks item from that single project item, that's why I asked at beginning if it's better to make "subclips" of that single project item, but I am worried it would worse for performance as it creates.. new projects item (and possibly new files in window explorer?))

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 ,
Feb 05, 2024 Feb 05, 2024

Would that help?

Yes, in that it would show you exactly what line of script code is causing the problem.

Its one single project item though!

Earlier, you said your script was importing thousands of project items. I'm glad to hear that's not the case. 
Creating subclips before creating trackItems is not necessary.

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
Engaged ,
Feb 05, 2024 Feb 05, 2024

Ok thank you I will try that,

But since the program works with 5 items, I think it's a question of performances, I mean there is not a particular piece of code NOT working whenits only 5 tracks added to the tracks.

 

So either visual or PPRO or both being overwhelmed once i reach a THRESHOLD of commands?

Is there a limit to the API actually? That's one question I should have asked from the beginning!

Maybe That's the problem?

I am at MORE than 1000 commands btw, maybe I might have reached some "limit" put on the API.

 

As for project item(s)

Bed30321077z973_0-1707140282167.png

I think my text might have been confusing as I indeed mentioned the word hundrends of 1000 but that was for the track items only.

 

>Creating subclips before creating trackItems is not necessary.

Noted!

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 ,
Feb 05, 2024 Feb 05, 2024

> So either visual or PPRO or both being overwhelmed once i reach a THRESHOLD of commands?

Step through your code in the debugger, and you'll know what line of the script causes problems. I doubt VSCode is a bottleneck. 

> Is there a limit to the API actually?

No.

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
Engaged ,
Feb 05, 2024 Feb 05, 2024

Thanks,

Ok I got back to it, and I had the feeling I could retry it without adding breakpoints,

Why this feeling? because this time I did not have items overwriting others. Everything separate. Maybe that helped A LOT, somehow, in the speed, processing, safe to say it indeed helped, because the script is running and no error window popping up saying "too long to respond do you wish to abord" type of message.

However, I would like to continue exchanging about this, in case it happends again, and also to help increase performance.

 

  •  I noticed the tracks were being added before even visual started showing the relevant logs related to the adding.. as if visual was more late for the logs than PPRO for executing the commands. What do you think of that? I find that interesting, and wonder if this can help the case anyhow.
  • Back to breakpoint, would you know by any chance if it's possible to have breakpoints inside a for loop that activates only every xx iterations, instead of every single iteration ? (I don't want to click 1000 times to observe)
  • As stated on another post, the process happening was not using MORE GPU, it was just running normally. I hoped I could speed it waay more. If you have any tips on that.
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 ,
Feb 05, 2024 Feb 05, 2024
LATEST

>...as if visual was more late for the logs than PPRO for executing the commands. What do you think of that?

I think that software applications should perform the actions they log, before logging them. 🙂

 

>would you know by any chance if it's possible to have breakpoints inside a for loop that activates only every xx iterations, instead of every single iteration ?

Yes, conditional breakpoints are possible.


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