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)
- Retrieve all trackitem on track 0 both both Audio & Video track 0 (
- … but since there is no way to delete an entire track as of now, another hack is needed:
… 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