JSPM

video-to-audio

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 41
  • Score
    100M100P100Q68268F
  • License MIT

A lightweight video to audio conversion tool to convert mp4, avi and mov file to mp3, wav and aac file.

Package Exports

  • video-to-audio

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (video-to-audio) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

video-to-audio

A lightweight video to audio conversion tool to convert mp4, avi and mov file to mp3, wav and aac file.

DEMO

Install

npm install video-to-audio

Usage

import VideoToAudio from 'video-to-audio'

VideoToAudio.convert(sourceVideoFile, targetAudioFormat);

Example Code

<input type='file' accept=".mp4, .avi, .mov" onchange="convertToAudio(this)" />

import VideoToAudio from 'video-to-audio'

async function convertToAudio(input) {
    let sourceVideoFile = input.files[0];
    let targetAudioFormat = 'mp3'
    let convertedAudioDataObj = await VideoToAudio.convert(sourceVideoFile, targetAudioFormat);
}
This convert function will return a converted audio data object which includes audio name, format and blob URL.
This blob URL can be used to download the converted audio.
function downloadAudio(convertedAudioDataObj) {
    let a = document.createElement("a");
    a.href = convertedAudioDataObj.data;
    a.download = convertedAudioDataObj.name + "." + convertedAudioDataObj.format;
    a.click();
}

License

MIT