1 Star 0 Fork 0

马永凡/AI-Youtube-Shorts-Generator

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.py 1.33 KB
一键复制 编辑 原始数据 按行查看 历史
Vedank Purohit 提交于 2024-07-04 16:12 . Speaker Rec using Lip Movement
from Components.YoutubeDownloader import download_youtube_video
from Components.Edit import extractAudio, crop_video
from Components.Transcription import transcribeAudio
from Components.LanguageTasks import GetHighlight
from Components.FaceCrop import crop_to_vertical, combine_videos
url = input("Enter YouTube video URL: ")
Vid= download_youtube_video(url)
if Vid:
Vid = Vid.replace(".webm", ".mp4")
print(f"Downloaded video and audio files successfully! at {Vid}")
Audio = extractAudio(Vid)
if Audio:
transcriptions = transcribeAudio(Audio)
if len(transcriptions) > 0:
TransText = ""
for text, start, end in transcriptions:
TransText += (f"{start} - {end}: {text}")
start , stop = GetHighlight(TransText)
if start != 0 and stop != 0:
print(f"Start: {start} , End: {stop}")
Output = "Out.mp4"
crop_video(Vid, Output, start, stop)
croped = "croped.mp4"
crop_to_vertical("Out.mp4", croped)
combine_videos("Out.mp4", croped, "Final.mp4")
else:
print("Error in getting highlight")
else:
print("No transcriptions found")
else:
print("No audio file found")
else:
print("Unable to Download the video")
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ma-yongfan/AI-Youtube-Shorts-Generator.git
git@gitee.com:ma-yongfan/AI-Youtube-Shorts-Generator.git
ma-yongfan
AI-Youtube-Shorts-Generator
AI-Youtube-Shorts-Generator
main

搜索帮助