npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@sellmind/video-editor-core

v2.0.0

Published

Core library for SellMind Video Editor

Readme

@sellmind-video-editor/core

A TypeScript library for video and audio processing using FFmpeg.

Features

Audio/Video Processing

  • Voice/Video Separation: Split video files into separate audio and video tracks
  • Voice Integration: Add audio tracks to video files
  • Pure Video Extraction: Extract video-only tracks without audio
  • Audio Extraction: Extract audio-only tracks from video files
  • Audio Track Listing: Get information about audio tracks in video files

Video Processing

  • Video Splitting: Split videos into multiple segments
  • Video Merging: Combine multiple videos with optional transitions
  • Format Conversion: Convert videos between different formats with quality control
  • Frame Extraction: Extract frames from videos as images
  • Video Analysis: Get detailed video metadata and information

Subtitle Management

  • Add Subtitles: Add subtitle tracks to video files
  • Remove Subtitles: Remove existing subtitle tracks
  • List Subtitles: Get information about subtitle tracks

Installation

npm install @sellmind-video-editor/core
# or
pnpm add @sellmind-video-editor/core

Prerequisites

This library requires FFmpeg to be installed on your system:

  • macOS: brew install ffmpeg
  • Ubuntu/Debian: sudo apt update && sudo apt install ffmpeg
  • Windows: Download from FFmpeg official site

Usage

Voice/Video Processing

import { 
  splitVoiceAndVideo, 
  addVoiceToVideo, 
  getPureVideo, 
  getVoice,
  listAudioTracks 
} from '@sellmind-video-editor/core';

// Split video into separate audio and video files
await splitVoiceAndVideo({
  inputVideo: 'input.mp4',
  outputVideo: 'output_video.mp4',
  outputAudio: 'output_audio.mp3',
  audioFormat: 'mp3',
  audioBitrate: '192k',
  keepSubtitles: true
});

// Add audio to video
await addVoiceToVideo({
  inputVideo: 'video.mp4',
  inputAudio: 'audio.mp3',
  outputVideo: 'combined.mp4',
  audioVolume: 1.0
});

// Extract video without audio
await getPureVideo({
  inputVideo: 'input.mp4',
  outputVideo: 'video_only.mp4',
  keepSubtitles: true
});

// Extract audio only
await getVoice({
  inputVideo: 'input.mp4',
  outputAudio: 'audio_only.mp3',
  format: 'mp3',
  bitrate: '192k'
});

// List audio tracks
const audioTracks = await listAudioTracks('input.mp4');
console.log(audioTracks);

Video Processing

import { 
  splitVideo,
  mergeVideos,
  convertVideoFormat,
  extractFrames,
  getVideoInfo
} from '@sellmind-video-editor/core';

// Get video information
const videoInfo = await getVideoInfo('input.mp4');
console.log(`Duration: ${videoInfo.duration}s, Resolution: ${videoInfo.width}x${videoInfo.height}`);

// Split video into 30-second segments
await splitVideo({
  inputVideo: 'input.mp4',
  outputPattern: 'segment_%03d.mp4',
  segmentDuration: 30,
  outputDir: './segments'
});

// Merge multiple videos with fade transitions
await mergeVideos({
  inputVideos: ['video1.mp4', 'video2.mp4', 'video3.mp4'],
  outputVideo: 'merged.mp4',
  transition: 'fade',
  transitionDuration: 1.5
});

// Convert video to WebM format
await convertVideoFormat({
  inputVideo: 'input.mp4',
  outputVideo: 'output.webm',
  outputFormat: 'webm',
  quality: 'high',
  resolution: '1920x1080'
});

// Extract frames as PNG images
await extractFrames({
  inputVideo: 'input.mp4',
  outputDir: './frames',
  format: 'png',
  fps: 1, // 1 frame per second
  startTime: 10,
  duration: 30
});

Subtitle Management

import { addSubtitle, removeSubtitle, listSubtitles } from '@sellmind-video-editor/core';

// Add subtitle to video
await addSubtitle({
  inputVideo: 'input.mp4',
  subtitleFile: 'subtitles.srt',
  outputVideo: 'output_with_subs.mp4',
  language: 'en',
  title: 'English Subtitles'
});

// Remove subtitle from video
await removeSubtitle({
  inputVideo: 'input.mp4',
  outputVideo: 'output_no_subs.mp4',
  subtitleIndex: 0
});

// List all subtitles
const subtitles = await listSubtitles('input.mp4');
console.log(subtitles);

API Reference

Voice/Video Functions

splitVoiceAndVideo(options: SplitVoiceVideoOptions): Promise<void>

Splits a video file into separate audio and video tracks.

Options:

  • inputVideo (string): Path to input video file
  • outputVideo (string): Path for output video file
  • outputAudio (string): Path for output audio file
  • audioFormat? (AudioFormat): Audio format ('mp3' | 'wav' | 'aac' | 'flac')
  • audioBitrate? (string): Audio bitrate (e.g., '192k', '320k')
  • keepSubtitles? (boolean): Whether to keep subtitles in video output

addVoiceToVideo(options: AddVoiceOptions): Promise<void>

Adds an audio track to a video file.

