一个可一键生成短视频的AI大模型,亲测可用
  VlNAKfyhjjp9 2024年03月27日 55 0

大家好,我是 Java陈序员

自从 OpenAI 发布 Sora 文本生成视频模型后,文本生成视频的 AI 技术引起了无数圈内圈外人士的关注和实验。

今天,给大家介绍一个大模型,可一键生成短视频。

关注微信公众号:【Java陈序员】,获取开源项目分享、AI副业分享、超200本经典计算机电子书籍等。

项目介绍

MoneyPrinterTurbo —— 一个利用大模型,一键生成短视频的开源项目。

只需输入视频主题关键词,就可以全自动生成视频文案、视频素材、视频字幕、视频背景音乐,最后合成一个高清的短视频。

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

功能特色:

安装部署

1、环境准备

  • MoneyPrinterTurbo 推荐使用 conda 创建 python 虚拟环境,因此需要先安装好 conda
  • 下载安装 ImageMagick

2、拉取代码

3、创建 python 虚拟环境

conda create -n MoneyPrinterTurbo python=3.10
conda activate MoneyPrinterTurbo

4、安装依赖

pip install -r requirements.txt

5、修改配置文件

将 config.example.toml 文件复制一份,命名为 config.toml.

按照配置文件(如下配置)中的说明,配置好 pexels_api_keys 和 llm_provider,并根据 llm_provider 对应的服务商,配置相关的 API Key.

[app]
    # Pexels API Key
    # Register at https://www.pexels.com/api/ to get your API key.
    # You can use multiple keys to avoid rate limits.
    # For example: pexels_api_keys = ["123456789","abcdefghi"]
    # 特别注意格式,Key 用英文双引号括起来,多个Key用逗号隔开
    pexels_api_keys = []

    # 如果你没有 OPENAI API Key,可以使用 g4f 代替,或者使用国内的 Moonshot API
    llm_provider="openai" # "openai" or "moonshot" or "oneapi" or "g4f" or "azure"

    ########## OpenAI API Key
    # Visit https://openai.com/api/ for details on obtaining an API key.
    openai_api_key = ""
    openai_base_url = "" # no need to set it unless you want to use your own proxy
    openai_model_name = "gpt-4-turbo-preview"

    ########## Moonshot API Key
    # Visit https://platform.moonshot.cn/console/api-keys to get your API key.
    moonshot_api_key=""
    moonshot_base_url = "https://api.moonshot.cn/v1"
    moonshot_model_name = "moonshot-v1-8k"

    ########## OneAPI API Key
    # Visit https://github.com/songquanpeng/one-api to get your API key
    oneapi_api_key=""
    oneapi_base_url=""
    oneapi_model_name=""

    ########## G4F
    # Visit https://github.com/xtekky/gpt4free to get more details
    # Supported model list: https://github.com/xtekky/gpt4free/blob/main/g4f/models.py
    g4f_model_name = "gpt-3.5-turbo-16k-0613"

    ########## Azure API Key
    # Visit https://learn.microsoft.com/zh-cn/azure/ai-services/openai/ to get more details
    # API documentation: https://learn.microsoft.com/zh-cn/azure/ai-services/openai/reference
    azure_api_key = ""
    azure_base_url=""
    azure_model_name="gpt-35-turbo" # replace with your model deployment name
    azure_api_version = "2024-02-15-preview"


    # Subtitle Provider, "edge" or "whisper"
    # If empty, the subtitle will not be generated
    subtitle_provider = "edge"

    #
    # ImageMagick
    #
    # Once you have installed it, ImageMagick will be automatically detected, except on Windows!
    # On Windows, for example "C:\Program Files (x86)\ImageMagick-7.1.1-Q16-HDRI\magick.exe"
    # Download from https://imagemagick.org/archive/binaries/ImageMagick-7.1.1-29-Q16-x64-static.exe

    # imagemagick_path = "C:\\Program Files (x86)\\ImageMagick-7.1.1-Q16\\magick.exe"


    #
    # FFMPEG
    #
    # 通常情况下,ffmpeg 会被自动下载,并且会被自动检测到。
    # 但是如果你的环境有问题,无法自动下载,可能会遇到如下错误:
    #   RuntimeError: No ffmpeg exe could be found.
    #   Install ffmpeg on your system, or set the IMAGEIO_FFMPEG_EXE environment variable.
    # 此时你可以手动下载 ffmpeg 并设置 ffmpeg_path,下载地址:https://www.gyan.dev/ffmpeg/builds/

    # Under normal circumstances, ffmpeg is downloaded automatically and detected automatically.
    # However, if there is an issue with your environment that prevents automatic downloading, you might encounter the following error:
    #   RuntimeError: No ffmpeg exe could be found.
    #   Install ffmpeg on your system, or set the IMAGEIO_FFMPEG_EXE environment variable.
    # In such cases, you can manually download ffmpeg and set the ffmpeg_path, download link: https://www.gyan.dev/ffmpeg/builds/

    # ffmpeg_path = "C:\\Users\\harry\\Downloads\\ffmpeg.exe"
    #########################################################################################

[whisper]
    # Only effective when subtitle_provider is "whisper"

    # Run on GPU with FP16
    # model = WhisperModel(model_size, device="cuda", compute_type="float16")

    # Run on GPU with INT8
    # model = WhisperModel(model_size, device="cuda", compute_type="int8_float16")

    # Run on CPU with INT8
    # model = WhisperModel(model_size, device="cpu", compute_type="int8")

    # recommended model_size: "large-v3"
    model_size="large-v3"
    # if you want to use GPU, set device="cuda"
    device="CPU"
    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>"
        ### Example: "http://user:pass@proxy:1234"
        ### Doc: https://requests.readthedocs.io/en/latest/user/advanced/#proxies
        # http = "http://10.10.1.10:3128"
        # https = "http://10.10.1.10:1080"

在 Windows 系统,需要将 imagemagick_path 配置为你的 ImageMagick 实际安装路径(如果安装的时候没有修改路径,直接取消注释即可)。

6、启动项目

进入到项目根目录下,执行以下命令:

webui.bat

成功启动后,浏览器会自动打开:

http://localhost:8501

接下来,就可以愉快的生成视频了~

快速使用

1、浏览器访问

项目启动成功后,在浏览器中访问:

http://localhost:8501

成功访问后,出现如下页面:

2、开始生成视频

输入视频主题、视频文案(可选),其他的一些视频设置进行自定义修改,设置完毕后点击开始生成视频,就可以开始生成视频了!

3、如果你没有填写视频的关键词,工具会帮你生成视频的关键词

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

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

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

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

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

MoneyPrinterTurbo 安装简单,小白也能快速上手,在短时间内就能快速生成一个短视频!快去安装体验吧~

关注微信公众号:【Java陈序员】,回复【搞钱】获取项目源码地址。

最后

推荐的开源项目已经收录到 GitHub 项目,欢迎 Star

https://github.com/chenyl8848/great-open-source-project

或者访问网站,进行在线浏览:

https://chencoding.top:8090/#/

大家的点赞、收藏和评论都是对作者的支持,如文章对你有帮助还请点赞转发支持下,谢谢!

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2024年03月27日 0

暂无评论

推荐阅读
  KmYlqcgEuC3l   4天前   10   0   0 Python
VlNAKfyhjjp9