New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ffmpeg/ffmpeg

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ffmpeg/ffmpeg

FFmpeg WebAssembly version

  • 0.11.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
119K
increased by10.96%
Maintainers
1
Weekly downloads
 
Created

What is @ffmpeg/ffmpeg?

@ffmpeg/ffmpeg is a JavaScript package that provides a WebAssembly (Wasm) version of FFmpeg, allowing developers to perform video and audio processing directly in the browser or in Node.js environments. It enables functionalities such as video conversion, audio extraction, and media editing without needing to rely on server-side processing.

What are @ffmpeg/ffmpeg's main functionalities?

Video Conversion

This feature allows you to convert video files from one format to another. The code sample demonstrates converting an MP4 file to an AVI file using FFmpeg commands.

const { createFFmpeg, fetchFile } = require('@ffmpeg/ffmpeg');
const ffmpeg = createFFmpeg({ log: true });

(async () => {
  await ffmpeg.load();
  ffmpeg.FS('writeFile', 'input.mp4', await fetchFile('path/to/input.mp4'));
  await ffmpeg.run('-i', 'input.mp4', 'output.avi');
  const data = ffmpeg.FS('readFile', 'output.avi');
  // Do something with the output file
})();

Audio Extraction

This feature allows you to extract audio from a video file. The code sample shows how to extract audio from an MP4 file and save it as an MP3 file.

const { createFFmpeg, fetchFile } = require('@ffmpeg/ffmpeg');
const ffmpeg = createFFmpeg({ log: true });

(async () => {
  await ffmpeg.load();
  ffmpeg.FS('writeFile', 'input.mp4', await fetchFile('path/to/input.mp4'));
  await ffmpeg.run('-i', 'input.mp4', '-q:a', '0', '-map', 'a', 'output.mp3');
  const data = ffmpeg.FS('readFile', 'output.mp3');
  // Do something with the output audio file
})();

Video Editing

This feature allows you to perform video editing tasks such as resizing. The code sample demonstrates resizing a video to 320x240 pixels.

const { createFFmpeg, fetchFile } = require('@ffmpeg/ffmpeg');
const ffmpeg = createFFmpeg({ log: true });

(async () => {
  await ffmpeg.load();
  ffmpeg.FS('writeFile', 'input.mp4', await fetchFile('path/to/input.mp4'));
  await ffmpeg.run('-i', 'input.mp4', '-vf', 'scale=320:240', 'output.mp4');
  const data = ffmpeg.FS('readFile', 'output.mp4');
  // Do something with the edited video file
})();

Other packages similar to @ffmpeg/ffmpeg

Keywords

FAQs

Package last updated on 14 Aug 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc