UNPKG

@yaron24/ffmpeg-concat

Version:

Concats a list of videos together using ffmpeg with sexy OpenGL transitions.

40 lines (33 loc) 592 B
'use strict' const parseUrl = require('url-parse') const extWhitelist = new Set([ // videos 'gif', 'mp4', 'webm', 'mkv', 'mov', 'avi', // images 'bmp', 'jpg', 'jpeg', 'png', 'tif', 'webp', // audio 'mp3', 'aac', 'wav', 'flac', 'opus', 'ogg' ]) module.exports = (url, opts = { strict: true }) => { const { pathname } = parseUrl(url) const parts = pathname.split('.') const ext = (parts[parts.length - 1] || '').trim().toLowerCase() if (!opts.strict || extWhitelist.has(ext)) { return ext } }