翼度科技»论坛 编程开发 python 查看内容

一个可一键生成短视频的AI大模型,亲测可用

3

主题

3

帖子

9

积分

新手上路

Rank: 1

积分
9
大家好,我是 Java陈序员。
自从 OpenAI 发布 Sora 文本生成视频模型后,文本生成视频的 AI 技术引起了无数圈内圈外人士的关注和实验。
今天,给大家介绍一个大模型,可一键生成短视频。
关注微信公众号:【Java陈序员】,获取开源项目分享、AI副业分享、超200本经典计算机电子书籍等。
项目介绍

MoneyPrinterTurbo —— 一个利用大模型,一键生成短视频的开源项目。
只需输入视频主题关键词,就可以全自动生成视频文案、视频素材、视频字幕、视频背景音乐,最后合成一个高清的短视频。

MoneyPrinterTurbo 支持生成竖屏9:16(抖音视频)、横屏16:9(西瓜视频)两种视频尺寸。


功能特色:

安装部署

1、环境准备

  • MoneyPrinterTurbo 推荐使用 conda 创建 python 虚拟环境,因此需要先安装好 conda
  • 下载安装 ImageMagick
2、拉取代码
3、创建 python 虚拟环境
  1. conda create -n MoneyPrinterTurbo python=3.10
  2. conda activate MoneyPrinterTurbo
复制代码
4、安装依赖
  1. pip install -r requirements.txt
复制代码
5、修改配置文件
将 config.example.toml 文件复制一份,命名为 config.toml.
按照配置文件(如下配置)中的说明,配置好 pexels_api_keys 和 llm_provider,并根据 llm_provider 对应的服务商,配置相关的 API Key.
  1. [app]
  2.     # Pexels API Key
  3.     # Register at https://www.pexels.com/api/ to get your API key.
  4.     # You can use multiple keys to avoid rate limits.
  5.     # For example: pexels_api_keys = ["123456789","abcdefghi"]
  6.     # 特别注意格式,Key 用英文双引号括起来,多个Key用逗号隔开
  7.     pexels_api_keys = []
  8.     # 如果你没有 OPENAI API Key,可以使用 g4f 代替,或者使用国内的 Moonshot API
  9.     llm_provider="openai" # "openai" or "moonshot" or "oneapi" or "g4f" or "azure"
  10.     ########## OpenAI API Key
  11.     # Visit https://openai.com/api/ for details on obtaining an API key.
  12.     openai_api_key = ""
  13.     openai_base_url = "" # no need to set it unless you want to use your own proxy
  14.     openai_model_name = "gpt-4-turbo-preview"
  15.     ########## Moonshot API Key
  16.     # Visit https://platform.moonshot.cn/console/api-keys to get your API key.
  17.     moonshot_api_key=""
  18.     moonshot_base_url = "https://api.moonshot.cn/v1"
  19.     moonshot_model_name = "moonshot-v1-8k"
  20.     ########## OneAPI API Key
  21.     # Visit https://github.com/songquanpeng/one-api to get your API key
  22.     oneapi_api_key=""
  23.     oneapi_base_url=""
  24.     oneapi_model_name=""
  25.     ########## G4F
  26.     # Visit https://github.com/xtekky/gpt4free to get more details
  27.     # Supported model list: https://github.com/xtekky/gpt4free/blob/main/g4f/models.py
  28.     g4f_model_name = "gpt-3.5-turbo-16k-0613"
  29.     ########## Azure API Key
  30.     # Visit https://learn.microsoft.com/zh-cn/azure/ai-services/openai/ to get more details
  31.     # API documentation: https://learn.microsoft.com/zh-cn/azure/ai-services/openai/reference
  32.     azure_api_key = ""
  33.     azure_base_url=""
  34.     azure_model_name="gpt-35-turbo" # replace with your model deployment name
  35.     azure_api_version = "2024-02-15-preview"
  36.     # Subtitle Provider, "edge" or "whisper"
  37.     # If empty, the subtitle will not be generated
  38.     subtitle_provider = "edge"
  39.     #
  40.     # ImageMagick
  41.     #
  42.     # Once you have installed it, ImageMagick will be automatically detected, except on Windows!
  43.     # On Windows, for example "C:\Program Files (x86)\ImageMagick-7.1.1-Q16-HDRI\magick.exe"
  44.     # Download from https://imagemagick.org/archive/binaries/ImageMagick-7.1.1-29-Q16-x64-static.exe
  45.     # imagemagick_path = "C:\\Program Files (x86)\\ImageMagick-7.1.1-Q16\\magick.exe"
  46.     #
  47.     # FFMPEG
  48.     #
  49.     # 通常情况下,ffmpeg 会被自动下载,并且会被自动检测到。
  50.     # 但是如果你的环境有问题,无法自动下载,可能会遇到如下错误:
  51.     #   RuntimeError: No ffmpeg exe could be found.
  52.     #   Install ffmpeg on your system, or set the IMAGEIO_FFMPEG_EXE environment variable.
  53.     # 此时你可以手动下载 ffmpeg 并设置 ffmpeg_path,下载地址:https://www.gyan.dev/ffmpeg/builds/
  54.     # Under normal circumstances, ffmpeg is downloaded automatically and detected automatically.
  55.     # However, if there is an issue with your environment that prevents automatic downloading, you might encounter the following error:
  56.     #   RuntimeError: No ffmpeg exe could be found.
  57.     #   Install ffmpeg on your system, or set the IMAGEIO_FFMPEG_EXE environment variable.
  58.     # In such cases, you can manually download ffmpeg and set the ffmpeg_path, download link: https://www.gyan.dev/ffmpeg/builds/
  59.     # ffmpeg_path = "C:\\Users\\harry\\Downloads\\ffmpeg.exe"
  60.     #########################################################################################
  61. [whisper]
  62.     # Only effective when subtitle_provider is "whisper"
  63.     # Run on GPU with FP16
  64.     # model = WhisperModel(model_size, device="cuda", compute_type="float16")
  65.     # Run on GPU with INT8
  66.     # model = WhisperModel(model_size, device="cuda", compute_type="int8_float16")
  67.     # Run on CPU with INT8
  68.     # model = WhisperModel(model_size, device="cpu", compute_type="int8")
  69.     # recommended model_size: "large-v3"
  70.     model_size="large-v3"
  71.     # if you want to use GPU, set device="cuda"
  72.     device="CPU"
  73.     compute_type="int8"
  74. [pexels]
  75.     video_concat_mode="sequential" # "random" or "sequential"
  76.     [pexels.proxies]
  77.         ### Use a proxy to access the Pexels API
  78.         ### Format: "http://<username>:<password>@<proxy>:<port>"
  79.         ### Example: "http://user:pass@proxy:1234"
  80.         ### Doc: https://requests.readthedocs.io/en/latest/user/advanced/#proxies
  81.         # http = "http://10.10.1.10:3128"
  82.         # https = "http://10.10.1.10:1080"
