-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23ef7b4
commit dfb12d3
Showing
13 changed files
with
1,258 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
ci: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: 'go.mod' | ||
- name: Build | ||
run: go build -v ./... | ||
- name: Lint | ||
uses: golangci/golangci-lint-action@v3 | ||
- name: Test | ||
run: go test -v ./... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: goreleaser | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- run: git fetch --force --tags | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version-file: 'go.mod' | ||
cache: true | ||
- uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
distribution: goreleaser | ||
version: latest | ||
args: release --clean | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
builds: | ||
- id: vidai | ||
binary: vidai | ||
main: ./cmd/vidai | ||
goarch: | ||
- amd64 | ||
- arm64 | ||
- arm | ||
archives: | ||
- id: vidai | ||
builds: | ||
- vidai | ||
format: zip | ||
name_template: 'vidai_{{ .Version }}_{{- if eq .Os "darwin" }}macos{{- else }}{{ .Os }}{{ end }}_{{ .Arch }}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# builder image | ||
FROM golang:alpine as builder | ||
ARG TARGETPLATFORM | ||
COPY . /src | ||
WORKDIR /src | ||
RUN apk add --no-cache make bash git | ||
RUN make app-build PLATFORMS=$TARGETPLATFORM | ||
|
||
# running image | ||
FROM alpine | ||
WORKDIR /home | ||
COPY --from=builder /src/bin/vidai-* /bin/vidai | ||
|
||
# executable | ||
ENTRYPOINT [ "/bin/vidai" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
#!/bin/bash | ||
|
||
SHELL = /bin/bash | ||
PLATFORMS ?= linux/amd64 darwin/amd64 windows/amd64 | ||
IMAGE_PREFIX ?= igolaizola | ||
REPO_NAME ?= vidai | ||
COMMIT_SHORT ?= $(shell git rev-parse --verify --short HEAD) | ||
VERSION ?= $(COMMIT_SHORT) | ||
VERSION_NOPREFIX ?= $(shell echo $(VERSION) | sed -e 's/^[[v]]*//') | ||
|
||
# Build the binaries for the current platform | ||
.PHONY: build | ||
build: | ||
os=$$(go env GOOS); \ | ||
arch=$$(go env GOARCH); \ | ||
PLATFORMS="$$os/$$arch" make app-build | ||
|
||
# Build the binaries | ||
# Example: PLATFORMS=linux/amd64 make app-build | ||
.PHONY: app-build | ||
app-build: | ||
@for platform in $(PLATFORMS) ; do \ | ||
os=$$(echo $$platform | cut -f1 -d/); \ | ||
arch=$$(echo $$platform | cut -f2 -d/); \ | ||
arm=$$(echo $$platform | cut -f3 -d/); \ | ||
arm=$${arm#v}; \ | ||
ext=""; \ | ||
if [ "$$os" == "windows" ]; then \ | ||
ext=".exe"; \ | ||
fi; \ | ||
file=./bin/$(REPO_NAME)-$(VERSION_NOPREFIX)-$$(echo $$platform | tr / -)$$ext; \ | ||
GOOS=$$os GOARCH=$$arch GOARM=$$arm CGO_ENABLED=0 \ | ||
go build \ | ||
-a -x -tags netgo,timetzdata -installsuffix cgo -installsuffix netgo \ | ||
-ldflags " \ | ||
-X main.Version=$(VERSION_NOPREFIX) \ | ||
-X main.GitRev=$(COMMIT_SHORT) \ | ||
" \ | ||
-o $$file \ | ||
./cmd/$(REPO_NAME); \ | ||
if [ $$? -ne 0 ]; then \ | ||
exit 1; \ | ||
fi; \ | ||
chmod +x $$file; \ | ||
done | ||
|
||
# Build the docker image | ||
# Example: PLATFORMS=linux/amd64 make docker-build | ||
.PHONY: docker-build | ||
docker-build: | ||
rm -rf bin; \ | ||
@platforms=($(PLATFORMS)); \ | ||
platform=$${platforms[0]}; \ | ||
if [[ $${#platforms[@]} -ne 1 ]]; then \ | ||
echo "Multi-arch build not supported"; \ | ||
exit 1; \ | ||
fi; \ | ||
docker build --platform $$platform -t $(IMAGE_PREFIX)/$(REPO_NAME):$(VERSION) .; \ | ||
if [ $$? -ne 0 ]; then \ | ||
exit 1; \ | ||
fi | ||
|
||
# Build the docker images using buildx | ||
# Example: PLATFORMS="linux/amd64 darwin/amd64 windows/amd64" make docker-buildx | ||
.PHONY: docker-buildx | ||
docker-buildx: | ||
@platforms=($(PLATFORMS)); \ | ||
platform=$$(IFS=, ; echo "$${platforms[*]}"); \ | ||
docker buildx build --platform $$platform -t $(IMAGE_PREFIX)/$(REPO_NAME):$(VERSION) . | ||
|
||
# Clean binaries | ||
.PHONY: clean | ||
clean: | ||
rm -rf bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,105 @@ | ||
# vidai | ||
Video generation using AI | ||
# vidai 📹🤖 | ||
|
||
**vidai** generates videos using AI. | ||
|
||
This is a CLI for [RunwayML Gen-2](https://runwayml.com/) that adds some extra features on top of it. | ||
|
||
## 🚀 Features | ||
|
||
- Generate videos directly from the command line using a text or image prompt. | ||
- Create or extend videos longer than 4 seconds by reusing the last frame of the video as the input for the next generation. | ||
- Other handy tools to edit videos, like generate loops or resize videos. | ||
|
||
### | ||
|
||
## 📦 Installation | ||
|
||
You can use the Golang binary to install **vidai**: | ||
|
||
```bash | ||
go install github.com/igolaizola/vidai/cmd/vidai@latest | ||
``` | ||
|
||
Or you can download the binary from the [releases](https://github.com/igolaizola/vidai/releases) | ||
|
||
## 📋 Requirements | ||
|
||
You need to have a [RunwayML](https://runwayml.com/) account and extract the token from the request authorization header using your browser's developer tools. | ||
|
||
For extended videos, you need to have [ffmpeg](https://ffmpeg.org/) installed. | ||
|
||
## 🕹️ Usage | ||
|
||
Launch `vidai` with the `--help` flag to see the available commands and options: | ||
|
||
```bash | ||
vidai --help | ||
``` | ||
|
||
You can use the `--help` flag with any command to see the available options: | ||
|
||
```bash | ||
vidai generate --help | ||
``` | ||
|
||
Launch commands using a configuration file: | ||
|
||
```bash | ||
vidai generate --config vidai.conf | ||
``` | ||
|
||
```yaml | ||
# vidai.conf | ||
token RUNWAYML_TOKEN | ||
image car.jpg | ||
output car.mp4 | ||
extend 2 | ||
``` | ||
|
||
Using environment variables (`VIDAI` prefix, uppercase and underscores): | ||
|
||
```bash | ||
export VIDAI_TOKEN=RUNWAYML_TOKEN | ||
export VIDAI_IMAGE="car.jpg" | ||
export VIDAI_OUTPUT="car.mp4" | ||
export VIDAI_EXTEND=2 | ||
vidai generate | ||
``` | ||
|
||
Using command line arguments: | ||
|
||
```bash | ||
vidai generate --token RUNWAYML_TOKEN --image car.jpg --video car.mp4 --extend 2 | ||
``` | ||
|
||
## 💖 Support | ||
|
||
If you have found my code helpful, please give the repository a star ⭐ | ||
|
||
Additionally, if you would like to support my late-night coding efforts and the coffee that keeps me going, I would greatly appreciate a donation. | ||
|
||
You can invite me for a coffee at ko-fi (0% fees): | ||
|
||
[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/igolaizola) | ||
|
||
Or at buymeacoffee: | ||
|
||
[![buymeacoffee](https://user-images.githubusercontent.com/11333576/223217083-123c2c53-6ab8-4ea8-a2c8-c6cb5d08e8d2.png)](https://buymeacoffee.com/igolaizola) | ||
|
||
Donate to my PayPal: | ||
|
||
[paypal.me/igolaizola](https://www.paypal.me/igolaizola) | ||
|
||
Sponsor me on GitHub: | ||
|
||
[github.com/sponsors/igolaizola](https://github.com/sponsors/igolaizola) | ||
|
||
Or donate to any of my crypto addresses: | ||
|
||
- BTC `bc1qvuyrqwhml65adlu0j6l59mpfeez8ahdmm6t3ge` | ||
- ETH `0x960a7a9cdba245c106F729170693C0BaE8b2fdeD` | ||
- USDT (TRC20) `TD35PTZhsvWmR5gB12cVLtJwZtTv1nroDU` | ||
- USDC (BEP20) / BUSD (BEP20) `0x960a7a9cdba245c106F729170693C0BaE8b2fdeD` | ||
- Monero `41yc4R9d9iZMePe47VbfameDWASYrVcjoZJhJHFaK7DM3F2F41HmcygCrnLptS4hkiJARCwQcWbkW9k1z1xQtGSCAu3A7V4` | ||
|
||
Thanks for your support! |
Oops, something went wrong.