Update README.md
This commit is contained in:
parent
c46876c95d
commit
89be7a8b64
44
README.md
44
README.md
@ -47,25 +47,6 @@ ffmpeg.wasm is a pure Webassembly / Javascript port of FFmpeg. It enables video
|
|||||||
|
|
||||||
Check [HERE](https://github.com/ffmpegwasm/ffmpeg.wasm-core#configuration)
|
Check [HERE](https://github.com/ffmpegwasm/ffmpeg.wasm-core#configuration)
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
ffmpeg.wasm provides simple to use APIs, to transcode a video you only need few lines of code:
|
|
||||||
|
|
||||||
```javascript
|
|
||||||
const fs = require('fs');
|
|
||||||
const { createFFmpeg, fetchFile } = require('@ffmpeg/ffmpeg');
|
|
||||||
|
|
||||||
const ffmpeg = createFFmpeg({ log: true });
|
|
||||||
|
|
||||||
(async () => {
|
|
||||||
await ffmpeg.load();
|
|
||||||
ffmpeg.FS('writeFile', 'test.avi', await fetchFile('./test.avi'));
|
|
||||||
await ffmpeg.transcode('test.avi', 'test.mp4');
|
|
||||||
fs.writeFileSync('./test.mp4', ffmpeg.FS('readFile', 'test.mp4'));
|
|
||||||
process.exit(0);
|
|
||||||
})();
|
|
||||||
```
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -81,13 +62,32 @@ $ node --experimental-wasm-threads --experimental-wasm-bulk-memory transcode.js
|
|||||||
Or, using a script tag in the browser (only works in Chrome):
|
Or, using a script tag in the browser (only works in Chrome):
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<script src="https://unpkg.com/@ffmpeg/ffmpeg@0.8.3/dist/ffmpeg.min.js"></script>
|
<script src="https://unpkg.com/@ffmpeg/ffmpeg@0.9.0/dist/ffmpeg.min.js"></script>
|
||||||
<script>
|
<script>
|
||||||
const { createFFmpeg } = FFmpeg;
|
const { createFFmpeg } = FFmpeg;
|
||||||
...
|
...
|
||||||
</script>
|
</script>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
ffmpeg.wasm provides simple to use APIs, to transcode a video you only need few lines of code:
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
const fs = require('fs');
|
||||||
|
const { createFFmpeg, fetchFile } = require('@ffmpeg/ffmpeg');
|
||||||
|
|
||||||
|
const ffmpeg = createFFmpeg({ log: true });
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
await ffmpeg.load();
|
||||||
|
ffmpeg.FS('writeFile', 'test.avi', await fetchFile('./test.avi'));
|
||||||
|
await ffmpeg.run('-i', 'test.avi', 'test.mp4');
|
||||||
|
fs.writeFileSync('./test.mp4', ffmpeg.FS('readFile', 'test.mp4'));
|
||||||
|
process.exit(0);
|
||||||
|
})();
|
||||||
|
```
|
||||||
|
|
||||||
## Multi-threading
|
## Multi-threading
|
||||||
|
|
||||||
Multi-threading need to be configured per external libraries, only following libraries supports it now:
|
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.
|
|||||||
|
|
||||||
Need to pass `-row-mt 1`, but can only use one thread to help, can speed up around 30%
|
Need to pass `-row-mt 1`, but can only use one thread to help, can speed up around 30%
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
- With React: https://github.com/ffmpegwasm/react-app
|
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
- [API](https://github.com/ffmpegwasm/ffmpeg.wasm/blob/master/docs/api.md)
|
- [API](https://github.com/ffmpegwasm/ffmpeg.wasm/blob/master/docs/api.md)
|
||||||
|
Loading…
Reference in New Issue
Block a user