download required video colab
4th Convocation Ceremony 2025 – University of Technology - YouTube college video
# Step 1: Install yt-dlp (includes FFmpeg)
!pip install -U yt-dlp
# Step 2: Inputs
video_url = "https://www.youtube.com/live/pivHaEiaGBU" # 🔹 Replace with your YouTube link
start_time = "01:00:00" # 🔹 Start time (hh:mm:ss)
end_time = "01:13:00" # 🔹 End time (hh:mm:ss)
output_file = "/content/trimmed_video.mp4"
# Step 3: Download only the specified time range
# yt-dlp uses FFmpeg behind the scenes for partial download
!yt-dlp "{video_url}" --download-sections "*{start_time}-{end_time}" -f "bestvideo+bestaudio[ext=m4a]/best[ext=mp4]" -o "{output_file}"
print("🎬 Downloaded required section only:", output_file)