You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ffmpeg.load() loads ffmpeg-core.js script (download from remote if not presented), it makes WebAssembly code ready to use.
38
+
Load ffmpeg.wasm-core script.
46
39
47
-
**Examples:**
48
-
49
-
```javascript
50
-
(async () => {
51
-
awaitffmpeg.load();
52
-
})();
53
-
```
54
-
55
-
<aname="ffmpeg-write"></a>
56
-
57
-
### ffmpeg.write(path, data): Promise
58
-
59
-
ffmpeg.write() writes data to specific path in Emscripten file system, it is an essential step before doing any other tasks.
60
-
61
-
> Currently we found an issue that you should not have parallel Worker.write() as it may cause unexpected behavior, please do it in sequential for-loop like [HERE](https://github.com/ffmpegjs/ffmpeg.js/blob/master/examples/browser/image2video.html#L36)
62
-
63
-
**Arguments:**
64
-
65
-
-`path` path to write data to file system
66
-
-`data` data to write, can be Uint8Array, URL, File, Blob or base64 format
67
-
68
-
**Examples:**
69
-
70
-
```javascript
71
-
(async () => {
72
-
awaitffmpeg.write(
73
-
"flame.avi",
74
-
"http://localhost:3000/tests/assets/flame.avi"
75
-
);
76
-
})();
77
-
```
78
-
79
-
<aname="ffmpeg-writeText"></a>
80
-
81
-
### ffmpeg.writeText(path, text): undefined
82
-
83
-
ffmpeg.write() writes text data to specific path in Emscripten file system.
84
-
85
-
**Arguments:**
86
-
87
-
-`path` path to write data to file system
88
-
-`text` string to write to file
89
-
90
-
**Examples:**
91
-
92
-
```javascript
93
-
(async () => {
94
-
ffmpeg.writeText("sub.srt", "...");
95
-
})();
96
-
```
97
-
98
-
<aname="ffmpeg-read"></a>
99
-
100
-
### ffmpeg.read(path): Uint8Array
101
-
102
-
ffmpeg.read() reads data from file system, often used to get output data after specific task.
103
-
104
-
**Arguments:**
105
-
106
-
-`path` path to read data from file system
107
-
108
-
**Examples:**
109
-
110
-
```javascript
111
-
(async () => {
112
-
constdata=ffmpeg.read("output.mp4");
113
-
})();
114
-
```
115
-
116
-
<aname="ffmpeg-remove"></a>
117
-
118
-
### ffmpeg.remove(path): Promise
119
-
120
-
ffmpeg.remove() removes files in file system, it will be better to delete unused files if you need to run ffmpeg.js multiple times.
40
+
In browser environment, the ffmpeg.wasm-core script is fetch from CDN and can be assign to a local path by assigning `corePath`. In node environment, we use dynamic require and the default `corePath` is `$ffmpeg/core`.
ffmpeg.concatDemuxer() concatenates multiple videos using concatDemuxer. This method won't encode the videos again. But it has its limitations. See [Concat demuxer Wiki](https://trac.ffmpeg.org/wiki/Concatenate)
56
+
This is the major function in ffmpeg.wasm, you can just imagine it as ffmpeg native cli and what you need to pass is the same.
199
57
200
58
**Arguments:**
201
59
202
-
-`input` input file paths as an Array, the input files should be written through ffmpeg.write()
203
-
-`output` output file path, can be read with ffmpeg.read() later
204
-
-`options` a string to add extra arguments to ffmpeg
For input/output file of ffmpeg.wasm, it is required to save them to MEMFS first so that ffmpeg.wasm is able to consume them. Here we rely on the FS methods provided by Emscripten.
225
78
226
-
ffmpeg.run() is similar to FFmpeg cli tool, aims to provide maximum flexiblity for users.
79
+
For more info, check https://emscripten.org/docs/api_reference/Filesystem-API.html
0 commit comments