@@ -47,25 +47,6 @@ ffmpeg.wasm is a pure Webassembly / Javascript port of FFmpeg. It enables video
47
47
48
48
Check [ HERE] ( https://github.com/ffmpegwasm/ffmpeg.wasm-core#configuration )
49
49
50
- ---
51
-
52
- ffmpeg.wasm provides simple to use APIs, to transcode a video you only need few lines of code:
53
-
54
- ``` javascript
55
- const fs = require (' fs' );
56
- const { createFFmpeg , fetchFile } = require (' @ffmpeg/ffmpeg' );
57
-
58
- const ffmpeg = createFFmpeg ({ log: true });
59
-
60
- (async () => {
61
- await ffmpeg .load ();
62
- ffmpeg .FS (' writeFile' , ' test.avi' , await fetchFile (' ./test.avi' ));
63
- await ffmpeg .transcode (' test.avi' , ' test.mp4' );
64
- fs .writeFileSync (' ./test.mp4' , ffmpeg .FS (' readFile' , ' test.mp4' ));
65
- process .exit (0 );
66
- })();
67
- ```
68
-
69
50
## Installation
70
51
71
52
```
@@ -81,13 +62,32 @@ $ node --experimental-wasm-threads --experimental-wasm-bulk-memory transcode.js
81
62
Or, using a script tag in the browser (only works in Chrome):
82
63
83
64
``` html
84
- <script src =" https://unpkg.com/@ffmpeg/ffmpeg@0.8.3 /dist/ffmpeg.min.js" ></script >
65
+ <script src =" https://unpkg.com/@ffmpeg/ffmpeg@0.9.0 /dist/ffmpeg.min.js" ></script >
85
66
<script >
86
67
const { createFFmpeg } = FFmpeg;
87
68
...
88
69
</script >
89
70
```
90
71
72
+ ## Usage
73
+
74
+ ffmpeg.wasm provides simple to use APIs, to transcode a video you only need few lines of code:
75
+
76
+ ``` javascript
77
+ const fs = require (' fs' );
78
+ const { createFFmpeg , fetchFile } = require (' @ffmpeg/ffmpeg' );
79
+
80
+ const ffmpeg = createFFmpeg ({ log: true });
81
+
82
+ (async () => {
83
+ await ffmpeg .load ();
84
+ ffmpeg .FS (' writeFile' , ' test.avi' , await fetchFile (' ./test.avi' ));
85
+ await ffmpeg .run (' -i' , ' test.avi' , ' test.mp4' );
86
+ fs .writeFileSync (' ./test.mp4' , ffmpeg .FS (' readFile' , ' test.mp4' ));
87
+ process .exit (0 );
88
+ })();
89
+ ```
90
+
91
91
## Multi-threading
92
92
93
93
Multi-threading need to be configured per external libraries, only following libraries supports it now:
@@ -100,10 +100,6 @@ Run it multi-threading mode by default, no need to pass any arguments.
100
100
101
101
Need to pass ` -row-mt 1 ` , but can only use one thread to help, can speed up around 30%
102
102
103
- ## Examples
104
-
105
- - With React: https://github.com/ffmpegwasm/react-app
106
-
107
103
## Documentation
108
104
109
105
- [ API] ( https://github.com/ffmpegwasm/ffmpeg.wasm/blob/master/docs/api.md )
0 commit comments