复制代码
在 Windows 系统,需要将 imagemagick_path 配置为你的 ImageMagick 实际安装路径(如果安装的时候没有修改路径,直接取消注释即可)。
6、启动项目
进入到项目根目录下,执行以下命令:
  1. webui.bat
复制代码
成功启动后,浏览器会自动打开:
  1. http://localhost:8501
复制代码
接下来,就可以愉快的生成视频了~
快速使用

1、浏览器访问
项目启动成功后,在浏览器中访问:
  1. http://localhost:8501
复制代码
成功访问后,出现如下页面:

2、开始生成视频
输入视频主题、视频文案(可选),其他的一些视频设置进行自定义修改,设置完毕后点击开始生成视频,就可以开始生成视频了!
3、如果你没有填写视频的关键词,工具会帮你生成视频的关键词

4、整个任务分为生成视频、音频、字幕,最终合成视频四个步骤

5、视频生成好后最后会生成一个任务 ID

6、生成的视频会存放在项目目录下的 storage 文件夹中

7、任务 ID 对应的文件夹中会有视频、音频、字幕素材以及最终的合成视频

8、最终生成视频的播放效果

MoneyPrinterTurbo 安装简单,小白也能快速上手,在短时间内就能快速生成一个短视频!快去安装体验吧~
关注微信公众号:【Java陈序员】,回复【搞钱】获取项目源码地址。
最后

推荐的开源项目已经收录到 GitHub 项目,欢迎 Star:
  1. https://github.com/chenyl8848/great-open-source-project
复制代码
或者访问网站,进行在线浏览:
  1. https://chencoding.top:8090/#/
复制代码
大家的点赞、收藏和评论都是对作者的支持,如文章对你有帮助还请点赞转发支持下,谢谢!

来源:https://www.cnblogs.com/codechen8848/p/18097412
免责声明:由于采集信息均来自互联网,如果侵犯了您的权益,请联系我们【E-Mail:cb@itdo.tech】 我们会及时删除侵权内容,谢谢合作!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x

举报 回复 使用道具