Invest In Crypto News
  • Home
  • Latest News
    • Bitcoin News
    • Altcoin News
    • Ethereum News
    • Blockchain News
    • Doge News
    • NFT News
    • Video
    • Market Analysis
    • Business
    • Finance
    • Politics
    • Mining
    • Regulation
    • Technology
  • Top 10 Cryptos
  • Market Cap List
  • IC DAO
  • Donations
  • Contact
  • Buy Crypto
  • IC DAO
No Result
View All Result
Invest In Crypto News
  • Home
  • Latest News
    • Bitcoin News
    • Altcoin News
    • Ethereum News
    • Blockchain News
    • Doge News
    • NFT News
    • Video
    • Market Analysis
    • Business
    • Finance
    • Politics
    • Mining
    • Regulation
    • Technology
  • Top 10 Cryptos
  • Market Cap List
  • IC DAO
  • Donations
  • Contact
  • Buy Crypto
  • IC DAO
No Result
View All Result
Invest In Crypto News
No Result
View All Result

Creating SRT Files for Videos Using Node.js: A Comprehensive Guide

CryptoExpert by CryptoExpert
June 18, 2024
in Blockchain News
0
Pyth Network Integrates Price Oracles with IOTA EVM
  • Facebook
  • Twitter
  • Pinterest


You might also like

AAVE Price Prediction: $95 Is the Line in the Sand — Break It or Bleed to $87

Aave Proposal Targets 50 Reserves in Six-Market Wind-Down

GPT-5.6 Sol Advances AI Efficiency, Slashes Costs






Creating SRT subtitle files for videos is a crucial task for improving accessibility and user engagement. According to AssemblyAI, this can be efficiently achieved using Node.js and the AssemblyAI API. This guide walks through the process step-by-step.

Step 1: Set up Your Development Environment

To begin, ensure you have Node.js 18 or higher installed on your system. Create a new project folder and initialize a Node.js project:

mkdir srt-subtitles
cd srt-subtitles
npm init -y

Open the package.json file and add type: “module”, to use the ES Module syntax. Next, install the AssemblyAI JavaScript SDK:

okex

npm install –save assemblyai

Obtain an AssemblyAI API key from your dashboard and set it as an environment variable:

# Mac/Linux:
export ASSEMBLYAI_API_KEY=<YOUR_KEY>

# Windows:
set ASSEMBLYAI_API_KEY=<YOUR_KEY>

Step 2: Transcribe Your Video

With the environment set up, you can start transcribing your video files. Use a publicly accessible video URL or specify local files. Create a file called index.js and add the following code:

import { AssemblyAI } from ‘assemblyai’;

const client = new AssemblyAI({ apiKey: process.env.ASSEMBLYAI_API_KEY });

const transcript = await client.transcripts.transcribe({
audio: “https://storage.googleapis.com/aai-web-samples/aai-overview.mp4”,
});

Check for errors and log them:

if (transcript.status === “error”) {
throw new Error(transcript.error);
}

Step 3: Generate SRT File

After obtaining the transcript, generate the subtitles in SRT format. Import the necessary module to save the file to disk:

import { writeFile } from “fs/promises”;

Then, generate the SRT subtitles and save them:

const srt = await client.transcripts.subtitles(transcript.id, “srt”);
await writeFile(“./subtitles.srt”, srt);

You can customize the captions by specifying the chars_per_caption parameter:

const srt = await client.transcripts.subtitles(transcript.id, “srt”, 32);
await writeFile(“./subtitles.srt”, srt);

Step 4: Run the Script

Finally, run the script to generate the subtitles:

node index.js

After a few seconds, a new file subtitles.srt will appear on disk, containing the generated subtitles.

Next Steps

Now that you have your subtitle file, you can upload it to YouTube Studio or configure it in your video player. AssemblyAI also offers various tools to enhance your audio and video applications, which can be explored through their blog and documentation.

Image source: Shutterstock



Source link

  • Facebook
  • Twitter
  • Pinterest
CryptoExpert

CryptoExpert

Recommended For You

