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
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
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

Taurus Links Platforms to Swift’s Blockchain Ledger

Understanding x402, AP2, MPP, ACP in Agentic Payments

Dallas Fed Economists Assess Tokenized Deposit 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:

Phemex

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

Taurus Links Platforms to Swift’s Blockchain Ledger

by CryptoExpert
August 28, 2026
0
Cointelegraph

Cointelegraph is committed to providing independent, high-quality journalism across the crypto, blockchain, AI, and fintech industries.All news, reviews, and analyses are produced with full journalistic independence and integrity....

Read more

Understanding x402, AP2, MPP, ACP in Agentic Payments

by CryptoExpert
August 27, 2026
0
AssemblyAI Introduces German STT and Enhances PII Detection

Alvin Lang Aug 27, 2026 16:44 Breaking down x402, AP2, MPP, and ACP protocols in agentic payments: their roles, overlaps, and market adoption as...

Read more

Dallas Fed Economists Assess Tokenized Deposit Costs

by CryptoExpert
August 27, 2026
0
Cointelegraph

Tokenized deposits could make bank funding less stable and raise credit costs for US households and businesses, according to an analysis by two economists at the Federal Reserve...

Read more

AMD and Meta Unveil MetaRoCE for AI-Scale Ethernet

by CryptoExpert
August 27, 2026
0
AMD and Meta Unveil MetaRoCE for AI-Scale Ethernet

Darius Baruo Aug 26, 2026 23:52 Meta and AMD reveal MetaRoCE, a multipath RDMA transport protocol designed to optimize AI network performance on programmable...

Read more

Protocol upgrade decouples consensus from execution to solve scaling bottlenecks

by CryptoExpert
August 26, 2026
0
Cointelegraph

High-performance blockchains often run into the same architectural limit, where the execution sits directly in the path of consensus. In a conventional synchronous model, validators must first execute...

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

© 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) $ 79,726.00
ethereum
Ethereum (ETH) $ 2,496.50
tether
Tether (USDT) $ 1.00
bnb
BNB (BNB) $ 710.72
xrp
XRP (XRP) $ 1.42
usd-coin
USDC (USDC) $ 0.999992
solana
Solana (SOL) $ 106.63
tron
TRON (TRX) $ 0.339517
staked-ether
Lido Staked Ether (STETH) $ 2,265.05
figure-heloc
Figure Heloc (FIGR_HELOC) $ 1.04

Pin It on Pinterest

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