npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

auto-shorts

v0.1.1

Published

Generate short videos with the help of AI.

Downloads

22

Readme

AutoShorts - AI-powered Shorts Generator

AutoShorts is a fully fledged package that generates shorts videos with the help of AI to write the script. It can generate popular types of video seen on YouTube Shorts and TikTok.

If you want to support the development of this package, consider buying me a coffee:

ko-fi

Introduction

The package is built with a flexible abstraction layer which allows you to quickly create different types of videos with different AI tools and can be easily extended to include more types and tools internally.

This repo includes a CLI interface and JS interface. The CLI interface is built on top of the JS interface. The JS interface is the core of the package and can be used to generate videos programmatically.

GUI interface is coming soon.

[!NOTE] This package is in the early stages of development and may have bugs - especially when interacting with AI to generate scripts. This package is not meant to be used in production environments yet. Since AI output is unpredictable, work is being done to make the output more predictable and controllable. If the AI generates an incorrect JSON output, then you can manually edit the JSON output to fix the issue. This package is subject to change and may have breaking changes in the future. Use at your own risk.

Features

You can generate popular types of short videos seen on YouTube Shorts and TikTok like:

  • Text-to-Speech (TTS) videos
  • Topic-based videos with images
  • Text message story videos
  • 'Would you rather' videos
  • Ranking item videos
  • And more...

The topic-based video type can be used to generate videos on a wide range of topics like:

  • News-related videos
  • Educational videos
  • Fun facts videos
  • And more...

| Text Message Video | News Video | Quiz Video | Rank Video | Would You Rather Video | | --- | --- | --- | --- | --- | | Text Message Video | News Video | Quiz Video | Rank Video | Would You Rather Video |

You can request new video types and tools to be added to the package by creating an issue on the GitHub repo.

[!WARNING] The package author is not responsible for any misuse of the package. The package author is not responsible for any content generated by the package. The package author is not responsible for any legal issues arising from the use of the package. The package author is not responsible for any financial loss arising from the use of the package. Use at your own risk.

Installation

Note: By default, the package use Ollama to generate scripts. Therefore a working Ollama installation is required. OpenAI support is coming soon.

For JS Interface

npm install auto-shorts

For CLI Interface (global installation)

npm install -g auto-shorts

Example (CLI Interface)

# Install the package globally
npm install -g auto-shorts

# Download the necessary resources (to './res' folder by default)
npx auto-shorts --download

# Generate a video with AI (will find the necessary resources in the './res' folder)
npx auto-shorts -p "make a news short about TypeScript" --ttsType ElevenLabsVoice --imageType PexelsImageGen --elevenLabsAPIKey YOUR_ELEVENLABS_API_KEY --pexelsAPIKey YOUR_PEXELS_API_KEY

You can also run the command interactively:

npx auto-shorts

For help:

npx auto-shorts --help

Example (JS Interface)

Note: You will need to download the necessary resources before running the code. You can do this by running the following command:

npx auto-shorts --download [path]

AI-Generated Video

const task = await genVideoWithAI(
    "make a news short about TypeScript",
    AIGenType.OllamaAIGen, {
    tempPath: 'video_temp',
    resPath: 'res',
    voiceGenType: VoiceGenType.ElevenLabsVoice,
    imageGenType: ImageGenType.PexelsImageGen,
    elevenLabsAPIKey: process.env.ELEVENLABS_API_KEY,
    pexelsAPIKey: process.env.PEXELS_API_KEY,
});

task.on('log', (log) => {
    console.info(log);
});

task.on('done', (output) => {
    console.info("--> Video generation complete! Video saved at: " + output);
});

Manual Video


/** @type {import("auto-shorts").VideoDataType} */
const data = {
    type: "topic",
    title: "TypeScript",
    description: "TypeScript is a programming language...",
    start_script: "Hello! Today we will be talking about TypeScript.",
    end_script: "That's all for today. Thanks for watching!",
    images: ["typescript logo"]
};

const task = await genVideoWithJson(
    data, {
    tempPath: 'video_temp',
    resPath: 'res',
    voiceGenType: VoiceGenType.ElevenLabsVoice,
    imageGenType: ImageGenType.GoogleScraperImageGen,
    elevenLabsAPIKey: process.env.ELEVENLABS_API_KEY,
    pexelsAPIKey: process.env.PEXELS_API_KEY,
});

task.on('log', (log) => {
    console.log(log);
});

task.on('done', (output) => {
    console.info("--> Video generation complete! Video saved at: " + output);
});

API Keys

This package uses AI tools like OpenAI and ElevenLabs to generate scripts and images. You need to provide the API keys for these tools to use this package.

You need to provide the following API key depending on what tools you want to use:

  • ElevenLabs API Key
  • Pexels API Key
  • Neets.ai API Key
  • OpenAI API Key (coming soon)

Make sure to provide the API keys in the environment variables with a package like dotenv.

Todo

  • [ ] Add GUI
  • [ ] Fix logging
  • [ ] Make AI output structured
  • [ ] Add more video types (Twitter/X posts, Reddit posts, etc.)
  • [ ] Add more AI tools (e.g., OpenAI, Neets.ai, AI Image Generators, etc.)
  • [ ] Add more customization options (custom fonts, colors, images, etc.)
  • [ ] Add more error handling
  • [ ] Add more tests
  • [ ] Add more documentation
  • [ ] Add support for more general video generation (e.g., long-form videos)

By Shafil Alam.