代码拉取完成,页面将自动刷新
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")
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。