Photo by

Create mini clips for long video

Venessa Fabio
Venessa Fabio
Dec 5, 2022
3 min read

Create video clips automatically from a long video. The following code can be used to create social media posts or to get a short clip of the most important part.

Create a pipeline with the highlights and split by topic skills to determine which segment has the most highlights. Each segment refers to a different topic and is created by the split by topic skill. Additionally, this method gives a headline for each segment and timestamps for the beginnings and ends of segments, allowing you to easily edit the video. This is just one example of how we can help you with your own custom needs.

You can get your own API key here and start experimenting with different pipelines.


As an example, let's take a look at this YouTube video: "". Based on how many highlights each segment had we can determine the top 3 segments.


import oneai

import base64

oneai.api_key = "[YOUR ONEAI API KEY]"

with open("AudioFile.mp3", "rb") as f:

    pipeline = oneai.Pipeline(

        steps = [







    Output =

# Split the recording into chapters

chapters = [{"chapter_name"['subheading'],"chapter_start":x.timestamp,"chapter_end":x.timestamp_end,"highlight_count":0} for x in Output.transcription.proofread.segments]

#Find the chapters with the most highlights

for highlight in Output.transcription.proofread.highlights:

    for chapter in chapters:

        if highlight.timestamp >= chapter["chapter_start"]:

            chapter["highlight_count"] += 1

#get the top 3 chapters

top_3 = sorted(chapters, key=lambda x: x['highlight_count'],reverse=True)[:2]




[{'chapter_name': 'How I studied the brain',  'chapter_start': datetime.timedelta(seconds=15, microseconds=650000),  'chapter_end': datetime.timedelta(seconds=308, microseconds=690000),  'highlight_count': 56}, {'chapter_name': 'What is your left hemisphere?',  'chapter_start': datetime.timedelta(seconds=309, microseconds=410000),  'chapter_end': datetime.timedelta(seconds=430, microseconds=730000),  'highlight_count': 42}]


API isn't your thing? Try this fast & easy clipmaker.

Ask our NLP experts about analyzing videos


Solely based on your most up-to-date content – websites, PDFs, or internal systems – with built-in fact-checking for enhanced trust.

Read Next