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

South Korea Records $367M in Stablecoin Outflows

LDO Price Prediction: $0.31 Is the Last Line of Defense Before a 15% Flush

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






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

South Korea Records $367M in Stablecoin Outflows

by CryptoExpert
August 3, 2026
0
Cointelegraph

South Korea saw 560.3 billion won ($367 million) in stablecoin outflows to overseas exchanges in June, extending the country’s streak of monthly net stablecoin outflows to 18 consecutive...

Read more

LDO Price Prediction: $0.31 Is the Last Line of Defense Before a 15% Flush

by CryptoExpert
August 2, 2026
0
LDO Price Prediction: Exhausted Momentum Meets Whale Bids — $0.42 or $0.35 Is the Binary

Rebeca Moen Aug 02, 2026 09:51 LDO is scraping the floor of its Bollinger Band range at $0.33 with every major moving average stacked...

Read more

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
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) $ 62,725.00
ethereum
Ethereum (ETH) $ 1,853.87
tether
Tether (USDT) $ 0.999088
bnb
BNB (BNB) $ 581.97
usd-coin
USDC (USDC) $ 0.999552
xrp
XRP (XRP) $ 1.07
solana
Solana (SOL) $ 72.83
tron
TRON (TRX) $ 0.325834
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?