import { MP4Sample } from 'wrapbox'; import { file } from 'opfs-tools'; import { BaseClip } from './base-clip'; import { IClip, IPlaybackCapable } from './iclip'; import { VideoJSON } from '../json-serialization'; type OPFSToolFile = ReturnType; type MPClipCloneArgs = Awaited> & { localFile: OPFSToolFile; }; interface MP4DecoderConf { video: VideoDecoderConfig | null; audio: AudioDecoderConfig | null; } export interface IMP4ClipOpts { audio?: boolean | { volume: number; }; /** * Unsafe, may be deprecated at any time */ __unsafe_hardwareAcceleration__?: HardwarePreference; } type ExtMP4Sample = Omit & { is_idr: boolean; deleted?: boolean; data: null | Uint8Array; }; type ThumbnailOpts = { start: number; end: number; step: number; }; /** * Video clip, parses MP4 files, uses {@link Video.tick} to decode image frames at specified time on demand * * Can be used to implement video frame extraction, thumbnail generation, video editing and other functions * * @example * // Load video clip asynchronously * const videoClip = await Video.fromUrl('clip.mp4', { * x: 0, * y: 0, * width: 1920, * height: 1080, * }); * * // Set timeline position * videoClip.set({ * display: { * from: 150, // frames * to: 450, // frames (10 seconds at 30fps) * }, * }); * */ export declare class Video extends BaseClip implements IPlaybackCapable { readonly type = "Video"; private insId; private logger; ready: IClip['ready']; private _meta; get meta(): { duration: number; width: number; height: number; audioSampleRate: number; audioChanCount: number; }; private localFile; /** Store binary data of video header (box: ftyp, moov) */ private headerBoxPos; /** * Provide binary data of video header (box: ftyp, moov) * Use any mp4 demuxer to parse and get detailed video information * Unit tests include sample code using mp4box.js */ getFileHeaderBinData(): Promise; /** Store video transform and rotation info, currently only restores rotation */ private parsedMatrix; private vfRotater; private videoSamples; private audioSamples; private videoFrameFinder; private audioFrameFinder; private decoderConf; private opts; /** * Whether to include audio track (hybrid JSON structure) */ audio: boolean; /** * Unique identifier for this clip instance */ id: string; /** * Array of effects to be applied to this clip * Each effect specifies key, startTime, duration, and optional targets */ effects: Array<{ id: string; key: string; startTime: number; duration: number; }>; /** * Load a video clip from a URL * @param url Video URL * @param opts Position and size options * @returns Promise that resolves to a video clip * * @example * const videoClip = await Video.fromUrl('clip.mp4', { * x: 0, * y: 0, * width: 1920, * height: 1080, * }); */ static fromUrl(url: string, opts?: { x?: number; y?: number; width?: number; height?: number; }): Promise