Compare commits
15 Commits
ab243c9a00
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e4f1c0f50 | ||
|
|
a0d076ee61 | ||
|
|
ce506eeeba | ||
|
|
719f2f7c98 | ||
|
|
33d74cded0 | ||
|
|
adcd186a2c | ||
|
|
8f031c8cfa | ||
|
|
869d34246b | ||
|
|
5fe8e483f6 | ||
|
|
b6e4dea9c3 | ||
|
|
132a7b392e | ||
|
|
41b5dbdf85 | ||
|
|
45ff8ec877 | ||
|
|
e7a57e49cc | ||
|
|
543ecf534b |
31
.gitea/workflows/build-gpu.yml
Normal file
31
.gitea/workflows/build-gpu.yml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
name: Build and publish GPU image
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-gpu:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check out repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Log in to Gitea Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: git.byte-mate.ru
|
||||||
|
username: Coder
|
||||||
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and publish linux/amd64 GPU image
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile.gpu
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
git.byte-mate.ru/coder/whishper-gpu:latest
|
||||||
13
Dockerfile
13
Dockerfile
@@ -1,9 +1,17 @@
|
|||||||
|
ARG DENO_VERSION=2.9.5
|
||||||
|
ARG YT_DLP_VERSION=2026.08.19
|
||||||
|
|
||||||
|
FROM denoland/deno:bin-${DENO_VERSION} AS deno_cache
|
||||||
|
|
||||||
# YT-DLP Download and setup
|
# YT-DLP Download and setup
|
||||||
FROM --platform=$BUILDPLATFORM golang:bookworm AS ytdlp_cache
|
FROM --platform=$BUILDPLATFORM golang:bookworm AS ytdlp_cache
|
||||||
ARG TARGETOS
|
ARG TARGETOS
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
ARG YT_DLP_VERSION
|
||||||
|
ARG YT_DLP_SHA256=1fa6733c37ea6fb51c99ad8fe785e7b7e5f3246c9b980230329d4fb72ed8d4d6
|
||||||
RUN apt update && apt install -y wget
|
RUN apt update && apt install -y wget
|
||||||
RUN wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -O /usr/local/bin/yt-dlp
|
RUN wget "https://github.com/yt-dlp/yt-dlp/releases/download/${YT_DLP_VERSION}/yt-dlp" -O /usr/local/bin/yt-dlp \
|
||||||
|
&& echo "${YT_DLP_SHA256} /usr/local/bin/yt-dlp" | sha256sum -c -
|
||||||
RUN chmod a+rx /usr/local/bin/yt-dlp
|
RUN chmod a+rx /usr/local/bin/yt-dlp
|
||||||
|
|
||||||
# Backend setup
|
# Backend setup
|
||||||
@@ -21,7 +29,7 @@ RUN chmod a+rx whishper
|
|||||||
FROM node:alpine as frontend
|
FROM node:alpine as frontend
|
||||||
ENV PNPM_HOME="/pnpm"
|
ENV PNPM_HOME="/pnpm"
|
||||||
ENV PATH="$PNPM_HOME:$PATH"
|
ENV PATH="$PNPM_HOME:$PATH"
|
||||||
RUN corepack enable
|
RUN npm install --global pnpm@8.15.9
|
||||||
COPY ./frontend /app
|
COPY ./frontend /app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -58,6 +66,7 @@ COPY --from=frontend-prod-deps /app/node_modules /app/frontend/node_modules
|
|||||||
COPY --from=backend-builder /app/whishper /bin/whishper
|
COPY --from=backend-builder /app/whishper /bin/whishper
|
||||||
RUN chmod a+rx /bin/whishper
|
RUN chmod a+rx /bin/whishper
|
||||||
COPY --from=ytdlp_cache /usr/local/bin/yt-dlp /bin/yt-dlp
|
COPY --from=ytdlp_cache /usr/local/bin/yt-dlp /bin/yt-dlp
|
||||||
|
COPY --from=deno_cache /deno /bin/deno
|
||||||
|
|
||||||
# Nginx setup
|
# Nginx setup
|
||||||
COPY ./nginx.conf /etc/nginx/nginx.conf
|
COPY ./nginx.conf /etc/nginx/nginx.conf
|
||||||
|
|||||||
@@ -1,15 +1,23 @@
|
|||||||
|
ARG DENO_VERSION=2.9.5
|
||||||
|
ARG YT_DLP_VERSION=2026.08.19
|
||||||
|
|
||||||
|
FROM denoland/deno:bin-${DENO_VERSION} AS deno_cache
|
||||||
|
|
||||||
# YT-DLP Download and setup
|
# YT-DLP Download and setup
|
||||||
FROM --platform=$BUILDPLATFORM golang:bookworm AS ytdlp_cache
|
FROM --platform=$BUILDPLATFORM golang:bookworm AS ytdlp_cache
|
||||||
ARG TARGETOS
|
ARG TARGETOS
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
ARG YT_DLP_VERSION
|
||||||
|
ARG YT_DLP_SHA256=1fa6733c37ea6fb51c99ad8fe785e7b7e5f3246c9b980230329d4fb72ed8d4d6
|
||||||
RUN apt update && apt install -y wget
|
RUN apt update && apt install -y wget
|
||||||
RUN wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -O /usr/local/bin/yt-dlp
|
RUN wget "https://github.com/yt-dlp/yt-dlp/releases/download/${YT_DLP_VERSION}/yt-dlp" -O /usr/local/bin/yt-dlp \
|
||||||
|
&& echo "${YT_DLP_SHA256} /usr/local/bin/yt-dlp" | sha256sum -c -
|
||||||
RUN chmod a+rx /usr/local/bin/yt-dlp
|
RUN chmod a+rx /usr/local/bin/yt-dlp
|
||||||
|
|
||||||
# Backend setup
|
# Backend setup
|
||||||
FROM devopsworks/golang-upx:latest as backend-builder
|
FROM devopsworks/golang-upx:latest AS backend-builder
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY ./backend /app
|
COPY ./backend /app
|
||||||
RUN go mod tidy
|
RUN go mod tidy
|
||||||
@@ -18,10 +26,10 @@ RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o whishper . && \
|
|||||||
RUN chmod a+rx whishper
|
RUN chmod a+rx whishper
|
||||||
|
|
||||||
# Frontend setup
|
# Frontend setup
|
||||||
FROM node:alpine as frontend
|
FROM node:alpine AS frontend
|
||||||
ENV PNPM_HOME="/pnpm"
|
ENV PNPM_HOME="/pnpm"
|
||||||
ENV PATH="$PNPM_HOME:$PATH"
|
ENV PATH="$PNPM_HOME:$PATH"
|
||||||
RUN corepack enable
|
RUN npm install --global pnpm@8.15.9
|
||||||
COPY ./frontend /app
|
COPY ./frontend /app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -34,7 +42,7 @@ ENV BODY_SIZE_LIMIT=0
|
|||||||
RUN pnpm run build
|
RUN pnpm run build
|
||||||
|
|
||||||
# Base container
|
# Base container
|
||||||
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04 as base
|
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu22.04 AS base
|
||||||
|
|
||||||
ENV PYTHON_VERSION=3.10
|
ENV PYTHON_VERSION=3.10
|
||||||
|
|
||||||
@@ -44,9 +52,19 @@ RUN export DEBIAN_FRONTEND=noninteractive \
|
|||||||
python${PYTHON_VERSION} \
|
python${PYTHON_VERSION} \
|
||||||
python${PYTHON_VERSION}-venv \
|
python${PYTHON_VERSION}-venv \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
|
python${PYTHON_VERSION}-dev \
|
||||||
|
build-essential \
|
||||||
|
pkg-config \
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
|
libavcodec-dev \
|
||||||
|
libavdevice-dev \
|
||||||
|
libavfilter-dev \
|
||||||
|
libavformat-dev \
|
||||||
|
libavutil-dev \
|
||||||
|
libswresample-dev \
|
||||||
|
libswscale-dev \
|
||||||
curl wget xz-utils \
|
curl wget xz-utils \
|
||||||
ffmpeg nginx supervisor \
|
nginx supervisor \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN ln -s -f /usr/bin/python${PYTHON_VERSION} /usr/bin/python3 && \
|
RUN ln -s -f /usr/bin/python${PYTHON_VERSION} /usr/bin/python3 && \
|
||||||
@@ -56,7 +74,9 @@ RUN ln -s -f /usr/bin/python${PYTHON_VERSION} /usr/bin/python3 && \
|
|||||||
# Python service setup
|
# Python service setup
|
||||||
COPY ./transcription-api /app/transcription
|
COPY ./transcription-api /app/transcription
|
||||||
WORKDIR /app/transcription
|
WORKDIR /app/transcription
|
||||||
RUN pip install -r requirements.txt && \
|
RUN python -m pip install --upgrade pip setuptools wheel "Cython<3" && \
|
||||||
|
pip install "av==10.0.0" --no-build-isolation && \
|
||||||
|
pip install -r requirements.txt && \
|
||||||
pip install python-multipart && \
|
pip install python-multipart && \
|
||||||
pip3 install torch --index-url https://download.pytorch.org/whl/cu118
|
pip3 install torch --index-url https://download.pytorch.org/whl/cu118
|
||||||
|
|
||||||
@@ -76,6 +96,7 @@ COPY --from=frontend-prod-deps /app/node_modules /app/frontend/node_modules
|
|||||||
COPY --from=backend-builder /app/whishper /bin/whishper
|
COPY --from=backend-builder /app/whishper /bin/whishper
|
||||||
RUN chmod a+rx /bin/whishper
|
RUN chmod a+rx /bin/whishper
|
||||||
COPY --from=ytdlp_cache /usr/local/bin/yt-dlp /bin/yt-dlp
|
COPY --from=ytdlp_cache /usr/local/bin/yt-dlp /bin/yt-dlp
|
||||||
|
COPY --from=deno_cache /deno /bin/deno
|
||||||
|
|
||||||
# Nginx setup
|
# Nginx setup
|
||||||
COPY ./nginx.conf /etc/nginx/nginx.conf
|
COPY ./nginx.conf /etc/nginx/nginx.conf
|
||||||
|
|||||||
22
README.md
22
README.md
@@ -1,10 +1,12 @@
|
|||||||
[](https://whishper.net)
|
[](https://whishper-docs.pages.dev/)
|
||||||
|
|
||||||
[](https://whishper.net)
|
[](https://whishper-docs.pages.dev)
|
||||||
[](https://whishper.net/guides/install)
|
[](https://whishper-docs.pages.dev/guides/install)
|
||||||
[](#screenshots)
|
[](#screenshots)
|
||||||
[](https://hub.docker.com/r/pluja/whishper)
|
[](https://hub.docker.com/r/pluja/whishper)
|
||||||
|
|
||||||
|
## 🚧 I am working on a complete rewrite of the project. Progress on this can be seen at [v4 branch](https://github.com/pluja/whishper/tree/v4). Consequently, this branch will not receive any new releases or updates.
|
||||||
|
|
||||||
**Whishper** is an open-source, 100% local audio transcription and subtitling suite with a full-featured web UI.
|
**Whishper** is an open-source, 100% local audio transcription and subtitling suite with a full-featured web UI.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
@@ -26,6 +28,8 @@
|
|||||||
- [x] 🔥 **GPU support**: use your NVIDIA GPU to get even faster transcription times!
|
- [x] 🔥 **GPU support**: use your NVIDIA GPU to get even faster transcription times!
|
||||||
- [x] 🐎 **CPU support**: no GPU? No problem! Whishper can run on CPU too.
|
- [x] 🐎 **CPU support**: no GPU? No problem! Whishper can run on CPU too.
|
||||||
|
|
||||||
|
The Docker images pin `yt-dlp` to `2026.08.19` and include Deno `2.9.5`, which yt-dlp uses to solve YouTube JavaScript challenges. Both versions can be overridden at build time with the `YT_DLP_VERSION` and `DENO_VERSION` build arguments (update `YT_DLP_SHA256` when changing yt-dlp).
|
||||||
|
|
||||||
### Roadmap
|
### Roadmap
|
||||||
|
|
||||||
- [ ] Local folder as media input ([#15](https://github.com/pluja/whishper/issues/15)).
|
- [ ] Local folder as media input ([#15](https://github.com/pluja/whishper/issues/15)).
|
||||||
@@ -54,16 +58,16 @@ Contributions are welcome! Feel free to open a PR with your changes, or take a l
|
|||||||
|
|
||||||
### Development setup
|
### Development setup
|
||||||
|
|
||||||
Check out the development documentation [here](https://whishper.net/guides/development/).
|
Check out the development documentation [here](https://whishper-docs.pages.dev/guides/develop/).
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||
These screenshots are available on [the official website](https://whishper.net/usage/transcriptions/), click any of the following links to see:
|
These screenshots are available on [the official website](https://whishper-docs.pages.dev/usage/transcriptions/), click any of the following links to see:
|
||||||
|
|
||||||
- [A transcription creation](https://whishper.net/usage/transcriptions/)
|
- [A transcription creation](https://whishper-docs.pages.dev/usage/transcriptions/)
|
||||||
- [A transcription translation](https://whishper.net/usage/translate/)
|
- [A transcription translation](https://whishper-docs.pages.dev/usage/translate/)
|
||||||
- [A transcription download](https://whishper.net/usage/download/)
|
- [A transcription download](https://whishper-docs.pages.dev/usage/download/)
|
||||||
- [The subtitle editor](https://whishper.net/usage/editor/)
|
- [The subtitle editor](https://whishper-docs.pages.dev/usage/editor/)
|
||||||
|
|
||||||
## Support
|
## Support
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,20 @@
|
|||||||
|
ARG DENO_VERSION=2.9.5
|
||||||
|
ARG YT_DLP_VERSION=2026.08.19
|
||||||
|
|
||||||
|
FROM denoland/deno:bin-${DENO_VERSION} AS deno_cache
|
||||||
|
|
||||||
FROM --platform=$BUILDPLATFORM golang:bookworm AS ytdlp_cache
|
FROM --platform=$BUILDPLATFORM golang:bookworm AS ytdlp_cache
|
||||||
ARG TARGETOS
|
ARG TARGETOS
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
ARG YT_DLP_VERSION
|
||||||
|
ARG YT_DLP_SHA256=1fa6733c37ea6fb51c99ad8fe785e7b7e5f3246c9b980230329d4fb72ed8d4d6
|
||||||
RUN apt update && apt install -y wget
|
RUN apt update && apt install -y wget
|
||||||
RUN wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -O /usr/local/bin/yt-dlp
|
RUN wget "https://github.com/yt-dlp/yt-dlp/releases/download/${YT_DLP_VERSION}/yt-dlp" -O /usr/local/bin/yt-dlp \
|
||||||
|
&& echo "${YT_DLP_SHA256} /usr/local/bin/yt-dlp" | sha256sum -c -
|
||||||
RUN chmod a+rx /usr/local/bin/yt-dlp
|
RUN chmod a+rx /usr/local/bin/yt-dlp
|
||||||
|
|
||||||
FROM devopsworks/golang-upx:latest as builder
|
FROM devopsworks/golang-upx:1.23 as builder
|
||||||
ENV DEBIAN_FRONTEND noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN go mod tidy
|
RUN go mod tidy
|
||||||
@@ -23,6 +31,7 @@ WORKDIR /app
|
|||||||
COPY --from=builder /app/whishper ./whishper
|
COPY --from=builder /app/whishper ./whishper
|
||||||
RUN chmod a+rx ./whishper
|
RUN chmod a+rx ./whishper
|
||||||
COPY --from=ytdlp_cache /usr/local/bin/yt-dlp /bin/yt-dlp
|
COPY --from=ytdlp_cache /usr/local/bin/yt-dlp /bin/yt-dlp
|
||||||
|
COPY --from=deno_cache /deno /bin/deno
|
||||||
|
|
||||||
RUN mkdir /app/uploads
|
RUN mkdir /app/uploads
|
||||||
|
|
||||||
|
|||||||
@@ -101,9 +101,20 @@ func (s *Server) handlePostTranscription(c *fiber.Ctx) error {
|
|||||||
return fiber.NewError(fiber.StatusInternalServerError, "Internal server error")
|
return fiber.NewError(fiber.StatusInternalServerError, "Internal server error")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write the JSON to the response body.
|
// Broadcast transcription to websocket clients
|
||||||
s.BroadcastTranscription(res)
|
s.BroadcastTranscription(res)
|
||||||
s.NewTranscriptionCh <- true
|
s.NewTranscriptionCh <- true
|
||||||
|
|
||||||
|
// Convert the transcription to JSON.
|
||||||
|
json, err := json.Marshal(res)
|
||||||
|
if err != nil {
|
||||||
|
// 503 On vacation!
|
||||||
|
return fiber.NewError(fiber.StatusServiceUnavailable, "On vacation!")
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write the JSON to the response body.
|
||||||
|
c.Set("Content-Type", "application/json")
|
||||||
|
c.Write(json)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ require (
|
|||||||
github.com/gofiber/fiber/v2 v2.50.0
|
github.com/gofiber/fiber/v2 v2.50.0
|
||||||
github.com/rs/zerolog v1.30.0
|
github.com/rs/zerolog v1.30.0
|
||||||
github.com/snakesel/libretranslate v0.0.2
|
github.com/snakesel/libretranslate v0.0.2
|
||||||
github.com/wader/goutubedl v0.0.0-20230817095831-89e825670ccd
|
github.com/wader/goutubedl v0.0.0-20260820181547-08cab29d2129
|
||||||
go.mongodb.org/mongo-driver v1.12.1
|
go.mongodb.org/mongo-driver v1.12.1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ github.com/valyala/fasthttp v1.50.0 h1:H7fweIlBm0rXLs2q0XbalvJ6r0CUPFWK3/bB4N13e
|
|||||||
github.com/valyala/fasthttp v1.50.0/go.mod h1:k2zXd82h/7UZc3VOdJ2WaUqt1uZ/XpXAfE9i+HBC3lA=
|
github.com/valyala/fasthttp v1.50.0/go.mod h1:k2zXd82h/7UZc3VOdJ2WaUqt1uZ/XpXAfE9i+HBC3lA=
|
||||||
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
|
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
|
||||||
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
|
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
|
||||||
github.com/wader/goutubedl v0.0.0-20230817095831-89e825670ccd h1:XPyQDsvxm+Kawdk41tpvODAEcm24h9vVR/aZTI0tGAk=
|
github.com/wader/goutubedl v0.0.0-20260820181547-08cab29d2129 h1:EgoBHZNnX13+Ig3pp0CZWKkarqDs0iHMn+smvrXYRf8=
|
||||||
github.com/wader/goutubedl v0.0.0-20230817095831-89e825670ccd/go.mod h1:5KXd5tImdbmz4JoVhePtbIokCwAfEhUVVx3WLHmjYuw=
|
github.com/wader/goutubedl v0.0.0-20260820181547-08cab29d2129/go.mod h1:5KXd5tImdbmz4JoVhePtbIokCwAfEhUVVx3WLHmjYuw=
|
||||||
github.com/wader/osleaktest v0.0.0-20191111175233-f643b0fed071 h1:QkrG4Zr5OVFuC9aaMPmFI0ibfhBZlAgtzDYWfu7tqQk=
|
github.com/wader/osleaktest v0.0.0-20191111175233-f643b0fed071 h1:QkrG4Zr5OVFuC9aaMPmFI0ibfhBZlAgtzDYWfu7tqQk=
|
||||||
github.com/wader/osleaktest v0.0.0-20191111175233-f643b0fed071/go.mod h1:XD6emOFPHVzb0+qQpiNOdPL2XZ0SRUM0N5JHuq6OmXo=
|
github.com/wader/osleaktest v0.0.0-20191111175233-f643b0fed071/go.mod h1:XD6emOFPHVzb0+qQpiNOdPL2XZ0SRUM0N5JHuq6OmXo=
|
||||||
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
|
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
FROM node:alpine as base
|
FROM node:alpine as base
|
||||||
ENV PNPM_HOME="/pnpm"
|
ENV PNPM_HOME="/pnpm"
|
||||||
ENV PATH="$PNPM_HOME:$PATH"
|
ENV PATH="$PNPM_HOME:$PATH"
|
||||||
RUN corepack enable
|
RUN npm install --global pnpm@8.15.9
|
||||||
COPY . /app
|
COPY . /app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
|
|||||||
@@ -102,13 +102,13 @@ export const downloadVTT = function (jsonData, title) {
|
|||||||
jsonData.forEach((segment, index) => {
|
jsonData.forEach((segment, index) => {
|
||||||
let startSeconds = Math.floor(segment.start);
|
let startSeconds = Math.floor(segment.start);
|
||||||
let startMillis = Math.floor((segment.start - startSeconds) * 1000);
|
let startMillis = Math.floor((segment.start - startSeconds) * 1000);
|
||||||
let start = new Date(startSeconds * 1000 + startMillis).toISOString().substr(11, 12).replace('.', ',');
|
let start = new Date(startSeconds * 1000 + startMillis).toISOString().substr(11, 12);
|
||||||
|
|
||||||
let endSeconds = Math.floor(segment.end);
|
let endSeconds = Math.floor(segment.end);
|
||||||
let endMillis = Math.floor((segment.end - endSeconds) * 1000);
|
let endMillis = Math.floor((segment.end - endSeconds) * 1000);
|
||||||
let end = new Date(endSeconds * 1000 + endMillis).toISOString().substr(11, 12).replace('.', ',');
|
let end = new Date(endSeconds * 1000 + endMillis).toISOString().substr(11, 12);
|
||||||
|
|
||||||
vttContent += `${index + 1}\n${start} --> ${end}\n- ${segment.text}\n\n`;
|
vttContent += `${index + 1}\n${start} --> ${end}\n${segment.text}\n\n`;
|
||||||
});
|
});
|
||||||
|
|
||||||
let vttBlob = new Blob([vttContent], {type: 'text/plain'});
|
let vttBlob = new Blob([vttContent], {type: 'text/plain'});
|
||||||
|
|||||||
Reference in New Issue
Block a user