Repacker
Video repacker
Repacker remuxes input video files to improve compatibility with various video players and media sharing apps. Additionally, it fixes common issues and artifacts of MediaRecorder outputs. The most common trait of video containers recorded in a browser is a file fragmentation. Browser records a video in chunks and flushes them periodically, so for example we get fragmented mp4 file that may be not supported by some apps for sharing, or they will truncate the video to the first chunk/fragment of mp4 file. Repacker remuxes a file to obtain a whole monolithic container. Being compiled into wasm it’s blazingly fast and memory efficient. Utilizing efficient memory map and zero-copy strategies it remuxes buffers in place avoiding redundant deep copies and conversions. Repacker supports mp4 container and h264/avc1 video codec. The set of supported formats is limited to make size of the wasm binary as small as possible (mp4+h264 combination is the most widely used). Support for more containers and codecs may be added in the future.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new Repacker():
Repacker
Returns
Section titled “Returns”Repacker
Methods
Section titled “Methods”init()
Section titled “init()”init():
Promise<void>
Initialize repacker
Downloads and initializes web assembly binary module, allocates memory and contexts required for remuxing. Initialization must be finished before using repacker.
Returns
Section titled “Returns”Promise<void>
remux()
Section titled “remux()”remux(
buf):undefined|Uint8Array<ArrayBuffer>
Remux a video file
Parameters
Section titled “Parameters”Uint8Array
Buffer containing a video file
Returns
Section titled “Returns”undefined | Uint8Array<ArrayBuffer>
Remuxed video file
remuxBlob()
Section titled “remuxBlob()”remuxBlob(
blob,type):Promise<undefined|Blob>
Remux a video file
Parameters
Section titled “Parameters”Blob
Bloc containing a video file
string = "video/mp4"
Mime type of output blob
Returns
Section titled “Returns”Promise<undefined | Blob>
Remuxed video file