Tuesday, January 13, 2026
No Result
View All Result
The Crypto HODL
  • Home
  • Bitcoin
  • Crypto Updates
    • Altcoin
    • Ethereum
    • Crypto Updates
    • Crypto Mining
    • Crypto Exchanges
  • Blockchain
  • NFT
  • DeFi
  • Web3
  • Metaverse
  • Regulations
  • Scam Alert
  • Analysis
  • Videos
Marketcap
  • Home
  • Bitcoin
  • Crypto Updates
    • Altcoin
    • Ethereum
    • Crypto Updates
    • Crypto Mining
    • Crypto Exchanges
  • Blockchain
  • NFT
  • DeFi
  • Web3
  • Metaverse
  • Regulations
  • Scam Alert
  • Analysis
  • Videos
No Result
View All Result
The Crypto HODL
No Result
View All Result

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

June 18, 2024
in Blockchain
Reading Time: 2 mins read
0 0
A A
0
Home Blockchain
Share on FacebookShare on Twitter







Creating SRT subtitle recordsdata for movies is a vital activity for enhancing accessibility and person engagement. In keeping with AssemblyAI, this may be effectively achieved utilizing Node.js and the AssemblyAI API. This information walks by way of the method step-by-step.

Step 1: Arrange Your Growth Atmosphere

To start, guarantee you could have Node.js 18 or increased put in in your system. Create a brand new undertaking folder and initialize a Node.js undertaking:

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

Open the bundle.json file and add sort: “module”, to make use of the ES Module syntax. Subsequent, set up the AssemblyAI JavaScript SDK:

npm set up –save assemblyai

Receive an AssemblyAI API key out of your dashboard and set it as an setting variable:

# Mac/Linux:
export ASSEMBLYAI_API_KEY=<YOUR_KEY>

# Home windows:
set ASSEMBLYAI_API_KEY=<YOUR_KEY>

Step 2: Transcribe Your Video

With the setting arrange, you can begin transcribing your video recordsdata. Use a publicly accessible video URL or specify native recordsdata. Create a file referred to as index.js and add the next code:

import { AssemblyAI } from ‘assemblyai’;

const consumer = new AssemblyAI({ apiKey: course of.env.ASSEMBLYAI_API_KEY });

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

Verify for errors and log them:

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

Step 3: Generate SRT File

After acquiring the transcript, generate the subtitles in SRT format. Import the mandatory module to save lots of the file to disk:

import { writeFile } from “fs/guarantees”;

Then, generate the SRT subtitles and save them:

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

You possibly can customise the captions by specifying the chars_per_caption parameter:

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

Step 4: Run the Script

Lastly, run the script to generate the subtitles:

node index.js

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

Subsequent Steps

Now that you’ve got your subtitle file, you’ll be able to add it to YouTube Studio or configure it in your video participant. AssemblyAI additionally presents numerous instruments to reinforce your audio and video purposes, which could be explored by way of their weblog and documentation.

Picture supply: Shutterstock



Source link

Tags: ComprehensiveCreatingFilesGuideNode.jsSRTVIDEOS
Previous Post

Is Ethereum Poised For A Record Break? Top Analyst Says $5K is Coming Soon

Next Post

Former SEC Crypto Chief David Hirsch Denies Joining Pump.fun

Related Posts

VanEck CEO Flags Crypto as Q1 2026 Risk-On Play Amid Fiscal Clarity
Blockchain

VanEck CEO Flags Crypto as Q1 2026 Risk-On Play Amid Fiscal Clarity

January 13, 2026
Oracle Unveils AI Supply Chain Tool for Retailers at NRF 2026
Blockchain

Oracle Unveils AI Supply Chain Tool for Retailers at NRF 2026

January 12, 2026
AAVE Price Prediction: Targets $190 by January End Despite Current Neutral Momentum
Blockchain

AAVE Price Prediction: Targets $190 by January End Despite Current Neutral Momentum

January 12, 2026
Success Story: Sterling Brasher’s Learning Journey with 101 Blockchains
Blockchain

Success Story: Sterling Brasher’s Learning Journey with 101 Blockchains

January 12, 2026
AVAX Price Prediction: Targets $15.50-$16.50 by Early February
Blockchain

AVAX Price Prediction: Targets $15.50-$16.50 by Early February

January 12, 2026
AAVE Price Prediction: Targets $185-196 by Mid-January 2026
Blockchain

AAVE Price Prediction: Targets $185-196 by Mid-January 2026

January 11, 2026
Next Post
Former SEC Crypto Chief David Hirsch Denies Joining Pump.fun

Former SEC Crypto Chief David Hirsch Denies Joining Pump.fun

56% of America’s Largest Companies Are Now Building in Web3

56% of America’s Largest Companies Are Now Building in Web3

How To Spend Your Bitcoin, Without Ever Selling It

How To Spend Your Bitcoin, Without Ever Selling It

Leave a Reply Cancel reply

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

Twitter Instagram LinkedIn Telegram RSS
The Crypto HODL

Find the latest Bitcoin, Ethereum, blockchain, crypto, Business, Fintech News, interviews, and price analysis at The Crypto HODL

CATEGORIES

  • Altcoin
  • Analysis
  • Bitcoin
  • Blockchain
  • Crypto Exchanges
  • Crypto Mining
  • Crypto Updates
  • DeFi
  • Ethereum
  • Metaverse
  • NFT
  • Regulations
  • Scam Alert
  • Uncategorized
  • Videos
  • Web3

SITE MAP

  • Disclaimer
  • Privacy Policy
  • DMCA
  • Cookie Privacy Policy
  • Terms and Conditions
  • Contact us

Copyright © 2023 The Crypto HODL.
The Crypto HODL is not responsible for the content of external sites.

No Result
View All Result
  • Home
  • Bitcoin
  • Crypto Updates
    • Altcoin
    • Ethereum
    • Crypto Updates
    • Crypto Mining
    • Crypto Exchanges
  • Blockchain
  • NFT
  • DeFi
  • Web3
  • Metaverse
  • Regulations
  • Scam Alert
  • Analysis
  • Videos
Crypto Marketcap

Copyright © 2023 The Crypto HODL.
The Crypto HODL is not responsible for the content of external sites.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In