利用 AI 大模型和自动化工作流,根据主题或关键词一键生成高清短视频。Generate HD short videos from a topic or keyword with an automated AI workflow.
Python ai-video-generatorcontent-creationffmpeginstagram-reelsllmpythonshort-videosubtitlestext-to-speechtiktokvideo-automationvideo-workflowworkflow-automationyoutube-shorts
add pexels.video_concat_mode
harry74e634d64ca9
diff --git a/app/services/material.py b/app/services/material.pyindex 2c0bbf76..e2d92984 100644--- a/app/services/material.py+++ b/app/services/material.py@@ -1,3 +1,4 @@+import randomimport timeimport requests@@ -85,6 +86,9 @@ def download_videos(task_id: str,minimum_duration: int = 5) -> List[str]:valid_video_urls = []++ video_concat_mode = config.pexels.get("video_concat_mode", "")+for search_term in search_terms:# logger.info(f"searching videos for '{search_term}'")video_urls = search_videos(search_term=search_term,@@ -92,13 +96,18 @@ def download_videos(task_id: str,minimum_duration=minimum_duration,video_aspect=video_aspect)logger.info(f"found {len(video_urls)} videos for '{search_term}'")+i = 0for url in video_urls:+ if video_concat_mode == "random":+ url = random.choice(video_urls)+if url not in valid_video_urls:valid_video_urls.append(url)i += 1- if i >= 3:- break++ if i >= 3:+ breaklogger.info(f"downloading videos: {len(valid_video_urls)}")video_paths = []diff --git a/config.example.toml b/config.example.tomlindex 7a669ec7..b394786b 100644--- a/config.example.toml+++ b/config.example.toml@@ -53,6 +53,7 @@compute_type="int8"[pexels]+ video_concat_mode="sequential" # "random" or "sequential"[pexels.proxies]### Use a proxy to access the Pexels API### Format: "http://<username>:<password>@<proxy>:<port>"