AAVE Price Prediction: $95 Is the Line in the Sand — Break It or Bleed to $87

by CryptoExpert
August 2, 2026
0
AAVE Price Prediction: $75 Breakdown Imminent as DeFi Selloff Accelerates

Iris Coleman Aug 02, 2026 09:56 AAVE is stuck at $92.39 with momentum flatlined and sellers dominating short-term order flow — but top traders...

Read more

Aave Proposal Targets 50 Reserves in Six-Market Wind-Down

by CryptoExpert
August 2, 2026
0
Cointelegraph

An Aave governance proposal would wind down the lending protocol’s V3 markets on six blockchains and retire dozens of low-use token listings, a cleanup covering $98.1 million in...

Read more

GPT-5.6 Sol Advances AI Efficiency, Slashes Costs

by CryptoExpert
August 1, 2026
0
OpenAI: Paf Leverages 85 Custom GPTs to Boost Developer Productivity

Zach Anderson Aug 01, 2026 20:22 OpenAI's GPT-5.6 model family delivers unmatched reasoning and cost efficiency, with Luna priced 80% lower and Sol leading...

Read more

BIS Project Agorá settles $1 million in tokenized cross-border payment trials

by CryptoExpert
August 1, 2026
0
Cointelegraph

Twenty-eight financial institutions and central banks completed real-value settlements across six currencies using tokenized central bank reserves and commercial bank deposits. Source link

Read more

Bitdeer (BTDR) Schedules Q2 2026 Earnings Call for August 10

by CryptoExpert
August 1, 2026
0
HIVE Digital Completes $28.75 Million Financing via Special Warrants to Bolster Bitcoin Mining

Felix Pinkston Aug 01, 2026 05:02 Bitdeer (BTDR) will report Q2 2026 earnings on August 10. Analysts will watch for updates on Bitcoin mining...

Read more
Next Post
Donald Trump Coin Solana

Is Trump Behind The New DJT Memecoin On Solana? What We Know

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Browse by Category

  • Altcoin News
  • Bitcoin News
  • Blockchain News
  • Business
  • Doge News
  • Ethereum News
  • Finance
  • Market Analysis
  • Mining
  • NFT News
  • Politics
  • Regulation
  • Technology
  • Trending Cryptos
  • Video

Sitemap

  • Market Cap
  • Donations
  • Trading
  • Mining
  • Contact

Legal Information

  • Privacy Policy
  • Anti-Spam Policy
  • Copyright Notice
  • DMCA Compliance
  • Social Media Disclaimer
  • Terms Of Service

Categories

  • Altcoin News
  • Bitcoin News
  • Blockchain News
  • Business
  • Doge News
  • Ethereum News
  • Finance
  • Market Analysis
  • Mining
  • NFT News
  • Politics
  • Regulation
  • Technology
  • Trending Cryptos
  • Video

© Copyright 2024 InvestInCryptoNews.com

No Result
View All Result
  • Home
  • Latest News
    • Bitcoin News
    • Altcoin News
    • Ethereum News
    • Blockchain News
    • Doge News
    • NFT News
    • Video
    • Market Analysis
    • Business
    • Finance
    • Politics
    • Mining
    • Regulation
    • Technology
  • Top 10 Cryptos
  • Market Cap List
  • IC DAO
  • Donations
  • Contact
  • Buy Crypto
  • IC DAO

© Copyright 2024 InvestInCryptoNews.com

This website is using cookies to improve the user-friendliness. You agree by using the website further.

Privacy policy
bitcoin
Bitcoin (BTC) $ 63,129.00
ethereum
Ethereum (ETH) $ 1,861.36
tether
Tether (USDT) $ 0.999179
bnb
BNB (BNB) $ 587.16
usd-coin
USDC (USDC) $ 0.999485
xrp
XRP (XRP) $ 1.08
solana
Solana (SOL) $ 73.07
tron
TRON (TRX) $ 0.327471
figure-heloc
Figure Heloc (FIGR_HELOC) $ 1.00
staked-ether
Lido Staked Ether (STETH) $ 2,265.05

Pin It on Pinterest

Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?