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


operation1 = KalturaClipAttributes()

operation1.offset = start_time

operation1.duration = clipDuration

operation2 = KalturaClipAttributes()

operation2.offset = start_time2

operation2.duration = clipDuration2


resource = KalturaOperationResource()

resource.resource = KalturaEntryResource()

resource.resource.entryId = source_id

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

resultEntry =, resource)

# Create New Media Entry

entry = KalturaMediaEntry() = " 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 =

resultEntry =, resource)


# save a state of file

new_seg_id =

title =

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.