Node.js FFMPEG Example to Extract Audio From MP4 Video File Using ffmpeg-extract-audio Library in Javascript Full Project For Beginners

 

 

npm i ffmpeg-extract-audio

 

 

Usage

 

 

const extractAudio = require('ffmpeg-extract-audio')
 
await extractAudio({
  input: 'media/1.mp4',
  output: 'test.mp3'
})

 

 

Give Additional Options

 

 

// extract audio at 50% volume (result is an mp3 stream)
const mp3Stream = await extractAudio({
  input: 'media/1.mp4',
  format: 'mp3',
  transform: (cmd) => {
    cmd.audioFilters([
      {
        filter: 'volume',
        options: '0.5'
      }
    ])
  }
})

Leave a Reply