How to cut multiple sections of one video using KalturaClipAttibute

Using KalturaClipAttributes, how do I clip multiple sections of one video video to create a new one unwanted portions of the video.

trying to create a script to do this for me. feed the function with time intervals and have it cut out the sections and fuse them to make one new video.

def create_video_segment(source_id, segment_name, start_time, end_time, start_time2, end_time2, title):

## Declearing variables / eventually we will ask user to enter these information

source_id = "entryID" 

segment_name = "Clip_multiple_segment"

start_time = 100000 ## Set the start time of the clip / trim in milliseconds

end_time = 300000  ## Set the end time of the clip / trim in milliseconds

start_time2 = 350000 ## Set the start time of the clip / trim in milliseconds

end_time2 = 900000  ## Set the end time of the clip / trim in milliseconds

clipDuration = end_time - start_time

clipDuration2 = end_time2 - start_time2

# protector

if os.path.isfile("segment_state/" + segment_name + ".status"):

    # segment already processed, skip

    return False

# do the cutting, let's call the new video ID as new_seg_id

# CREATE NEW CLIP

operation1 = KalturaClipAttributes()

operation1.offset = start_time

operation1.duration = clipDuration

operation2 = KalturaClipAttributes()

operation2.offset = start_time2

operation2.duration = clipDuration2

# ADD RESOURCES

resource = KalturaOperationResource()

resource.resource = KalturaEntryResource()

resource.resource.entryId = source_id

resource.operationAttributes = OrderedDict([(0, operation1),(1, operation2)])

resultEntry = client.media.updateContent(source_id, resource)

# Create New Media Entry

entry = KalturaMediaEntry()

entry.name = " Multiple segment clipping of one video to create a new one "

entry.description = "Clipping to clean up junk section from video"

# entry.searchText = "clipped" , "edit"

entry.mediaType = 1  # The new media type



# New Clip

resultEntry = client.media.add(entry)

resultEntry = client.media.addContent(resultEntry.id, resource)

print(resultEntry)



# save a state of file

new_seg_id = resultEntry.id

title = resultEntry.name

with open("segment_state/" + segment_name + ".status", "w") as F:

    # Alternative: use JSON, better

    F.write("segment_id: %s\n" % new_seg_id)

    F.write("title: %s\n" % title)

    # save whatever else is useful info bit like execution timestamp, etc.

return new_seg_id, title

create_video_segment (“actualID”,“actualName”,1,10,20,30, “ActualTitle”)

Hello @rasiamah
Open Kaltura knowledge Center where search Kaltura Video Tools in which you find Video Editing Tools, There is all guide available which you want.

Thank you @jhonalbert48,
I went through your suggestion and it is helpful but I am using the Kaltura API for this task I am working on but I couldn’t seem to find an resource that helps out out using the API.