Skip to content

Commit f138282

Browse files
committed
Docs and example apps for the single multi-threaded core
Removes @ffmpeg/core-mt from the examples, the playground's core switcher, and documents FFmpeg 9 in the migration guide and FAQ.
1 parent 3658d6b commit f138282

17 files changed

Lines changed: 68 additions & 205 deletions

File tree

‎apps/angular-app/src/app/app.component.ts‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { RouterOutlet } from '@angular/router';
44
import { FFmpeg } from '@ffmpeg/ffmpeg';
55
import { fetchFile, toBlobURL } from '@ffmpeg/util';
66

7-
const baseURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core-mt@0.12.10/dist/esm';
7+
const baseURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.13.0/dist/esm';
88

99
@Component({
1010
selector: 'app-root',
@@ -28,10 +28,6 @@ export class AppComponent {
2828
`${baseURL}/ffmpeg-core.wasm`,
2929
'application/wasm',
3030
),
31-
workerURL: await toBlobURL(
32-
`${baseURL}/ffmpeg-core.worker.js`,
33-
'text/javascript',
34-
),
3531
});
3632
this.loaded = true;
3733
}

‎apps/nextjs-app/app/Home.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default function Home() {
1313

1414
const load = async () => {
1515
setIsLoading(true);
16-
const baseURL = "https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.12.10/dist/umd";
16+
const baseURL = "https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.13.0/dist/umd";
1717
const ffmpeg = ffmpegRef.current;
1818
ffmpeg.on("log", ({ message }) => {
1919
if (messageRef.current) messageRef.current.innerHTML = message;

‎apps/react-vite-app/src/App.tsx‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function App() {
99
const messageRef = useRef<HTMLParagraphElement | null>(null);
1010

1111
const load = async () => {
12-
const baseURL = "https://cdn.jsdelivr.net/npm/@ffmpeg/core-mt@0.12.10/dist/esm";
12+
const baseURL = "https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.13.0/dist/esm";
1313
const ffmpeg = ffmpegRef.current;
1414
ffmpeg.on("log", ({ message }) => {
1515
if (messageRef.current) messageRef.current.innerHTML = message;
@@ -22,10 +22,6 @@ function App() {
2222
`${baseURL}/ffmpeg-core.wasm`,
2323
"application/wasm"
2424
),
25-
workerURL: await toBlobURL(
26-
`${baseURL}/ffmpeg-core.worker.js`,
27-
"text/javascript"
28-
),
2925
});
3026
setLoaded(true);
3127
};

‎apps/solidstart-app/src/routes/index.tsx‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { FFmpeg } from '@ffmpeg/ffmpeg';
22
import { fetchFile, toBlobURL } from '@ffmpeg/util';
33
import { createSignal, Show } from 'solid-js';
44

5-
const baseURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core-mt@0.12.10/dist/esm';
5+
const baseURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.13.0/dist/esm';
66
const videoURL =
77
'https://raw.githubusercontent.com/ffmpegwasm/testdata/master/video-15s.avi';
88

@@ -28,10 +28,6 @@ export default function Home() {
2828
`${baseURL}/ffmpeg-core.wasm`,
2929
'application/wasm'
3030
),
31-
workerURL: await toBlobURL(
32-
`${baseURL}/ffmpeg-core.worker.js`,
33-
'text/javascript'
34-
),
3531
});
3632
setLoaded(true);
3733
setIsLoading(false);

‎apps/sveltekit-app/src/lib/FFmpegDemo.svelte‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
let videoEl: HTMLVideoElement;
88
9-
const baseURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core-mt@0.12.10/dist/esm';
9+
const baseURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.13.0/dist/esm';
1010
const videoURL = 'https://raw.githubusercontent.com/ffmpegwasm/testdata/master/video-15s.avi';
1111
1212
let message = 'Click Start to Transcode';
@@ -21,7 +21,6 @@
2121
await ffmpeg.load({
2222
coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`, 'text/javascript'),
2323
wasmURL: await toBlobURL(`${baseURL}/ffmpeg-core.wasm`, 'application/wasm'),
24-
workerURL: await toBlobURL(`${baseURL}/ffmpeg-core.worker.js`, 'text/javascript')
2524
});
2625
message = 'Start transcoding';
2726
await ffmpeg.writeFile('test.avi', await fetchFile(videoURL));

‎apps/vanilla-app/public/transcode-mt.esm.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ <h3>Upload a video to transcode to mp4 (x264) and play!</h3>
2323
message.innerHTML = `${progress * 100} %`;
2424
});
2525
await ffmpeg.load({
26-
coreURL: "/assets/core-mt/package/dist/esm/ffmpeg-core.js",
26+
coreURL: "/assets/core/package/dist/esm/ffmpeg-core.js",
2727
});
2828
}
2929
const { name } = files[0];

‎apps/vanilla-app/public/transcode-mt.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ <h3>Upload a video to transcode to mp4 (x264) and play!</h3>
2525
message.innerHTML = `${progress * 100} %, time: ${time / 1000000} s`;
2626
});
2727
await ffmpeg.load({
28-
coreURL: "/assets/core-mt/package/dist/umd/ffmpeg-core.js",
28+
coreURL: "/assets/core/package/dist/umd/ffmpeg-core.js",
2929
});
3030
}
3131
const { name } = files[0];

‎apps/vue-vite-app/src/components/FFmpegDemo.vue‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import type { LogEvent } from '@ffmpeg/ffmpeg/dist/esm/types'
1111
import { fetchFile, toBlobURL } from '@ffmpeg/util'
1212
import { defineComponent, ref } from 'vue'
1313
14-
const baseURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core-mt@0.12.10/dist/esm'
14+
const baseURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.13.0/dist/esm'
1515
const videoURL = 'https://raw.githubusercontent.com/ffmpegwasm/testdata/master/video-15s.avi'
1616
1717
export default defineComponent({
@@ -29,7 +29,6 @@ export default defineComponent({
2929
await ffmpeg.load({
3030
coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`, 'text/javascript'),
3131
wasmURL: await toBlobURL(`${baseURL}/ffmpeg-core.wasm`, 'application/wasm'),
32-
workerURL: await toBlobURL(`${baseURL}/ffmpeg-core.worker.js`, 'text/javascript')
3332
})
3433
message.value = 'Start transcoding'
3534
await ffmpeg.writeFile('test.avi', await fetchFile(videoURL))

‎apps/website/docs/contribution/core.md‎

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,31 @@ You will need to install `make` to run build scripts.
66

77
## Build
88

9-
One command starts Docker Desktop if it isn't running, builds both cores and
9+
One command starts Docker Desktop if it isn't running, builds the core and
1010
then the JS packages:
1111

1212
```bash
13-
$ pnpm build:wasm # production builds, like CI
14-
$ pnpm build:wasm dev # dev builds (--profiling)
13+
$ pnpm build:wasm # production build, like CI
14+
$ pnpm build:wasm dev # dev build (--profiling)
1515
```
1616

1717
The emsdk image is multi-arch, so this runs natively on Apple Silicon too. The
1818
`make` targets below are what it runs.
1919

20-
Dev Build (single thread):
20+
Dev Build:
2121
```bash
2222
$ make dev
2323
```
2424

25-
Dev Build (multithread):
26-
```bash
27-
$ make dev-mt
28-
```
29-
30-
Prodution Build (single thread):
25+
Production Build:
3126
```bash
3227
$ make prd
3328
```
3429

35-
Prodution Build (multithread):
36-
```bash
37-
$ make prd-mt
38-
```
39-
40-
> Each build might take around 1 hour depends on the spec of your machine,
30+
> A cold build takes a few minutes on a recent machine,
4131
> subsequent builds are faster as most layers are cached.
4232
43-
The output file locates at **/packages/core** or **/packages/core-mt**.
33+
The output file locates at **/packages/core**.
4434

4535
## Custom Build / Reduce Build Size
4636

@@ -130,4 +120,4 @@ This approach gives you control over the build content and its final size.
130120
We would like to thank @Kaizodo, @harkdawg and other community members for sharing their knowledge!
131121
## Publish
132122

133-
Simply run `npm publish` under **packages/core** or **/packages/core-mt**.
123+
Simply run `npm publish` under **packages/core**.

‎apps/website/docs/faq.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ As of now, WebAssembly is still a lot slower than native, it is possible to furt
1717
WebAssembly intrinsic, which is basically writing assembly code. It is something we are investigating
1818
and hope to introduce in the future.
1919

20-
If you are OK with more unstable version of ffmpeg.wasm, using ffmpeg.wasm multithread (mt) version
21-
can have around 2x speed comparing to single thread (but consume a lot more memory and cpu)
20+
Since 0.13, @ffmpeg/core runs FFmpeg's multi-threaded pipeline, which is
21+
faster than the single-thread core of 0.12.
2222

2323
### Is RTSP supported by ffmpeg.wasm?
2424

0 commit comments

Comments
 (0)