Skip to main content

Combine

Concatenate multiple videos into one, single video to rule them all. Remember, these videos must be the same format!

const combinedFiles = modfy.compress(
{
inputFiles: ['wedding_video.mp4', 'divorce_court_hearing.mp4'],
to: {
format: 'MOV',
codec: 'H.264' // Optional, will otherwise revert to the default codec for that format
}
},
'sync' // Can be 'async' | 'sync' | 'client',
'https://yourdomain.com/modfyWebhook'
)

Arguments#

ParameterTypeDescription
formatstringDesired format output
codecstring?If not specified, the default codec for that format will be used

undefined Full class reference is below

Typing#

modfy.convert(
{
inputFiles: AcceptedFiles,
to: ToFile
},
processType: ProcessType,
webhookUrl?: string
): Promise<Uint8Array> | Promise<{ id: string, uuid: string }>
type ToFile = {
format: FormatKey // From the keys of the default formats
codec?: CodecKey // From the keys of the default codecs
}
type ProcessType = "sync" | "client" | "async"
/**
* This interface is a wrapper for a file object which takes a buffer
* with the mimeType and name of the file
*/
type ModfyFile = {
name: string
mimeType?: string
buffer: Buffer
}
type StoredFiles = File[] | ModfyFile[]
/**
* This type represents the accepted file inputs
*
* There are three accepted file input types
* 1. Array of Html File Object
* 2. Array of Strings, File Paths (Node only)
* 3. Array of {buffer, name, mimeType}
Here we are supporting buffers directly but require that you provide the name and mimeType
*/
type AcceptedFiles = StoredFiles | string[]

Caveats#

  • All files in the input array must be of same type
  • String paths are only supported in node