tspace-video-quality
v1.0.0
Published
easy to covert video quality
Downloads
6
Maintainers
Readme
tspace-video-quality
Covert video quality
Install
Install with npm:
npm install tspace-video-quality --save
Basic Usage
Render Quality
import { VideoQuality, QualityRenderBase64, QualityRenderStream } from 'tspace-video-quality'
const videoQuality = new VideoQuality('<your-path-video.mp4>')
const results = await videoQuality
.temp('<your-path-temp-video>')
.maxQuality('720p')
.minQuality('480p')
.renderMultipleBase64()
//
const results = await videoQuality
.temp('<your-path-temp-video>')
.maxQuality('360p')
.minQuality('144p')
.renderMultipleStream()
cosnole.log(results)
Base64
const videoQuality = new VideoQuality('<your-path-video.mp4>')
const base64Results = await videoQuality.temp('<your-path-temp-video>').render(['720p','480p','360p'],'base64') as QualityRenderBase64
console.log(base64Results)
videoQuality.remove() // remove tmp video when finished
videoQuality.removeOrigin() // remove tmp video origin when finished
Stream
const videoQuality = new VideoQuality('<your-path-video.mp4>')
const streamResults = await videoQuality.temp('<your-path-temp-video>').render(['720p','480p'],'stream') as QualityRenderStream
videoQuality.remove() // remove tmp video when finished
videoQuality.removeOrigin() // remove tmp video origin when finished
Images
const videoQuality = new VideoQuality('<your-path-video.mp4>')
const images = await videoQuality.temp('<your-path-temp-video>').toImages([1,5,10,20]) // timestamp
videoQuality.removeOrigin()
console.log(images)
Meta Data
const meta = await new VideoQuality('<your-path-video.mp4>').getMetaData()
console.log(meta)
Quality
const quality = await new VideoQuality('<your-path-video.mp4>').getQuality()
console.log(quality)
Resolution
const resolution = await new VideoQuality('<your-path-video.mp4>').getResolution()
console.log(resolution)
Duration
const duration = await new VideoQuality('<your-path-video.mp4>').getDuration()
console.log(duration)
Sizes
const sizes = await new VideoQuality('<your-path-video.mp4>').getSizes()
console.log(sizes)