@twick/ffmpeg 0.15.2 → 0.15.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts DELETED
@@ -1,138 +0,0 @@
1
- import { RendererSettings, FfmpegExporterOptions, RendererResult, AssetInfo } from '@twick/core';
2
-
3
- interface FFmpegExporterSettings extends RendererSettings {
4
- fastStart: boolean;
5
- includeAudio: boolean;
6
- output: string;
7
- }
8
- declare const extensions: Record<FfmpegExporterOptions['format'], string>;
9
- /**
10
- * The server-side implementation of the FFmpeg video exporter.
11
- */
12
- declare class FFmpegExporterServer {
13
- private readonly stream;
14
- private readonly command;
15
- private readonly promise;
16
- private readonly settings;
17
- private readonly jobFolder;
18
- private readonly format;
19
- constructor(settings: FFmpegExporterSettings);
20
- start(): Promise<void>;
21
- handleFrame({ data }: {
22
- data: string;
23
- }): Promise<void>;
24
- end(result: RendererResult): Promise<void>;
25
- kill(): Promise<void>;
26
- }
27
-
28
- type AudioCodec = 'aac' | 'libopus';
29
- declare function resolvePath(output: string, assetPath: string): string;
30
- declare function makeSureFolderExists(folderPath: string): Promise<void>;
31
- declare function concatenateMedia(files: string[], outputFile: string): Promise<void>;
32
- declare function createSilentAudioFile(filePath: string, duration: number): Promise<unknown>;
33
- declare function getVideoDuration(filePath: string): Promise<number>;
34
- declare function getVideoDimensions(filePath: string): Promise<{
35
- width: number;
36
- height: number;
37
- }>;
38
- declare function doesFileExist(filePath: string): Promise<boolean>;
39
- declare function mergeAudioWithVideo(audioPath: string, videoPath: string, outputPath: string, audioCodec?: AudioCodec): Promise<void>;
40
- declare function checkForAudioStream(file: string): Promise<boolean>;
41
- declare function getSampleRate(filePath: string): Promise<number>;
42
- declare function getVideoCodec(filePath: string): Promise<string>;
43
- declare function getVideoMetadata(filePath: string): Promise<{
44
- codec: string;
45
- width: number;
46
- height: number;
47
- }>;
48
-
49
- declare const audioCodecs: Record<FfmpegExporterOptions['format'], AudioCodec>;
50
- declare function generateAudio({ outputDir, tempDir, assets, startFrame, endFrame, fps, }: {
51
- outputDir: string;
52
- tempDir: string;
53
- assets: AssetInfo[][];
54
- startFrame: number;
55
- endFrame: number;
56
- fps: number;
57
- }): Promise<string[]>;
58
- declare function mergeMedia(outputFilename: string, outputDir: string, tempDir: string, format: FfmpegExporterOptions['format']): Promise<void>;
59
-
60
- declare const ffmpegLogLevels: readonly ["quiet", "panic", "fatal", "error", "warning", "info", "verbose", "debug", "trace"];
61
- type LogLevel = (typeof ffmpegLogLevels)[number];
62
- type FfmpegSettings = {
63
- ffmpegPath?: string;
64
- ffprobePath?: string;
65
- ffmpegLogLevel?: LogLevel;
66
- };
67
- declare class FfmpegSettingState {
68
- private ffmpegPath;
69
- private ffprobePath;
70
- private logLevel;
71
- constructor();
72
- getFfmpegPath(): string;
73
- setFfmpegPath(ffmpegPath: string): void;
74
- getFfprobePath(): string;
75
- setFfprobePath(ffprobePath: string): void;
76
- getLogLevel(): "quiet" | "panic" | "fatal" | "error" | "warning" | "info" | "verbose" | "debug" | "trace";
77
- setLogLevel(logLevel: LogLevel): void;
78
- }
79
- declare const ffmpegSettings: FfmpegSettingState;
80
-
81
- type VideoFrameExtractorState = 'processing' | 'done' | 'error';
82
- /**
83
- * Walks through a video file and extracts frames.
84
- */
85
- declare class VideoFrameExtractor {
86
- private static readonly chunkLengthInSeconds;
87
- private readonly ffmpegPath;
88
- state: VideoFrameExtractorState;
89
- filePath: string;
90
- private downloadedFilePath;
91
- private buffer;
92
- private bufferOffset;
93
- private imageBuffers;
94
- private lastImage;
95
- private startTime;
96
- private startTimeOffset;
97
- private duration;
98
- private toTime;
99
- private fps;
100
- private framesProcessed;
101
- private width;
102
- private height;
103
- private frameSize;
104
- private codec;
105
- private process;
106
- private terminated;
107
- static downloadedVideoMap: Map<string, {
108
- localPath: string;
109
- startTimeOffset: number;
110
- }>;
111
- constructor(filePath: string, startTime: number, fps: number, duration: number);
112
- static downloadVideoChunk(url: string, startTime: number, endTime: number): Promise<unknown>;
113
- getTime(): number;
114
- getLastTime(): number;
115
- getLastFrame(): Buffer | null;
116
- getWidth(): number;
117
- getHeight(): number;
118
- private getEndTime;
119
- private getArgs;
120
- private createFfmpegProcess;
121
- /**
122
- * We call this in the case that the time requested is greater than the
123
- * duration of the video. In this case, we want to display the first frame
124
- * of the video.
125
- *
126
- * Note: This does NOT match the behavior of the old implementation
127
- * inside of 2d/src/lib/components/Video.ts. In the old implementation, the
128
- * last frame is shown instead of the first frame.
129
- */
130
- private createFfmpegProcessToExtractFirstFrame;
131
- private processData;
132
- popImage(): Promise<Buffer | null>;
133
- private handleClose;
134
- private handleError;
135
- destroy(): void;
136
- }
137
-
138
- export { type AudioCodec, FFmpegExporterServer, type FFmpegExporterSettings, type FfmpegSettings, type LogLevel, VideoFrameExtractor, audioCodecs, checkForAudioStream, concatenateMedia, createSilentAudioFile, doesFileExist, extensions, ffmpegSettings, generateAudio, getSampleRate, getVideoCodec, getVideoDimensions, getVideoDuration, getVideoMetadata, makeSureFolderExists, mergeAudioWithVideo, mergeMedia, resolvePath };
package/dist/index.d.ts DELETED
@@ -1,138 +0,0 @@
1
- import { RendererSettings, FfmpegExporterOptions, RendererResult, AssetInfo } from '@twick/core';
2
-
3
- interface FFmpegExporterSettings extends RendererSettings {
4
- fastStart: boolean;
5
- includeAudio: boolean;
6
- output: string;
7
- }
8
- declare const extensions: Record<FfmpegExporterOptions['format'], string>;
9
- /**
10
- * The server-side implementation of the FFmpeg video exporter.
11
- */
12
- declare class FFmpegExporterServer {
13
- private readonly stream;
14
- private readonly command;
15
- private readonly promise;
16
- private readonly settings;
17
- private readonly jobFolder;
18
- private readonly format;
19
- constructor(settings: FFmpegExporterSettings);
20
- start(): Promise<void>;
21
- handleFrame({ data }: {
22
- data: string;
23
- }): Promise<void>;
24
- end(result: RendererResult): Promise<void>;
25
- kill(): Promise<void>;
26
- }
27
-
28
- type AudioCodec = 'aac' | 'libopus';
29
- declare function resolvePath(output: string, assetPath: string): string;
30
- declare function makeSureFolderExists(folderPath: string): Promise<void>;
31
- declare function concatenateMedia(files: string[], outputFile: string): Promise<void>;
32
- declare function createSilentAudioFile(filePath: string, duration: number): Promise<unknown>;
33
- declare function getVideoDuration(filePath: string): Promise<number>;
34
- declare function getVideoDimensions(filePath: string): Promise<{
35
- width: number;
36
- height: number;
37
- }>;
38
- declare function doesFileExist(filePath: string): Promise<boolean>;
39
- declare function mergeAudioWithVideo(audioPath: string, videoPath: string, outputPath: string, audioCodec?: AudioCodec): Promise<void>;
40
- declare function checkForAudioStream(file: string): Promise<boolean>;
41
- declare function getSampleRate(filePath: string): Promise<number>;
42
- declare function getVideoCodec(filePath: string): Promise<string>;
43
- declare function getVideoMetadata(filePath: string): Promise<{
44
- codec: string;
45
- width: number;
46
- height: number;
47
- }>;
48
-
49
- declare const audioCodecs: Record<FfmpegExporterOptions['format'], AudioCodec>;
50
- declare function generateAudio({ outputDir, tempDir, assets, startFrame, endFrame, fps, }: {
51
- outputDir: string;
52
- tempDir: string;
53
- assets: AssetInfo[][];
54
- startFrame: number;
55
- endFrame: number;
56
- fps: number;
57
- }): Promise<string[]>;
58
- declare function mergeMedia(outputFilename: string, outputDir: string, tempDir: string, format: FfmpegExporterOptions['format']): Promise<void>;
59
-
60
- declare const ffmpegLogLevels: readonly ["quiet", "panic", "fatal", "error", "warning", "info", "verbose", "debug", "trace"];
61
- type LogLevel = (typeof ffmpegLogLevels)[number];
62
- type FfmpegSettings = {
63
- ffmpegPath?: string;
64
- ffprobePath?: string;
65
- ffmpegLogLevel?: LogLevel;
66
- };
67
- declare class FfmpegSettingState {
68
- private ffmpegPath;
69
- private ffprobePath;
70
- private logLevel;
71
- constructor();
72
- getFfmpegPath(): string;
73
- setFfmpegPath(ffmpegPath: string): void;
74
- getFfprobePath(): string;
75
- setFfprobePath(ffprobePath: string): void;
76
- getLogLevel(): "quiet" | "panic" | "fatal" | "error" | "warning" | "info" | "verbose" | "debug" | "trace";
77
- setLogLevel(logLevel: LogLevel): void;
78
- }
79
- declare const ffmpegSettings: FfmpegSettingState;
80
-
81
- type VideoFrameExtractorState = 'processing' | 'done' | 'error';
82
- /**
83
- * Walks through a video file and extracts frames.
84
- */
85
- declare class VideoFrameExtractor {
86
- private static readonly chunkLengthInSeconds;
87
- private readonly ffmpegPath;
88
- state: VideoFrameExtractorState;
89
- filePath: string;
90
- private downloadedFilePath;
91
- private buffer;
92
- private bufferOffset;
93
- private imageBuffers;
94
- private lastImage;
95
- private startTime;
96
- private startTimeOffset;
97
- private duration;
98
- private toTime;
99
- private fps;
100
- private framesProcessed;
101
- private width;
102
- private height;
103
- private frameSize;
104
- private codec;
105
- private process;
106
- private terminated;
107
- static downloadedVideoMap: Map<string, {
108
- localPath: string;
109
- startTimeOffset: number;
110
- }>;
111
- constructor(filePath: string, startTime: number, fps: number, duration: number);
112
- static downloadVideoChunk(url: string, startTime: number, endTime: number): Promise<unknown>;
113
- getTime(): number;
114
- getLastTime(): number;
115
- getLastFrame(): Buffer | null;
116
- getWidth(): number;
117
- getHeight(): number;
118
- private getEndTime;
119
- private getArgs;
120
- private createFfmpegProcess;
121
- /**
122
- * We call this in the case that the time requested is greater than the
123
- * duration of the video. In this case, we want to display the first frame
124
- * of the video.
125
- *
126
- * Note: This does NOT match the behavior of the old implementation
127
- * inside of 2d/src/lib/components/Video.ts. In the old implementation, the
128
- * last frame is shown instead of the first frame.
129
- */
130
- private createFfmpegProcessToExtractFirstFrame;
131
- private processData;
132
- popImage(): Promise<Buffer | null>;
133
- private handleClose;
134
- private handleError;
135
- destroy(): void;
136
- }
137
-
138
- export { type AudioCodec, FFmpegExporterServer, type FFmpegExporterSettings, type FfmpegSettings, type LogLevel, VideoFrameExtractor, audioCodecs, checkForAudioStream, concatenateMedia, createSilentAudioFile, doesFileExist, extensions, ffmpegSettings, generateAudio, getSampleRate, getVideoCodec, getVideoDimensions, getVideoDuration, getVideoMetadata, makeSureFolderExists, mergeAudioWithVideo, mergeMedia, resolvePath };