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

ElevenLabs Unveils AI Interaction Engine and Customization Tools

Kraken’s xStocks Launches 200+ Tokenized UK, EU Stocks

HKMA and IA Ban Lim Ka Kit from Insurance Intermediary Role for Nine Months






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:

Betfury

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

ElevenLabs Unveils AI Interaction Engine and Customization Tools

by CryptoExpert
November 11, 2026
0
ElevenLabs Unveils AI Interaction Engine and Customization Tools

Home / Latest reporting News At its NYC Summit, ElevenLabs introduced tools for fine-tuning AI models, domain-specific solutions, and its new Interaction Engine for...

Read more

Kraken’s xStocks Launches 200+ Tokenized UK, EU Stocks

by CryptoExpert
November 11, 2026
0
Cointelegraph

Kraken parent Payward’s xStocks platform added tokenized versions of more than 200 stocks listed in the United Kingdom and European Union. Payward said Wednesday that eligible users can trade...

Read more

HKMA and IA Ban Lim Ka Kit from Insurance Intermediary Role for Nine Months

by CryptoExpert
November 11, 2026
0
HKMA and IA Ban Lim Ka Kit from Insurance Intermediary Role for Nine Months

Home / Latest reporting News The HKMA and IA jointly banned Lim Ka Kit for nine months for pressuring clients and altering underwriting data,...

Read more

Zcash Devs Eye 20-Second Blocks Days After Major Network Overhaul

by CryptoExpert
November 10, 2026
0
Zcash Devs Eye 20-Second Blocks Days After Major Network Overhaul

Key TakeawaysDevelopers proposed cutting Zcash’s target block interval to 20 seconds under draft NU7.1.NU7 retired Sprout on NU7, permanently freezing 12,226 ZEC ($16M) while ZEC rallied past $1,380.The...

Read more

Unitree Robotics (UNITREE) Pre-IPO Price Prediction: Momentum Is Extended, but Futures Positioning Still Favors Buyers

by CryptoExpert
November 10, 2026
0
Unitree Robotics (UNITREE) Pre-IPO Price Prediction: Momentum Is Extended, but Futures Positioning Still Favors Buyers

Home / Latest reporting Price Prediction Unitree Robotics (UNITREE) is trading at $111.25 after a 4.69% 24-hour gain, with price pressing above its short-...

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

© 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) $ 74,426.00
ethereum
Ethereum (ETH) $ 2,071.39
tether
Tether (USDT) $ 0.999209
bnb
BNB (BNB) $ 685.24
usd-coin
USDC (USDC) $ 0.999558
xrp
XRP (XRP) $ 1.06
solana
Solana (SOL) $ 84.61
tron
TRON (TRX) $ 0.31727
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?