Skip to content

Instantly share code, notes, and snippets.

View alizahidraja's full-sized avatar

Ali Zahid Raja alizahidraja

View GitHub Profile
@alizahidraja
alizahidraja / split_youtubevideo.py
Created December 7, 2022 21:26
Split a YouTube Video using Chapters in Python
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
def convert_time_to_seconds(time):
# ChatGPT wrote this function
try:
hour, minute, second = map(int, time.split(":"))
return hour * 3600 + minute * 60 + second
except:
minute, second = map(int, time.split(":"))
return minute * 60 + second