Options:

  • inputVideo (string): Path to input video file
  • inputAudio (string): Path to input audio file
  • outputVideo (string): Path for output video file
  • audioVolume? (number): Audio volume multiplier (default: 1.0)

getPureVideo(options: PureVideoOptions): Promise<void>

Extracts video track without audio.

Options:

  • inputVideo (string): Path to input video file
  • outputVideo (string): Path for output video file
  • keepSubtitles? (boolean): Whether to keep subtitles

getVoice(options: VoiceOptions): Promise<void>

Extracts audio track from video.

Options:

  • inputVideo (string): Path to input video file
  • outputAudio (string): Path for output audio file
  • format? (AudioFormat): Output audio format
  • bitrate? (string): Audio bitrate

listAudioTracks(inputVideo: string): Promise<AudioTrack[]>

Lists all audio tracks in a video file.

Returns: Array of AudioTrack objects with:

  • index (number): Track index
  • codec (string): Audio codec
  • channels (number): Number of audio channels
  • sampleRate (string): Sample rate
  • bitrate (string): Bitrate
  • language? (string): Language code if available
  • title? (string): Track title if available

Video Processing Functions

splitVideo(options: SplitVideoOptions): Promise<string[]>

Split a video into multiple segments.

Options:

  • inputVideo (string): Path to input video file
  • outputPattern (string): Output filename pattern (e.g., 'segment_%03d.mp4')
  • segmentDuration (number): Duration of each segment in seconds
  • outputDir? (string): Output directory path
  • videoCodec? (string): Video codec to use
  • audioCodec? (string): Audio codec to use
  • maintainQuality? (boolean): Whether to maintain original quality

mergeVideos(options: MergeVideosOptions): Promise<void>

Merge multiple videos into a single video.

Options:

  • inputVideos (string[]): Array of input video file paths
  • outputVideo (string): Path for output merged video
  • videoCodec? (string): Video codec to use
  • audioCodec? (string): Audio codec to use
  • transition? ('none' | 'fade' | 'dissolve'): Transition type between videos
  • transitionDuration? (number): Transition duration in seconds

convertVideoFormat(options: ConvertVideoFormatOptions): Promise<void>

Convert video to different format with quality options.

Options:

  • inputVideo (string): Path to input video file
  • outputVideo (string): Path for output video file
  • outputFormat ('mp4' | 'avi' | 'mov' | 'mkv' | 'webm' | 'flv'): Target format
  • videoCodec? (string): Video codec to use
  • audioCodec? (string): Audio codec to use
  • videoBitrate? (string): Video bitrate
  • audioBitrate? (string): Audio bitrate
  • resolution? (string): Target resolution (e.g., '1920x1080')
  • fps? (number): Target frame rate
  • quality? ('low' | 'medium' | 'high' | 'ultra'): Quality preset

extractFrames(options: ExtractFramesOptions): Promise<string[]>

Extract frames from video as images.

Options:

  • inputVideo (string): Path to input video file
  • outputDir (string): Directory for output images
  • outputPattern? (string): Output filename pattern (e.g., 'frame_%04d.png')
  • format? ('png' | 'jpg' | 'bmp' | 'tiff'): Image format
  • fps? (number): Extract every nth frame per second
  • startTime? (number): Start time in seconds
  • duration? (number): Duration in seconds
  • resolution? (string): Scale frames to specific resolution

getVideoInfo(inputVideo: string): Promise<VideoInfo>

Get detailed video information and metadata.

Returns: VideoInfo object with:

  • duration (number): Video duration in seconds
  • width (number): Video width in pixels
  • height (number): Video height in pixels
  • fps (number): Frame rate
  • videoCodec (string): Video codec name
  • audioCodec? (string): Audio codec name if available
  • bitrate (number): Video bitrate
  • size (number): File size in bytes

Subtitle Functions

addSubtitle(options: AddSubtitleOptions): Promise<void>

Adds subtitle track to video.

Options:

  • inputVideo (string): Path to input video file
  • subtitleFile (string): Path to subtitle file (.srt, .vtt, .ass)
  • outputVideo (string): Path for output video file
  • language? (string): Language code
  • title? (string): Subtitle track title

removeSubtitle(options: RemoveSubtitleOptions): Promise<void>

Removes subtitle track from video.

Options:

  • inputVideo (string): Path to input video file
  • outputVideo (string): Path for output video file
  • subtitleIndex (number): Index of subtitle track to remove

listSubtitles(inputVideo: string): Promise<SubtitleTrack[]>

Lists all subtitle tracks in a video file.

Returns: Array of SubtitleTrack objects with:

  • index (number): Track index
  • codec (string): Subtitle codec
  • language? (string): Language code if available
  • title? (string): Track title if available

Error Handling

All functions throw errors for:

  • Missing input files
  • Invalid file formats
  • FFmpeg processing errors
  • File system permission issues

Always wrap function calls in try-catch blocks:

try {
  await splitVoiceAndVideo({
    inputVideo: 'input.mp4',
    outputVideo: 'video.mp4',
    outputAudio: 'audio.mp3'
  });
} catch (error) {
  console.error('Processing failed:', error.message);
}

Development

Building

pnpm build

Development Mode

pnpm dev

Testing

Create test files in the examples/ directory and run:

pnpm dev
node examples/your-test.js

License

MIT License - see LICENSE file for details.