Inserting only audio / only video (from MP4) in a sequence?

I have an MP4 where I need to insert only the Audio part (and another use case where I only need the Video part).

To insert clip in the pipeline, I have been using
SequenceEditor::createInsertProjectItemAction(projectItem, time, videoTrackIndex, audioTrackIndex, limitShift)
… But it seems like there is no way to only insert one of the component of the media (ie: EITHER video or audio but NOT BOTH).
I tried to pass null for the track argument of the media that should not be addedbut the API returns an error.
I also tried -1 but it just treats it as 0.

I setup an ugly set of hack for now - but this is really not pretty:

  • Always add data I do not want on track 0 (and obviously media I want is never on track 0 )
  • Once the sequence is build, delete audio & video track # 0
    • … but since there is no way to delete an entire track as of now, another hack is needed:
      • Retrieve all trackitem on track 0 both both Audio & Video track 0 (::getTrackItems(ppro.Constants.TrackItemType.xxx, false))
      • Create a trackItemSelection (TrackItemSelection::createEmptySelection)
      • Remove all selected trackItem from the timeline (via SequenceEditor::createRemoveItemAction)

… so it requires many additional API calls (longer execution time, more time with locked Access), and looks very clumsy indeed.

I am hoping that createInsertProjectItemAction has a (currently undocumented) parameter value i could use to ignore adding audio or vdeo ?

If not can we have the API modified to support this ?
Ideally a simple signature change like : SequenceEditor::createInsertProjectItemAction(projectItem, time, videoTrackIndex?, audioTrackIndex?, limitShift) where one could pass null to have audio or video ignored

1 Like

We also ended up building a wrapper for createInsertProjectItemAction for inserting audio or video independently. It finds an empty track, places the unwanted audio/video portion of the media, finds it, deletes it off. The problem is that this generates an enormous number of edge cases (think multi channel audio, etc). On top of that, the PPro UXP API treats audio and video tracks differently, so we have a huge tree of conditional paths that we are just duct taping together as we find new edge cases in production.

As you said, this also creates an enormous number of UXP API calls that are able to race against the various PPro crashing race conditions.

I’m going to add my +1 to this request for an additional parameter for createInsertProjectItemAction that will ignore audio or video from the source media.