Skip to content

Commit 930f49b

Browse files
committed
Docs and example apps for 0.13
The example apps load @ffmpeg/core 0.13 (single-threaded, no cross-origin isolation needed); none of them passes workerURL any more, as neither core has ffmpeg-core.worker.js. The migration guide covers 0.13, and the core contribution guide the FFmpeg patches and the single-threaded core's green threads. Update: this now sits at the end of the stack, with every package's version bumped to 0.13.0 together, so nothing earlier points at an unreleased version.
1 parent 2d82cc5 commit 930f49b

16 files changed

Lines changed: 51 additions & 22 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
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@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',

‎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 & 1 deletion
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@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;

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

Lines changed: 1 addition & 1 deletion
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@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

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

Lines changed: 1 addition & 1 deletion
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@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';

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

Lines changed: 1 addition & 1 deletion
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@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({

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,22 @@ $ make prd-mt
4242
4343
The output file locates at **/packages/core** or **/packages/core-mt**.
4444

45+
## Changes to FFmpeg
46+
47+
ffmpeg.wasm builds FFmpeg at the tag in `FFMPEG_VERSION` (Dockerfile) with the
48+
patches in `patches/ffmpeg`, one per change. To change one, or add one:
49+
50+
```bash
51+
$ git clone --branch n9.0.2 https://github.com/FFmpeg/FFmpeg && cd FFmpeg
52+
$ git am ../ffmpeg.wasm/patches/ffmpeg/*.patch
53+
# edit, commit
54+
$ git format-patch --zero-commit --no-signature -o ../ffmpeg.wasm/patches/ffmpeg n9.0.2
55+
```
56+
57+
FFmpeg's command line tools need threads. `@ffmpeg/core-mt` uses real
58+
threads (Web Workers and SharedArrayBuffer); `@ffmpeg/core` runs them one at a
59+
time on a single thread with the cooperative pthreads in `src/green`.
60+
4561
## Custom Build / Reduce Build Size
4662

4763
You can customize your build to include only the libraries you need, which can significantly reduce the final build size. This is done by modifying the `Dockerfile`.

‎apps/website/docs/getting-started/usage.md‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ It is recommended to read [Overview](/docs/overview) first.
1111
:::caution
1212
If you are a [vite](https://vitejs.dev/) user, use `esm` in **baseURL** instead of `umd`:
1313

14-
~~https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.12.10/dist/umd~~ => https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.12.10/dist/esm
14+
~~https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.13.0/dist/umd~~ => https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.13.0/dist/esm
1515
:::
1616

1717
```jsx live
@@ -24,7 +24,7 @@ function() {
2424
const messageRef = useRef(null);
2525

2626
const load = async () => {
27-
const baseURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.12.10/dist/umd'
27+
const baseURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.13.0/dist/umd'
2828
const ffmpeg = ffmpegRef.current;
2929
ffmpeg.on('log', ({ message }) => {
3030
messageRef.current.innerHTML = message;
@@ -81,7 +81,7 @@ function() {
8181
const messageRef = useRef(null);
8282

8383
const load = async () => {
84-
const baseURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core-mt@0.12.10/dist/umd'
84+
const baseURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core-mt@0.13.0/dist/umd'
8585
const ffmpeg = ffmpegRef.current;
8686
ffmpeg.on('log', ({ message }) => {
8787
messageRef.current.innerHTML = message;
@@ -133,7 +133,7 @@ function() {
133133
const messageRef = useRef(null);
134134

135135
const load = async () => {
136-
const baseURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.12.10/dist/umd'
136+
const baseURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.13.0/dist/umd'
137137
const ffmpeg = ffmpegRef.current;
138138
ffmpeg.on('log', ({ message }) => {
139139
messageRef.current.innerHTML = message;
@@ -191,7 +191,7 @@ function() {
191191
const messageRef = useRef(null);
192192

193193
const load = async () => {
194-
const baseURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.12.10/dist/umd'
194+
const baseURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.13.0/dist/umd'
195195
const ffmpeg = ffmpegRef.current;
196196
// Listen to progress event instead of log.
197197
ffmpeg.on('progress', ({ progress, time }) => {
@@ -242,7 +242,7 @@ function() {
242242
const messageRef = useRef(null);
243243

244244
const load = async () => {
245-
const baseURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.12.10/dist/umd'
245+
const baseURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.13.0/dist/umd'
246246
const ffmpeg = ffmpegRef.current;
247247
ffmpeg.on('log', ({ message }) => {
248248
messageRef.current.innerHTML = message;
@@ -312,7 +312,7 @@ function() {
312312
const messageRef = useRef(null);
313313

314314
const load = async () => {
315-
const baseURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.12.10/dist/umd'
315+
const baseURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.13.0/dist/umd'
316316
const ffmpeg = ffmpegRef.current;
317317
ffmpeg.on('log', ({ message }) => {
318318
messageRef.current.innerHTML = message;
@@ -371,7 +371,7 @@ function() {
371371
const messageRef = useRef(null);
372372

373373
const load = async () => {
374-
const baseURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.12.10/dist/umd'
374+
const baseURL = 'https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.13.0/dist/umd'
375375
const ffmpeg = ffmpegRef.current;
376376
ffmpeg.on('log', ({ message }) => {
377377
messageRef.current.innerHTML = message;

‎apps/website/docs/migration.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ import TableHead from '@mui/material/TableHead';
77
import TableRow from '@mui/material/TableRow';
88
import Paper from '@mui/material/Paper';
99

10+
# Migrating from 0.12.x to 0.13
11+
12+
- Both cores are FFmpeg 9 (0.12 was FFmpeg 5.1).
13+
- `@ffmpeg/core` is single-threaded and needs no special headers.
14+
`@ffmpeg/core-mt` is faster, but needs a cross-origin isolated page
15+
(`Cross-Origin-Opener-Policy: same-origin` and
16+
`Cross-Origin-Embedder-Policy: require-corp` or `credentialless`); without
17+
it `ffmpeg.load()` rejects with an explanation.
18+
- There is no `ffmpeg-core.worker.js` any more, and the `workerURL` option of
19+
`load()` is ignored.
20+
- `exec()` and `ffprobe()` return FFmpeg's exit code: `0` on success, `1` on
21+
timeout, and otherwise a non-zero value (often a negative error code) instead
22+
of always `1`. A command that crashes now rejects instead of resolving.
23+
1024
# Migrating from 0.11.x to 0.12+
1125

1226
As 0.12+ is not backward compatible with 0.11.x, below is a quick mapping

‎apps/website/src/components/Playground/const.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const CORE_VERSION = "0.12.10";
1+
export const CORE_VERSION = "0.13.0";
22

33
export const CORE_URL = `https://cdn.jsdelivr.net/npm/@ffmpeg/core@${CORE_VERSION}/dist/umd/ffmpeg-core.js`;
44
export const CORE_MT_URL = `https://cdn.jsdelivr.net/npm/@ffmpeg/core-mt@${CORE_VERSION}/dist/umd/ffmpeg-core.js`;
@@ -8,7 +8,6 @@ export const CORE_SIZE = {
88
[`https://cdn.jsdelivr.net/npm/@ffmpeg/core@${CORE_VERSION}/dist/umd/ffmpeg-core.wasm`]: 32129114,
99
[`https://cdn.jsdelivr.net/npm/@ffmpeg/core-mt@${CORE_VERSION}/dist/umd/ffmpeg-core.js`]: 132680,
1010
[`https://cdn.jsdelivr.net/npm/@ffmpeg/core-mt@${CORE_VERSION}/dist/umd/ffmpeg-core.wasm`]: 32609891,
11-
[`https://cdn.jsdelivr.net/npm/@ffmpeg/core-mt@${CORE_VERSION}/dist/umd/ffmpeg-core.worker.js`]: 2915,
1211
};
1312

1413
export const SAMPLE_FILES = {

0 commit comments

Comments
 (0)