!pip install moviepy
!apt-get install -y ffmpeg
from moviepy.video.io.ffmpeg_tools import ffmpeg_extract_subclip
# Mount Google Drive if your video is stored there
# from google.colab import drive
# drive.mount('/content/drive')
input_video_path = '/content/drive/MyDrive/path/to/your/input/video.mp4'
output_video_path = '/content/drive/MyDrive/path/to/your/output/trimmed_video.mp4'
start_time = 10 # start time in seconds
end_time = 30 # end time in seconds
ffmpeg_extract_subclip(input_video_path, start_time, end_time, targetname=output_video_path)