UNPKG

use-ffmpeg

Version:

A React hook for browser-based media processing using FFmpeg WASM - handles video and other file formats conversion with ease

23 lines 1.42 kB
import { FFmpeg } from "@ffmpeg/ffmpeg"; /** * Loads the FFmpeg library with optional multi-threading support. * * This function initializes a new instance of FFmpeg, sets up event listeners for logging, * and loads the necessary core and WASM files from a given URL. If multi-threading is enabled, * it will load an additional worker script. If multi-threading (`mt`) is set to true, a base URL must * be provided for the FFmpeg core and worker scripts. * * @param {string} [baseUrl="https://unpkg.com/@ffmpeg/core@0.12.10/dist/esm"] - The base URL to load the FFmpeg core and WASM files from. * @param {boolean} [mt=false] - A flag to indicate if multi-threading should be enabled. If true, a worker script will be loaded. If multi-threading is enabled, `baseUrl` must be provided. * * @returns {Promise<FFmpeg>} - A Promise that resolves to the initialized FFmpeg instance. * * @throws {Error} - Throws an error if the FFmpeg core or WASM files fail to load or if an error occurs during FFmpeg operations. * * @example * const ffmpeg = await load() * // By default, the base URL is provided for single-threaded transcoding. To use multi-threading, a base URL MUST be provided and `mt` should be set to true. * // You can now use the `ffmpeg` instance for transcoding tasks. */ export declare const load: (baseUrl?: string, mt?: boolean) => Promise<FFmpeg>; //# sourceMappingURL=ffmpegSetup.d.ts.map