Skip to main content
erik-jand93097670
Participant
May 20, 2020
Answered

ExtendScript: videoTrack.insertClip for video or audio only.

  • May 20, 2020
  • 1 reply
  • 2456 views

Is there a way to use 'videoTrack.insertClip' but only insert the video or audio? You can do this interactively from the Source monitor so I'm hoping there is similar functionality scripted. 'projectItem.setInpoint' has a media flag for example.

 

Thanks,

 

Erik.

This topic has been closed for replies.
Correct answer Bruce Bullis

Sorry, no. 
You _can_ unlink the audio and video once they're added, and remove just one or the other.

https://github.com/Adobe-CEP/Samples/blob/6882de3e9919f458d4f6e30b0e1cf1a73365cc01/PProPanel/jsx/PPRO/Premiere.jsx#L1619

1 reply

Bruce Bullis
Community Manager
Bruce BullisCommunity ManagerCorrect answer
Community Manager
May 20, 2020

Sorry, no. 
You _can_ unlink the audio and video once they're added, and remove just one or the other.

https://github.com/Adobe-CEP/Samples/blob/6882de3e9919f458d4f6e30b0e1cf1a73365cc01/PProPanel/jsx/PPRO/Premiere.jsx#L1619

merlincinematic
Participating Frequently
June 20, 2020

My workaround for this embarassing API flaw is:

1. Iterate through all tracks and lock them via Track Object setLocked method (0 for unlocked, 1 for locked)

2. Keep your target track unlocked

3. Insert the media

On insert Premiere will create a new track for the audio / video you didn't want. If you're inserting a bunch of clips you'll need to make sure you know the track index of this new "junk track" and keep it unlocked.

Post-insert cleanup can be:

* Use QE dom removeAudioTrack and/or removeVideoTrack methods to delete the junk track

* If you want to avoid QE, iterate through all the clips on the junk track Use the Track Item Object remove(true, true) method on each clip in the "junk track". You'll wind up with an empty track you didn't want, but at least you have your clips inserted without randomly clobbering clips in other tracks.

Note that both setLocked and remove are not in the offical docs, but they work as of PP 14.3.0. Also the remove method doesn't work very well from a loop; you'll have to call into CEP more than once to delete the junk clips.

I know this ugly, but it's the best I could cook up. If anybody else has a better algo for inserting clips, please post it!