Merge branch 'main' into main
This commit is contained in:
commit
3aa304295f
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@ -1,6 +1,6 @@
|
|||||||
# These are supported funding model platforms
|
# These are supported funding model platforms
|
||||||
|
|
||||||
github: [jeromewu]# Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||||
patreon: # Replace with a single Patreon username
|
patreon: # Replace with a single Patreon username
|
||||||
open_collective: ffmpegwasm
|
open_collective: ffmpegwasm
|
||||||
ko_fi: # Replace with a single Ko-fi username
|
ko_fi: # Replace with a single Ko-fi username
|
||||||
|
240
.github/workflows/CI.yml
vendored
240
.github/workflows/CI.yml
vendored
@ -3,91 +3,185 @@ name: CI
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-core:
|
build-core:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Source Code
|
- name: Checkout Source Code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Update pkg-config database
|
- name: Update pkg-config database
|
||||||
run: sudo ldconfig
|
run: sudo ldconfig
|
||||||
- name: Setup Docker Buildx
|
- name: Setup Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
- name: Cache build
|
- name: Cache build
|
||||||
id: cache-build
|
id: cache-build
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: build-cache-st
|
path: build-cache-st
|
||||||
key: build-cache-st-v1-${{ hashFiles('Dockerfile', 'Makefile', 'build/*') }}
|
key: build-cache-st-v1-${{ hashFiles('Dockerfile', 'Makefile', 'build/*') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
build-cache-st-v1-
|
build-cache-st-v1-
|
||||||
- name: Build ffmpeg-core
|
- name: Build ffmpeg-core
|
||||||
run: make prd EXTRA_ARGS="--cache-from=type=local,src=build-cache-st --cache-to=type=local,dest=build-cache-st,mode=max"
|
run: make prd EXTRA_ARGS="--cache-from=type=local,src=build-cache-st --cache-to=type=local,dest=build-cache-st,mode=max"
|
||||||
- name: Upload core
|
- name: Upload core
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ffmpeg-core
|
name: ffmpeg-core
|
||||||
path: packages/core/dist/*
|
path: packages/core/dist/*
|
||||||
build-core-mt:
|
build-core-mt:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Source Code
|
- name: Checkout Source Code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Setup Docker Buildx
|
- name: Setup Docker Buildx
|
||||||
id: buildx
|
id: buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
- name: Cache build
|
- name: Cache build
|
||||||
id: cache-build
|
id: cache-build
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: build-cache-mt
|
path: build-cache-mt
|
||||||
key: build-cache-mt-v1-${{ hashFiles('Dockerfile', 'Makefile', 'build/*') }}
|
key: build-cache-mt-v1-${{ hashFiles('Dockerfile', 'Makefile', 'build/*') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
build-cache-v1-
|
build-cache-v1-
|
||||||
- name: Build ffmpet-core-mt
|
- name: Build ffmpet-core-mt
|
||||||
run: make prd-mt EXTRA_ARGS="--cache-from=type=local,src=build-cache-mt --cache-to=type=local,dest=build-cache-mt,mode=max"
|
run: make prd-mt EXTRA_ARGS="--cache-from=type=local,src=build-cache-mt --cache-to=type=local,dest=build-cache-mt,mode=max"
|
||||||
- name: Upload core-mt
|
- name: Upload core-mt
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ffmpeg-core-mt
|
name: ffmpeg-core-mt
|
||||||
path: packages/core-mt/dist/*
|
path: packages/core-mt/dist/*
|
||||||
tests:
|
tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs:
|
needs:
|
||||||
- build-core
|
- build-core
|
||||||
- build-core-mt
|
- build-core-mt
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Source Code
|
- name: Checkout Source Code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Download ffmpeg-core
|
- name: Download ffmpeg-core
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ffmpeg-core
|
name: ffmpeg-core
|
||||||
path: packages/core/dist
|
path: packages/core/dist
|
||||||
- name: Download ffmpeg-core-mt
|
- name: Download ffmpeg-core-mt
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ffmpeg-core-mt
|
name: ffmpeg-core-mt
|
||||||
path: packages/core-mt/dist
|
path: packages/core-mt/dist
|
||||||
- name: Use Node.js 18
|
- name: Use Node.js 18
|
||||||
uses: actions/setup-node@v2
|
uses: actions/setup-node@v2
|
||||||
with:
|
with:
|
||||||
node-version: 18.x
|
node-version: 18.x
|
||||||
- name: Cache dependencies
|
- name: Cache dependencies
|
||||||
id: cache-dependencies
|
id: cache-dependencies
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: node_modules
|
path: node_modules
|
||||||
key: node-modules-${{ hashFiles('package-lock.json') }}
|
key: node-modules-${{ hashFiles('package-lock.json') }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
node-modules-
|
node-modules-
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
- name: Run tests
|
- name: Install Chrome
|
||||||
run: npm test
|
uses: browser-actions/setup-chrome@latest
|
||||||
|
with:
|
||||||
|
chrome-version: stable
|
||||||
|
- name: Run tests
|
||||||
|
env:
|
||||||
|
CHROME_HEADLESS: 1
|
||||||
|
CHROME_PATH: chrome
|
||||||
|
CHROME_FLAGS: "--headless --disable-gpu --no-sandbox --enable-features=SharedArrayBuffer,CrossOriginIsolation"
|
||||||
|
HEADERS: '{"Cross-Origin-Opener-Policy": "same-origin", "Cross-Origin-Embedder-Policy": "require-corp"}'
|
||||||
|
run: |
|
||||||
|
# Start test server with proper headers for all tests
|
||||||
|
npm run serve -- --headers "$HEADERS" &
|
||||||
|
|
||||||
|
# Increase wait time to ensure server is ready
|
||||||
|
sleep 15
|
||||||
|
|
||||||
|
# Verify headers and isolation status
|
||||||
|
echo "Checking security headers and isolation status..."
|
||||||
|
curl -v http://localhost:3000/tests/ffmpeg-core-st.test.html 2>&1 | grep -i "cross-origin"
|
||||||
|
|
||||||
|
# Run verification script first
|
||||||
|
echo "Verifying browser environment..."
|
||||||
|
cat << EOF > verify-browser.html
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Cross-Origin-Opener-Policy" content="same-origin">
|
||||||
|
<meta http-equiv="Cross-Origin-Embedder-Policy" content="require-corp">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
console.log('SharedArrayBuffer available:', typeof SharedArrayBuffer !== 'undefined');
|
||||||
|
console.log('crossOriginIsolated:', window.crossOriginIsolated);
|
||||||
|
if (!window.crossOriginIsolated || typeof SharedArrayBuffer === 'undefined') {
|
||||||
|
throw new Error('Browser environment not properly configured for SharedArrayBuffer');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Run single-threaded tests first
|
||||||
|
echo "Running single-threaded tests..."
|
||||||
|
npx mocha-headless-chrome \
|
||||||
|
--args="$CHROME_FLAGS" \
|
||||||
|
-a no-sandbox \
|
||||||
|
-f http://localhost:3000/tests/ffmpeg-core-st.test.html 2>&1 | tee st-core-test.log
|
||||||
|
|
||||||
|
npx mocha-headless-chrome \
|
||||||
|
--args="$CHROME_FLAGS" \
|
||||||
|
-a no-sandbox \
|
||||||
|
-f http://localhost:3000/tests/ffmpeg-st.test.html 2>&1 | tee st-test.log
|
||||||
|
|
||||||
|
# Run multi-threaded tests
|
||||||
|
echo "Running multi-threaded tests..."
|
||||||
|
# Create a test script to verify browser environment
|
||||||
|
cat << EOF > verify-browser.html
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Browser Environment Test</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<script>
|
||||||
|
console.log('SharedArrayBuffer available:', typeof SharedArrayBuffer !== 'undefined');
|
||||||
|
console.log('crossOriginIsolated:', window.crossOriginIsolated);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Run the verification in Chrome
|
||||||
|
echo "Verifying browser environment..."
|
||||||
|
npx mocha-headless-chrome \
|
||||||
|
--args="$CHROME_FLAGS --enable-features=SharedArrayBuffer,CrossOriginIsolation" \
|
||||||
|
-a no-sandbox \
|
||||||
|
-f http://localhost:3000/verify-browser.html
|
||||||
|
|
||||||
|
# Run MT tests with verified configuration
|
||||||
|
npx mocha-headless-chrome \
|
||||||
|
--args="$CHROME_FLAGS --enable-features=SharedArrayBuffer,CrossOriginIsolation" \
|
||||||
|
-a no-sandbox \
|
||||||
|
-f http://localhost:3000/tests/ffmpeg-core-mt.test.html 2>&1 | tee mt-core-test.log
|
||||||
|
|
||||||
|
npx mocha-headless-chrome \
|
||||||
|
--args="$CHROME_FLAGS --enable-features=SharedArrayBuffer,CrossOriginIsolation" \
|
||||||
|
-a no-sandbox \
|
||||||
|
-f http://localhost:3000/tests/ffmpeg-mt.test.html 2>&1 | tee mt-test.log
|
||||||
|
|
||||||
|
# Display all logs for debugging
|
||||||
|
echo "=== Test Logs ==="
|
||||||
|
for log in *-test.log; do
|
||||||
|
echo "Contents of $log:"
|
||||||
|
cat $log
|
||||||
|
done
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
This project is looking for maintainers. If you are interested to give it a go, please email [me](mailto:jeromewus@gmail.com) to further discuss maintenance.
|
||||||
|
|
||||||
|
---
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="#">
|
<a href="#">
|
||||||
<img alt="ffmpeg.wasm" width="128px" height="128px" src="https://github.com/ffmpegwasm/ffmpeg.wasm/blob/main/apps/website/static/img/logo192.png"></img>
|
<img alt="ffmpeg.wasm" width="128px" height="128px" src="https://github.com/ffmpegwasm/ffmpeg.wasm/blob/main/apps/website/static/img/logo192.png"></img>
|
||||||
|
@ -4,7 +4,7 @@ import { RouterOutlet } from '@angular/router';
|
|||||||
import { FFmpeg } from '@ffmpeg/ffmpeg';
|
import { FFmpeg } from '@ffmpeg/ffmpeg';
|
||||||
import { fetchFile, toBlobURL } from '@ffmpeg/util';
|
import { fetchFile, toBlobURL } from '@ffmpeg/util';
|
||||||
|
|
||||||
const baseURL = "https://unpkg.com/@ffmpeg/core-mt@0.12.6/dist/esm";
|
const baseURL = 'https://unpkg.com/@ffmpeg/core-mt@0.12.9/dist/esm';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
@ -16,33 +16,34 @@ const baseURL = "https://unpkg.com/@ffmpeg/core-mt@0.12.6/dist/esm";
|
|||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
loaded = false;
|
loaded = false;
|
||||||
ffmpeg = new FFmpeg();
|
ffmpeg = new FFmpeg();
|
||||||
videoURL = "";
|
videoURL = '';
|
||||||
message = "";
|
message = '';
|
||||||
async load() {
|
async load() {
|
||||||
this.ffmpeg.on("log", ({ message }) => {
|
this.ffmpeg.on('log', ({ message }) => {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
});
|
});
|
||||||
await this.ffmpeg.load({
|
await this.ffmpeg.load({
|
||||||
coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`, "text/javascript"),
|
coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`, 'text/javascript'),
|
||||||
wasmURL: await toBlobURL(
|
wasmURL: await toBlobURL(
|
||||||
`${baseURL}/ffmpeg-core.wasm`,
|
`${baseURL}/ffmpeg-core.wasm`,
|
||||||
"application/wasm"
|
'application/wasm',
|
||||||
),
|
),
|
||||||
workerURL: await toBlobURL(
|
workerURL: await toBlobURL(
|
||||||
`${baseURL}/ffmpeg-core.worker.js`,
|
`${baseURL}/ffmpeg-core.worker.js`,
|
||||||
"text/javascript"
|
'text/javascript',
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
this.loaded = true;
|
this.loaded = true;
|
||||||
};
|
}
|
||||||
async transcode() {
|
async transcode() {
|
||||||
const videoURL = "https://raw.githubusercontent.com/ffmpegwasm/testdata/master/video-15s.avi";
|
const videoURL =
|
||||||
await this.ffmpeg.writeFile("input.avi", await fetchFile(videoURL));
|
'https://raw.githubusercontent.com/ffmpegwasm/testdata/master/video-15s.avi';
|
||||||
await this.ffmpeg.exec(["-i", "input.avi", "output.mp4"]);
|
await this.ffmpeg.writeFile('input.avi', await fetchFile(videoURL));
|
||||||
|
await this.ffmpeg.exec(['-i', 'input.avi', 'output.mp4']);
|
||||||
const fileData = await this.ffmpeg.readFile('output.mp4');
|
const fileData = await this.ffmpeg.readFile('output.mp4');
|
||||||
const data = new Uint8Array(fileData as ArrayBuffer);
|
const data = new Uint8Array(fileData as ArrayBuffer);
|
||||||
this.videoURL = URL.createObjectURL(
|
this.videoURL = URL.createObjectURL(
|
||||||
new Blob([data.buffer], { type: 'video/mp4' })
|
new Blob([data.buffer], { type: 'video/mp4' }),
|
||||||
);
|
);
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,42 +1,52 @@
|
|||||||
'use client'
|
"use client";
|
||||||
|
|
||||||
import { FFmpeg } from '@ffmpeg/ffmpeg'
|
import { FFmpeg } from "@ffmpeg/ffmpeg";
|
||||||
import { fetchFile, toBlobURL } from '@ffmpeg/util'
|
import { fetchFile, toBlobURL } from "@ffmpeg/util";
|
||||||
import { useRef, useState } from 'react'
|
import { useRef, useState } from "react";
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
const [loaded, setLoaded] = useState(false)
|
const [loaded, setLoaded] = useState(false);
|
||||||
const [isLoading, setIsLoading] = useState(false)
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
const ffmpegRef = useRef(new FFmpeg())
|
const ffmpegRef = useRef(new FFmpeg());
|
||||||
const videoRef = useRef<HTMLVideoElement | null>(null)
|
const videoRef = useRef<HTMLVideoElement | null>(null);
|
||||||
const messageRef = useRef<HTMLParagraphElement | null>(null)
|
const messageRef = useRef<HTMLParagraphElement | null>(null);
|
||||||
|
|
||||||
const load = async () => {
|
const load = async () => {
|
||||||
setIsLoading(true)
|
setIsLoading(true);
|
||||||
const baseURL = 'https://unpkg.com/@ffmpeg/core@0.12.6/dist/umd'
|
const baseURL = "https://unpkg.com/@ffmpeg/core@0.12.9/dist/umd";
|
||||||
const ffmpeg = ffmpegRef.current
|
const ffmpeg = ffmpegRef.current;
|
||||||
ffmpeg.on('log', ({ message }) => {
|
ffmpeg.on("log", ({ message }) => {
|
||||||
if (messageRef.current) messageRef.current.innerHTML = message
|
if (messageRef.current) messageRef.current.innerHTML = message;
|
||||||
})
|
});
|
||||||
// toBlobURL is used to bypass CORS issue, urls with the same
|
// toBlobURL is used to bypass CORS issue, urls with the same
|
||||||
// domain can be used directly.
|
// domain can be used directly.
|
||||||
await ffmpeg.load({
|
await ffmpeg.load({
|
||||||
coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`, 'text/javascript'),
|
coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`, "text/javascript"),
|
||||||
wasmURL: await toBlobURL(`${baseURL}/ffmpeg-core.wasm`, 'application/wasm')
|
wasmURL: await toBlobURL(
|
||||||
})
|
`${baseURL}/ffmpeg-core.wasm`,
|
||||||
setLoaded(true)
|
"application/wasm"
|
||||||
setIsLoading(false)
|
),
|
||||||
}
|
});
|
||||||
|
setLoaded(true);
|
||||||
|
setIsLoading(false);
|
||||||
|
};
|
||||||
|
|
||||||
const transcode = async () => {
|
const transcode = async () => {
|
||||||
const ffmpeg = ffmpegRef.current
|
const ffmpeg = ffmpegRef.current;
|
||||||
// u can use 'https://ffmpegwasm.netlify.app/video/video-15s.avi' to download the video to public folder for testing
|
// u can use 'https://ffmpegwasm.netlify.app/video/video-15s.avi' to download the video to public folder for testing
|
||||||
await ffmpeg.writeFile('input.avi', await fetchFile('https://raw.githubusercontent.com/ffmpegwasm/testdata/master/video-15s.avi'))
|
await ffmpeg.writeFile(
|
||||||
await ffmpeg.exec(['-i', 'input.avi', 'output.mp4'])
|
"input.avi",
|
||||||
const data = (await ffmpeg.readFile('output.mp4')) as any
|
await fetchFile(
|
||||||
|
"https://raw.githubusercontent.com/ffmpegwasm/testdata/master/video-15s.avi"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
await ffmpeg.exec(["-i", "input.avi", "output.mp4"]);
|
||||||
|
const data = (await ffmpeg.readFile("output.mp4")) as any;
|
||||||
if (videoRef.current)
|
if (videoRef.current)
|
||||||
videoRef.current.src = URL.createObjectURL(new Blob([data.buffer], { type: 'video/mp4' }))
|
videoRef.current.src = URL.createObjectURL(
|
||||||
}
|
new Blob([data.buffer], { type: "video/mp4" })
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
return loaded ? (
|
return loaded ? (
|
||||||
<div className="fixed top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%]">
|
<div className="fixed top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%]">
|
||||||
@ -72,5 +82,5 @@ export default function Home() {
|
|||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,11 @@ import { toBlobURL, fetchFile } from "@ffmpeg/util";
|
|||||||
function App() {
|
function App() {
|
||||||
const [loaded, setLoaded] = useState(false);
|
const [loaded, setLoaded] = useState(false);
|
||||||
const ffmpegRef = useRef(new FFmpeg());
|
const ffmpegRef = useRef(new FFmpeg());
|
||||||
const videoRef = useRef<HTMLVideoElement | null>(null)
|
const videoRef = useRef<HTMLVideoElement | null>(null);
|
||||||
const messageRef = useRef<HTMLParagraphElement | null>(null)
|
const messageRef = useRef<HTMLParagraphElement | null>(null);
|
||||||
|
|
||||||
const load = async () => {
|
const load = async () => {
|
||||||
const baseURL = "https://unpkg.com/@ffmpeg/core-mt@0.12.6/dist/esm";
|
const baseURL = "https://unpkg.com/@ffmpeg/core-mt@0.12.9/dist/esm";
|
||||||
const ffmpeg = ffmpegRef.current;
|
const ffmpeg = ffmpegRef.current;
|
||||||
ffmpeg.on("log", ({ message }) => {
|
ffmpeg.on("log", ({ message }) => {
|
||||||
if (messageRef.current) messageRef.current.innerHTML = message;
|
if (messageRef.current) messageRef.current.innerHTML = message;
|
||||||
@ -31,16 +31,17 @@ function App() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const transcode = async () => {
|
const transcode = async () => {
|
||||||
const videoURL = "https://raw.githubusercontent.com/ffmpegwasm/testdata/master/video-15s.avi";
|
const videoURL =
|
||||||
|
"https://raw.githubusercontent.com/ffmpegwasm/testdata/master/video-15s.avi";
|
||||||
const ffmpeg = ffmpegRef.current;
|
const ffmpeg = ffmpegRef.current;
|
||||||
await ffmpeg.writeFile("input.avi", await fetchFile(videoURL));
|
await ffmpeg.writeFile("input.avi", await fetchFile(videoURL));
|
||||||
await ffmpeg.exec(["-i", "input.avi", "output.mp4"]);
|
await ffmpeg.exec(["-i", "input.avi", "output.mp4"]);
|
||||||
const fileData = await ffmpeg.readFile('output.mp4');
|
const fileData = await ffmpeg.readFile("output.mp4");
|
||||||
const data = new Uint8Array(fileData as ArrayBuffer);
|
const data = new Uint8Array(fileData as ArrayBuffer);
|
||||||
if (videoRef.current) {
|
if (videoRef.current) {
|
||||||
videoRef.current.src = URL.createObjectURL(
|
videoRef.current.src = URL.createObjectURL(
|
||||||
new Blob([data.buffer], { type: 'video/mp4' })
|
new Blob([data.buffer], { type: "video/mp4" })
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
28
apps/solidstart-app/.gitignore
vendored
Normal file
28
apps/solidstart-app/.gitignore
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
|
||||||
|
dist
|
||||||
|
.solid
|
||||||
|
.output
|
||||||
|
.vercel
|
||||||
|
.netlify
|
||||||
|
.vinxi
|
||||||
|
|
||||||
|
# Environment
|
||||||
|
.env
|
||||||
|
.env*.local
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
/node_modules
|
||||||
|
|
||||||
|
# IDEs and editors
|
||||||
|
/.idea
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
*.launch
|
||||||
|
.settings/
|
||||||
|
|
||||||
|
# Temp
|
||||||
|
gitignore
|
||||||
|
|
||||||
|
# System Files
|
||||||
|
.DS_Store
|
||||||
|
Thumbs.db
|
32
apps/solidstart-app/README.md
Normal file
32
apps/solidstart-app/README.md
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# SolidStart
|
||||||
|
|
||||||
|
Everything you need to build a Solid project, powered by [`solid-start`](https://start.solidjs.com);
|
||||||
|
|
||||||
|
## Creating a project
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# create a new project in the current directory
|
||||||
|
npm init solid@latest
|
||||||
|
|
||||||
|
# create a new project in my-app
|
||||||
|
npm init solid@latest my-app
|
||||||
|
```
|
||||||
|
|
||||||
|
## Developing
|
||||||
|
|
||||||
|
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm run dev
|
||||||
|
|
||||||
|
# or start the server and open the app in a new browser tab
|
||||||
|
npm run dev -- --open
|
||||||
|
```
|
||||||
|
|
||||||
|
## Building
|
||||||
|
|
||||||
|
Solid apps are built with _presets_, which optimise your project for deployment to different environments.
|
||||||
|
|
||||||
|
By default, `npm run build` will generate a Node app that you can run with `npm start`. To use a different preset, add it to the `devDependencies` in `package.json` and specify in your `app.config.js`.
|
||||||
|
|
||||||
|
## This project was created with the [Solid CLI](https://solid-cli.netlify.app)
|
13
apps/solidstart-app/app.config.ts
Normal file
13
apps/solidstart-app/app.config.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { defineConfig } from "@solidjs/start/config";
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
ssr: false,
|
||||||
|
server: {
|
||||||
|
static: true,
|
||||||
|
},
|
||||||
|
vite: {
|
||||||
|
optimizeDeps: {
|
||||||
|
exclude: ['@ffmpeg/ffmpeg', '@ffmpeg/util']
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
8251
apps/solidstart-app/package-lock.json
generated
Normal file
8251
apps/solidstart-app/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
23
apps/solidstart-app/package.json
Normal file
23
apps/solidstart-app/package.json
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"name": "solidstart-ffmpeg",
|
||||||
|
"type": "module",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vinxi dev",
|
||||||
|
"build": "vinxi build",
|
||||||
|
"start": "vinxi start"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@ffmpeg/ffmpeg": "^0.12.10",
|
||||||
|
"@ffmpeg/util": "^0.12.1",
|
||||||
|
"@solidjs/router": "^0.14.1",
|
||||||
|
"@solidjs/start": "^1.0.4",
|
||||||
|
"autoprefixer": "^10.4.19",
|
||||||
|
"postcss": "^8.4.38",
|
||||||
|
"solid-js": "^1.8.18",
|
||||||
|
"tailwindcss": "^3.4.3",
|
||||||
|
"vinxi": "^0.3.14"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=18"
|
||||||
|
}
|
||||||
|
}
|
6
apps/solidstart-app/postcss.config.cjs
Normal file
6
apps/solidstart-app/postcss.config.cjs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module.exports = {
|
||||||
|
plugins: {
|
||||||
|
tailwindcss: {},
|
||||||
|
autoprefixer: {},
|
||||||
|
},
|
||||||
|
}
|
BIN
apps/solidstart-app/public/favicon.ico
Normal file
BIN
apps/solidstart-app/public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 664 B |
20
apps/solidstart-app/src/app.css
Normal file
20
apps/solidstart-app/src/app.css
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
@tailwind base;
|
||||||
|
@tailwind components;
|
||||||
|
@tailwind utilities;
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--background-rgb: 214, 219, 220;
|
||||||
|
--foreground-rgb: 0, 0, 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
:root {
|
||||||
|
--background-rgb: 0, 0, 0;
|
||||||
|
--foreground-rgb: 255, 255, 255;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background: rgb(var(--background-rgb));
|
||||||
|
color: rgb(var(--foreground-rgb));
|
||||||
|
}
|
17
apps/solidstart-app/src/app.tsx
Normal file
17
apps/solidstart-app/src/app.tsx
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import { Router } from '@solidjs/router';
|
||||||
|
import { FileRoutes } from '@solidjs/start/router';
|
||||||
|
import { Suspense } from 'solid-js';
|
||||||
|
import './app.css';
|
||||||
|
|
||||||
|
export default function App() {
|
||||||
|
return (
|
||||||
|
<Router
|
||||||
|
root={(props) => (
|
||||||
|
<>
|
||||||
|
<Suspense>{props.children}</Suspense>
|
||||||
|
</>
|
||||||
|
)}>
|
||||||
|
<FileRoutes />
|
||||||
|
</Router>
|
||||||
|
);
|
||||||
|
}
|
4
apps/solidstart-app/src/entry-client.tsx
Normal file
4
apps/solidstart-app/src/entry-client.tsx
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
// @refresh reload
|
||||||
|
import { mount, StartClient } from "@solidjs/start/client";
|
||||||
|
|
||||||
|
mount(() => <StartClient />, document.getElementById("app")!);
|
25
apps/solidstart-app/src/entry-server.tsx
Normal file
25
apps/solidstart-app/src/entry-server.tsx
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// @refresh reload
|
||||||
|
import { createHandler, StartServer } from '@solidjs/start/server';
|
||||||
|
import { HttpHeader, HttpStatusCode } from '@solidjs/start';
|
||||||
|
|
||||||
|
export default createHandler(() => (
|
||||||
|
<StartServer
|
||||||
|
document={({ assets, children, scripts }) => (
|
||||||
|
<html lang='en'>
|
||||||
|
{/*necessary because ffmpeg library uses sharedArrayBuffer */}
|
||||||
|
<HttpHeader name='Cross-Origin-Opener-Policy' value='same-origin' />
|
||||||
|
<HttpHeader name='Cross-Origin-Embedder-Policy' value='require-corp' />
|
||||||
|
<head>
|
||||||
|
<meta charset='utf-8' />
|
||||||
|
<meta name='viewport' content='width=device-width, initial-scale=1' />
|
||||||
|
<link rel='icon' href='/favicon.ico' />
|
||||||
|
{assets}
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id='app'>{children}</div>
|
||||||
|
{scripts}
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
));
|
1
apps/solidstart-app/src/global.d.ts
vendored
Normal file
1
apps/solidstart-app/src/global.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
/// <reference types="@solidjs/start/env" />
|
87
apps/solidstart-app/src/routes/index.tsx
Normal file
87
apps/solidstart-app/src/routes/index.tsx
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
import { FFmpeg } from '@ffmpeg/ffmpeg';
|
||||||
|
import { fetchFile, toBlobURL } from '@ffmpeg/util';
|
||||||
|
import { createSignal, Show } from 'solid-js';
|
||||||
|
|
||||||
|
const baseURL = 'https://unpkg.com/@ffmpeg/core-mt@0.12.6/dist/esm';
|
||||||
|
const videoURL =
|
||||||
|
'https://raw.githubusercontent.com/ffmpegwasm/testdata/master/video-15s.avi';
|
||||||
|
|
||||||
|
export default function Home() {
|
||||||
|
const [loaded, setLoaded] = createSignal(false);
|
||||||
|
const [isLoading, setIsLoading] = createSignal(false);
|
||||||
|
let ffmpegRef = new FFmpeg();
|
||||||
|
let videoRef: any = null;
|
||||||
|
let messageRef: any = null;
|
||||||
|
|
||||||
|
const load = async () => {
|
||||||
|
setIsLoading(true);
|
||||||
|
const ffmpeg = ffmpegRef;
|
||||||
|
ffmpeg.on('log', ({ message }) => {
|
||||||
|
if (messageRef) messageRef.innerHTML = message;
|
||||||
|
});
|
||||||
|
// toBlobURL is used to bypass CORS issue, urls with the same
|
||||||
|
// domain can be used directly.
|
||||||
|
|
||||||
|
await ffmpeg.load({
|
||||||
|
coreURL: await toBlobURL(`${baseURL}/ffmpeg-core.js`, 'text/javascript'),
|
||||||
|
wasmURL: await toBlobURL(
|
||||||
|
`${baseURL}/ffmpeg-core.wasm`,
|
||||||
|
'application/wasm'
|
||||||
|
),
|
||||||
|
workerURL: await toBlobURL(
|
||||||
|
`${baseURL}/ffmpeg-core.worker.js`,
|
||||||
|
'text/javascript'
|
||||||
|
),
|
||||||
|
});
|
||||||
|
setLoaded(true);
|
||||||
|
setIsLoading(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const transcode = async () => {
|
||||||
|
const ffmpeg = ffmpegRef;
|
||||||
|
// u can use 'https://ffmpegwasm.netlify.app/video/video-15s.avi' to download the video to public folder for testing
|
||||||
|
await ffmpeg.writeFile('input.avi', await fetchFile(videoURL));
|
||||||
|
await ffmpeg.exec(['-i', 'input.avi', 'output.mp4']);
|
||||||
|
const data = (await ffmpeg.readFile('output.mp4')) as any;
|
||||||
|
if (videoRef)
|
||||||
|
videoRef.src = URL.createObjectURL(
|
||||||
|
new Blob([data.buffer], { type: 'video/mp4' })
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Show
|
||||||
|
when={loaded()}
|
||||||
|
fallback={
|
||||||
|
<button
|
||||||
|
class='fixed top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%] flex items-center bg-blue-500 hover:bg-blue-700 text-white py-2 px-4 rounded'
|
||||||
|
onClick={load}>
|
||||||
|
Load ffmpeg-core
|
||||||
|
<Show when={isLoading()}>
|
||||||
|
<span class='animate-spin ml-3'>
|
||||||
|
<svg
|
||||||
|
viewBox='0 0 1024 1024'
|
||||||
|
data-icon='loading'
|
||||||
|
width='1em'
|
||||||
|
height='1em'
|
||||||
|
fill='currentColor'
|
||||||
|
aria-hidden='true'>
|
||||||
|
<path d='M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z'></path>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</Show>
|
||||||
|
</button>
|
||||||
|
}>
|
||||||
|
<div class='fixed top-[50%] left-[50%] translate-x-[-50%] translate-y-[-50%]'>
|
||||||
|
<video ref={videoRef} controls></video>
|
||||||
|
<br />
|
||||||
|
<button
|
||||||
|
onClick={transcode}
|
||||||
|
class='bg-green-500 hover:bg-green-700 text-white py-3 px-6 rounded'>
|
||||||
|
Transcode avi to mp4
|
||||||
|
</button>
|
||||||
|
<p ref={messageRef}></p>
|
||||||
|
</div>
|
||||||
|
</Show>
|
||||||
|
);
|
||||||
|
}
|
8
apps/solidstart-app/tailwind.config.cjs
Normal file
8
apps/solidstart-app/tailwind.config.cjs
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
/** @type {import('tailwindcss').Config} */
|
||||||
|
module.exports = {
|
||||||
|
content: ["./src/**/*.{html,js,jsx,ts,tsx}"],
|
||||||
|
theme: {
|
||||||
|
extend: {}
|
||||||
|
},
|
||||||
|
plugins: []
|
||||||
|
};
|
19
apps/solidstart-app/tsconfig.json
Normal file
19
apps/solidstart-app/tsconfig.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ESNext",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"allowSyntheticDefaultImports": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"jsx": "preserve",
|
||||||
|
"jsxImportSource": "solid-js",
|
||||||
|
"allowJs": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"strict": true,
|
||||||
|
"types": ["vinxi/types/client"],
|
||||||
|
"isolatedModules": true,
|
||||||
|
"paths": {
|
||||||
|
"~/*": ["./src/*"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,8 +6,16 @@ const PORT = 8080;
|
|||||||
const ROOT = path.join(__dirname, "public");
|
const ROOT = path.join(__dirname, "public");
|
||||||
|
|
||||||
app.use((_, res, next) => {
|
app.use((_, res, next) => {
|
||||||
res.append("Cross-Origin-Opener-Policy", "same-origin");
|
res.set({
|
||||||
res.append("Cross-Origin-Embedder-Policy", "require-corp");
|
"Cross-Origin-Opener-Policy": "same-origin",
|
||||||
|
"Cross-Origin-Embedder-Policy": "require-corp",
|
||||||
|
"Cross-Origin-Resource-Policy": "cross-origin",
|
||||||
|
"Origin-Agent-Cluster": "?1",
|
||||||
|
"Access-Control-Allow-Origin": "*",
|
||||||
|
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
|
||||||
|
"Access-Control-Allow-Headers":
|
||||||
|
"Origin, X-Requested-With, Content-Type, Accept, Range",
|
||||||
|
});
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ import type { LogEvent } from '@ffmpeg/ffmpeg/dist/esm/types'
|
|||||||
import { fetchFile, toBlobURL } from '@ffmpeg/util'
|
import { fetchFile, toBlobURL } from '@ffmpeg/util'
|
||||||
import { defineComponent, ref } from 'vue'
|
import { defineComponent, ref } from 'vue'
|
||||||
|
|
||||||
const baseURL = 'https://unpkg.com/@ffmpeg/core-mt@0.12.6/dist/esm'
|
const baseURL = 'https://unpkg.com/@ffmpeg/core-mt@0.12.9/dist/esm'
|
||||||
const videoURL = 'https://raw.githubusercontent.com/ffmpegwasm/testdata/master/video-15s.avi'
|
const videoURL = 'https://raw.githubusercontent.com/ffmpegwasm/testdata/master/video-15s.avi'
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
@ -36,7 +36,9 @@ export default defineComponent({
|
|||||||
await ffmpeg.exec(['-i', 'test.avi', 'test.mp4'])
|
await ffmpeg.exec(['-i', 'test.avi', 'test.mp4'])
|
||||||
message.value = 'Complete transcoding'
|
message.value = 'Complete transcoding'
|
||||||
const data = await ffmpeg.readFile('test.mp4')
|
const data = await ffmpeg.readFile('test.mp4')
|
||||||
video.value = URL.createObjectURL(new Blob([(data as Uint8Array).buffer], { type: 'video/mp4' }))
|
video.value = URL.createObjectURL(
|
||||||
|
new Blob([(data as Uint8Array).buffer], { type: 'video/mp4' })
|
||||||
|
)
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
video,
|
video,
|
||||||
|
BIN
apps/website/assets/solidstart-vite.xcf
Normal file
BIN
apps/website/assets/solidstart-vite.xcf
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
@ -61,5 +61,13 @@ any of the examples.
|
|||||||
url="https://github.com/ffmpegwasm/ffmpeg.wasm/tree/main/apps/sveltekit-app"
|
url="https://github.com/ffmpegwasm/ffmpeg.wasm/tree/main/apps/sveltekit-app"
|
||||||
/>
|
/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
<Grid xs={12} sm={6} md={6} lg={6} xl={4}>
|
||||||
|
<ExampleCard
|
||||||
|
img="/img/solidstart-vite.png"
|
||||||
|
title="SolidStart + Vite"
|
||||||
|
desc="SolidStart with Vite (multithread version)"
|
||||||
|
url="https://github.com/ffmpegwasm/ffmpeg.wasm/tree/main/apps/solidstart-app"
|
||||||
|
/>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</MuiThemeProvider>
|
</MuiThemeProvider>
|
||||||
|
@ -11,7 +11,7 @@ It is recommended to read [Overview](/docs/overview) first.
|
|||||||
:::caution
|
:::caution
|
||||||
If you are a [vite](https://vitejs.dev/) user, use `esm` in **baseURL** instead of `umd`:
|
If you are a [vite](https://vitejs.dev/) user, use `esm` in **baseURL** instead of `umd`:
|
||||||
|
|
||||||
~~https://unpkg.com/@ffmpeg/core@0.12.6/dist/umd~~ => https://unpkg.com/@ffmpeg/core@0.12.6/dist/esm
|
~~https://unpkg.com/@ffmpeg/core@0.12.9/dist/umd~~ => https://unpkg.com/@ffmpeg/core@0.12.9/dist/esm
|
||||||
:::
|
:::
|
||||||
|
|
||||||
```jsx live
|
```jsx live
|
||||||
@ -425,9 +425,10 @@ function() {
|
|||||||
|
|
||||||
:::note
|
:::note
|
||||||
Required:
|
Required:
|
||||||
- @ffmpeg/ffmpeg@0.12.7+
|
|
||||||
|
- @ffmpeg/ffmpeg@0.12.6+
|
||||||
- @ffmpeg/core@0.12.4+
|
- @ffmpeg/core@0.12.4+
|
||||||
:::
|
:::
|
||||||
|
|
||||||
Please Check this PR: [Add WORKERFS support](https://github.com/ffmpegwasm/ffmpeg.wasm/pull/581)
|
Please Check this PR: [Add WORKERFS support](https://github.com/ffmpegwasm/ffmpeg.wasm/pull/581)
|
||||||
|
|
||||||
@ -435,8 +436,9 @@ Please Check this PR: [Add WORKERFS support](https://github.com/ffmpegwasm/ffmpe
|
|||||||
|
|
||||||
:::note
|
:::note
|
||||||
Required:
|
Required:
|
||||||
- @ffmpeg/ffmpeg@0.12.7+
|
|
||||||
|
- @ffmpeg/ffmpeg@0.12.6+
|
||||||
- @ffmpeg/core@0.12.4+
|
- @ffmpeg/core@0.12.4+
|
||||||
:::
|
:::
|
||||||
|
|
||||||
Please check this PR: [abort signal](https://github.com/ffmpegwasm/ffmpeg.wasm/pull/573)
|
Please check this PR: [abort signal](https://github.com/ffmpegwasm/ffmpeg.wasm/pull/573)
|
||||||
|
BIN
apps/website/static/img/solidstart-vite.png
Normal file
BIN
apps/website/static/img/solidstart-vite.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
@ -30,6 +30,7 @@ CONF_FLAGS=(
|
|||||||
-lswscale
|
-lswscale
|
||||||
-Wno-deprecated-declarations
|
-Wno-deprecated-declarations
|
||||||
$LDFLAGS
|
$LDFLAGS
|
||||||
|
-sENVIRONMENT=worker
|
||||||
-sWASM_BIGINT # enable big int support
|
-sWASM_BIGINT # enable big int support
|
||||||
-sUSE_SDL=2 # use emscripten SDL2 lib port
|
-sUSE_SDL=2 # use emscripten SDL2 lib port
|
||||||
-sMODULARIZE # modularized to use as a library
|
-sMODULARIZE # modularized to use as a library
|
||||||
@ -49,6 +50,7 @@ CONF_FLAGS=(
|
|||||||
src/fftools/ffmpeg_mux.c
|
src/fftools/ffmpeg_mux.c
|
||||||
src/fftools/ffmpeg_opt.c
|
src/fftools/ffmpeg_opt.c
|
||||||
src/fftools/opt_common.c
|
src/fftools/opt_common.c
|
||||||
|
src/fftools/ffprobe.c
|
||||||
)
|
)
|
||||||
|
|
||||||
emcc "${CONF_FLAGS[@]}" $@
|
emcc "${CONF_FLAGS[@]}" $@
|
||||||
|
10
package-lock.json
generated
10
package-lock.json
generated
@ -28702,7 +28702,7 @@
|
|||||||
},
|
},
|
||||||
"packages/core": {
|
"packages/core": {
|
||||||
"name": "@ffmpeg/core",
|
"name": "@ffmpeg/core",
|
||||||
"version": "0.12.6",
|
"version": "0.12.9",
|
||||||
"license": "GPL-2.0-or-later",
|
"license": "GPL-2.0-or-later",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.x"
|
"node": ">=16.x"
|
||||||
@ -28710,7 +28710,7 @@
|
|||||||
},
|
},
|
||||||
"packages/core-mt": {
|
"packages/core-mt": {
|
||||||
"name": "@ffmpeg/core-mt",
|
"name": "@ffmpeg/core-mt",
|
||||||
"version": "0.12.6",
|
"version": "0.12.9",
|
||||||
"license": "GPL-2.0-or-later",
|
"license": "GPL-2.0-or-later",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.x"
|
"node": ">=16.x"
|
||||||
@ -28718,10 +28718,10 @@
|
|||||||
},
|
},
|
||||||
"packages/ffmpeg": {
|
"packages/ffmpeg": {
|
||||||
"name": "@ffmpeg/ffmpeg",
|
"name": "@ffmpeg/ffmpeg",
|
||||||
"version": "0.12.10",
|
"version": "0.12.14",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ffmpeg/types": "^0.12.2"
|
"@ffmpeg/types": "^0.12.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@typescript-eslint/eslint-plugin": "^6.1.0",
|
"@typescript-eslint/eslint-plugin": "^6.1.0",
|
||||||
@ -28809,7 +28809,7 @@
|
|||||||
},
|
},
|
||||||
"packages/types": {
|
"packages/types": {
|
||||||
"name": "@ffmpeg/types",
|
"name": "@ffmpeg/types",
|
||||||
"version": "0.12.2",
|
"version": "0.12.3",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=16.x"
|
"node": ">=16.x"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
"lint:root": "eslint tests",
|
"lint:root": "eslint tests",
|
||||||
"build": "npm run build --workspace=packages --if-present",
|
"build": "npm run build --workspace=packages --if-present",
|
||||||
"pretest": "npm run build",
|
"pretest": "npm run build",
|
||||||
"serve": "http-server -c-1 -s -p 3000 .",
|
"serve": "http-server -c-1 -s -p 3000 . --cors --headers '{\"Cross-Origin-Embedder-Policy\":\"require-corp\",\"Cross-Origin-Opener-Policy\":\"same-origin\",\"Cross-Origin-Resource-Policy\":\"cross-origin\",\"Origin-Agent-Cluster\":\"?1\"}'",
|
||||||
"test": "server-test test:browser:server 3000 test:all",
|
"test": "server-test test:browser:server 3000 test:all",
|
||||||
"test:all": "npm-run-all test:browser:*:*",
|
"test:all": "npm-run-all test:browser:*:*",
|
||||||
"test:browser": "mocha-headless-chrome -a enable-features=SharedArrayBuffer",
|
"test:browser": "mocha-headless-chrome -a enable-features=SharedArrayBuffer",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ffmpeg/core-mt",
|
"name": "@ffmpeg/core-mt",
|
||||||
"version": "0.12.6",
|
"version": "0.12.9",
|
||||||
"description": "FFmpeg WebAssembly version (multi thread)",
|
"description": "FFmpeg WebAssembly version (multi thread)",
|
||||||
"main": "./dist/umd/ffmpeg-core.js",
|
"main": "./dist/umd/ffmpeg-core.js",
|
||||||
"exports": {
|
"exports": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ffmpeg/core",
|
"name": "@ffmpeg/core",
|
||||||
"version": "0.12.6",
|
"version": "0.12.9",
|
||||||
"description": "FFmpeg WebAssembly version (single thread)",
|
"description": "FFmpeg WebAssembly version (single thread)",
|
||||||
"main": "./dist/umd/ffmpeg-core.js",
|
"main": "./dist/umd/ffmpeg-core.js",
|
||||||
"exports": {
|
"exports": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ffmpeg/ffmpeg",
|
"name": "@ffmpeg/ffmpeg",
|
||||||
"version": "0.12.10",
|
"version": "0.12.14",
|
||||||
"description": "FFmpeg WebAssembly version for browser",
|
"description": "FFmpeg WebAssembly version for browser",
|
||||||
"main": "./dist/umd/ffmpeg.js",
|
"main": "./dist/umd/ffmpeg.js",
|
||||||
"types": "./dist/esm/index.d.ts",
|
"types": "./dist/esm/index.d.ts",
|
||||||
@ -59,6 +59,6 @@
|
|||||||
"webpack-cli": "^5.1.4"
|
"webpack-cli": "^5.1.4"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ffmpeg/types": "^0.12.2"
|
"@ffmpeg/types": "^0.12.4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,7 @@ export class FFmpeg {
|
|||||||
case FFMessageType.MOUNT:
|
case FFMessageType.MOUNT:
|
||||||
case FFMessageType.UNMOUNT:
|
case FFMessageType.UNMOUNT:
|
||||||
case FFMessageType.EXEC:
|
case FFMessageType.EXEC:
|
||||||
|
case FFMessageType.FFPROBE:
|
||||||
case FFMessageType.WRITE_FILE:
|
case FFMessageType.WRITE_FILE:
|
||||||
case FFMessageType.READ_FILE:
|
case FFMessageType.READ_FILE:
|
||||||
case FFMessageType.DELETE_FILE:
|
case FFMessageType.DELETE_FILE:
|
||||||
@ -155,7 +156,7 @@ export class FFmpeg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unlisten to log or prgress events from `ffmpeg.exec()`.
|
* Unlisten to log or progress events from `ffmpeg.exec()`.
|
||||||
*
|
*
|
||||||
* @category FFmpeg
|
* @category FFmpeg
|
||||||
*/
|
*/
|
||||||
@ -249,6 +250,42 @@ export class FFmpeg {
|
|||||||
signal
|
signal
|
||||||
) as Promise<number>;
|
) as Promise<number>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute ffprobe command.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* ```ts
|
||||||
|
* const ffmpeg = new FFmpeg();
|
||||||
|
* await ffmpeg.load();
|
||||||
|
* await ffmpeg.writeFile("video.avi", ...);
|
||||||
|
* // Getting duration of a video in seconds: ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 video.avi -o output.txt
|
||||||
|
* await ffmpeg.ffprobe(["-v", "error", "-show_entries", "format=duration", "-of", "default=noprint_wrappers=1:nokey=1", "video.avi", "-o", "output.txt"]);
|
||||||
|
* const data = ffmpeg.readFile("output.txt");
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @returns `0` if no error, `!= 0` if timeout (1) or error.
|
||||||
|
* @category FFmpeg
|
||||||
|
*/
|
||||||
|
public ffprobe = (
|
||||||
|
/** ffprobe command line args */
|
||||||
|
args: string[],
|
||||||
|
/**
|
||||||
|
* milliseconds to wait before stopping the command execution.
|
||||||
|
*
|
||||||
|
* @defaultValue -1
|
||||||
|
*/
|
||||||
|
timeout = -1,
|
||||||
|
{ signal }: FFMessageOptions = {}
|
||||||
|
): Promise<number> =>
|
||||||
|
this.#send(
|
||||||
|
{
|
||||||
|
type: FFMessageType.FFPROBE,
|
||||||
|
data: { args, timeout },
|
||||||
|
},
|
||||||
|
undefined,
|
||||||
|
signal
|
||||||
|
) as Promise<number>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Terminate all ongoing API calls and terminate web worker.
|
* Terminate all ongoing API calls and terminate web worker.
|
||||||
* `FFmpeg.load()` must be called again before calling any other APIs.
|
* `FFmpeg.load()` must be called again before calling any other APIs.
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
export const MIME_TYPE_JAVASCRIPT = "text/javascript";
|
export const MIME_TYPE_JAVASCRIPT = "text/javascript";
|
||||||
export const MIME_TYPE_WASM = "application/wasm";
|
export const MIME_TYPE_WASM = "application/wasm";
|
||||||
|
|
||||||
export const CORE_VERSION = "0.12.6";
|
export const CORE_VERSION = "0.12.9";
|
||||||
export const CORE_URL = `https://unpkg.com/@ffmpeg/core@${CORE_VERSION}/dist/umd/ffmpeg-core.js`;
|
export const CORE_URL = `https://unpkg.com/@ffmpeg/core@${CORE_VERSION}/dist/umd/ffmpeg-core.js`;
|
||||||
|
|
||||||
export enum FFMessageType {
|
export enum FFMessageType {
|
||||||
LOAD = "LOAD",
|
LOAD = "LOAD",
|
||||||
EXEC = "EXEC",
|
EXEC = "EXEC",
|
||||||
|
FFPROBE = "FFPROBE",
|
||||||
WRITE_FILE = "WRITE_FILE",
|
WRITE_FILE = "WRITE_FILE",
|
||||||
READ_FILE = "READ_FILE",
|
READ_FILE = "READ_FILE",
|
||||||
DELETE_FILE = "DELETE_FILE",
|
DELETE_FILE = "DELETE_FILE",
|
||||||
|
@ -1 +1,2 @@
|
|||||||
export * from "./classes.js";
|
export * from "./classes.js";
|
||||||
|
export * from "./types.js";
|
||||||
|
@ -100,6 +100,14 @@ const exec = ({ args, timeout = -1 }: FFMessageExecData): ExitCode => {
|
|||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const ffprobe = ({ args, timeout = -1 }: FFMessageExecData): ExitCode => {
|
||||||
|
ffmpeg.setTimeout(timeout);
|
||||||
|
ffmpeg.ffprobe(...args);
|
||||||
|
const ret = ffmpeg.ret;
|
||||||
|
ffmpeg.reset();
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
|
||||||
const writeFile = ({ path, data }: FFMessageWriteFileData): OK => {
|
const writeFile = ({ path, data }: FFMessageWriteFileData): OK => {
|
||||||
ffmpeg.FS.writeFile(path, data);
|
ffmpeg.FS.writeFile(path, data);
|
||||||
return true;
|
return true;
|
||||||
@ -170,6 +178,9 @@ self.onmessage = async ({
|
|||||||
case FFMessageType.EXEC:
|
case FFMessageType.EXEC:
|
||||||
data = exec(_data as FFMessageExecData);
|
data = exec(_data as FFMessageExecData);
|
||||||
break;
|
break;
|
||||||
|
case FFMessageType.FFPROBE:
|
||||||
|
data = ffprobe(_data as FFMessageExecData);
|
||||||
|
break;
|
||||||
case FFMessageType.WRITE_FILE:
|
case FFMessageType.WRITE_FILE:
|
||||||
data = writeFile(_data as FFMessageWriteFileData);
|
data = writeFile(_data as FFMessageWriteFileData);
|
||||||
break;
|
break;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ffmpeg/types",
|
"name": "@ffmpeg/types",
|
||||||
"version": "0.12.2",
|
"version": "0.12.4",
|
||||||
"description": "ffmpeg.wasm types",
|
"description": "ffmpeg.wasm types",
|
||||||
"types": "types",
|
"types": "types",
|
||||||
"files": [
|
"files": [
|
||||||
|
31
packages/types/types/index.d.ts
vendored
31
packages/types/types/index.d.ts
vendored
@ -39,22 +39,28 @@ export interface Stat {
|
|||||||
blocks: number;
|
blocks: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FSFilesystemWORKERFS {
|
export interface FSFilesystemWORKERFS {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface FSFilesystemMEMFS {
|
export interface FSFilesystemMEMFS {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface FSFilesystems {
|
export interface FSFilesystems {
|
||||||
WORKERFS: FSFilesystemWORKERFS;
|
WORKERFS: FSFilesystemWORKERFS;
|
||||||
MEMFS: FSFilesystemMEMFS;
|
MEMFS: FSFilesystemMEMFS;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type FSFilesystem =
|
export type FSFilesystem = FSFilesystemWORKERFS | FSFilesystemMEMFS;
|
||||||
| FSFilesystemWORKERFS
|
|
||||||
| FSFilesystemMEMFS;
|
export interface OptionReadFile {
|
||||||
|
encoding: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WorkerFSMountConfig {
|
||||||
|
blobs?: {
|
||||||
|
name: string;
|
||||||
|
data: Blob;
|
||||||
|
}[];
|
||||||
|
files?: File[];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Functions to interact with Emscripten FS library.
|
* Functions to interact with Emscripten FS library.
|
||||||
@ -75,7 +81,11 @@ export interface FS {
|
|||||||
isFile: (mode: number) => boolean;
|
isFile: (mode: number) => boolean;
|
||||||
/** mode is a numeric notation of permission, @see [Numeric Notation](https://en.wikipedia.org/wiki/File-system_permissions#Numeric_notation) */
|
/** mode is a numeric notation of permission, @see [Numeric Notation](https://en.wikipedia.org/wiki/File-system_permissions#Numeric_notation) */
|
||||||
isDir: (mode: number) => boolean;
|
isDir: (mode: number) => boolean;
|
||||||
mount: (fileSystemType: FSFilesystem, data: WorkerFSMountConfig, path: string) => void;
|
mount: (
|
||||||
|
fileSystemType: FSFilesystem,
|
||||||
|
data: WorkerFSMountConfig,
|
||||||
|
path: string
|
||||||
|
) => void;
|
||||||
unmount: (path: string) => void;
|
unmount: (path: string) => void;
|
||||||
filesystems: FSFilesystems;
|
filesystems: FSFilesystems;
|
||||||
}
|
}
|
||||||
@ -115,6 +125,7 @@ export interface FFmpegCoreModule {
|
|||||||
mainScriptUrlOrBlob: string;
|
mainScriptUrlOrBlob: string;
|
||||||
|
|
||||||
exec: (...args: string[]) => number;
|
exec: (...args: string[]) => number;
|
||||||
|
ffprobe: (...args: string[]) => number;
|
||||||
reset: () => void;
|
reset: () => void;
|
||||||
setLogger: (logger: (log: Log) => void) => void;
|
setLogger: (logger: (log: Log) => void) => void;
|
||||||
setTimeout: (timeout: number) => void;
|
setTimeout: (timeout: number) => void;
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "@ffmpeg/util",
|
"name": "@ffmpeg/util",
|
||||||
"version": "0.12.1",
|
"version": "0.12.2",
|
||||||
"description": "browser utils for @ffmpeg/*",
|
"description": "browser utils for @ffmpeg/*",
|
||||||
"main": "./dist/cjs/index.js",
|
"main": "./dist/cjs/index.js",
|
||||||
|
"type": "module",
|
||||||
"types": "./dist/cjs/index.d.ts",
|
"types": "./dist/cjs/index.d.ts",
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
|
@ -4,10 +4,10 @@ const fs = require("fs");
|
|||||||
const NPM_URL = "https://registry.npmjs.org";
|
const NPM_URL = "https://registry.npmjs.org";
|
||||||
const ROOT = "public/assets";
|
const ROOT = "public/assets";
|
||||||
|
|
||||||
const FFMPEG_VERSION = "0.12.7";
|
const FFMPEG_VERSION = "0.12.14";
|
||||||
const UTIL_VERSION = "0.12.0";
|
const UTIL_VERSION = "0.12.1";
|
||||||
const CORE_VERSION = "0.12.5";
|
const CORE_VERSION = "0.12.9";
|
||||||
const CORE_MT_VERSION = "0.12.5";
|
const CORE_MT_VERSION = "0.12.9";
|
||||||
|
|
||||||
const FFMPEG_TGZ = `ffmpeg-${FFMPEG_VERSION}.tgz`;
|
const FFMPEG_TGZ = `ffmpeg-${FFMPEG_VERSION}.tgz`;
|
||||||
const UTIL_TGZ = `util-${UTIL_VERSION}.tgz`;
|
const UTIL_TGZ = `util-${UTIL_VERSION}.tgz`;
|
||||||
|
@ -5,10 +5,12 @@
|
|||||||
const NULL = 0;
|
const NULL = 0;
|
||||||
const SIZE_I32 = Uint32Array.BYTES_PER_ELEMENT;
|
const SIZE_I32 = Uint32Array.BYTES_PER_ELEMENT;
|
||||||
const DEFAULT_ARGS = ["./ffmpeg", "-nostdin", "-y"];
|
const DEFAULT_ARGS = ["./ffmpeg", "-nostdin", "-y"];
|
||||||
|
const DEFAULT_ARGS_FFPROBE = ["./ffprobe"];
|
||||||
|
|
||||||
Module["NULL"] = NULL;
|
Module["NULL"] = NULL;
|
||||||
Module["SIZE_I32"] = SIZE_I32;
|
Module["SIZE_I32"] = SIZE_I32;
|
||||||
Module["DEFAULT_ARGS"] = DEFAULT_ARGS;
|
Module["DEFAULT_ARGS"] = DEFAULT_ARGS;
|
||||||
|
Module["DEFAULT_ARGS_FFPROBE"] = DEFAULT_ARGS_FFPROBE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Variables
|
* Variables
|
||||||
@ -62,6 +64,18 @@ function exec(..._args) {
|
|||||||
return Module["ret"];
|
return Module["ret"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function ffprobe(..._args) {
|
||||||
|
const args = [...Module["DEFAULT_ARGS_FFPROBE"], ..._args];
|
||||||
|
try {
|
||||||
|
Module["_ffprobe"](args.length, stringsToPtr(args));
|
||||||
|
} catch (e) {
|
||||||
|
if (!e.message.startsWith("Aborted")) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Module["ret"];
|
||||||
|
}
|
||||||
|
|
||||||
function setLogger(logger) {
|
function setLogger(logger) {
|
||||||
Module["logger"] = logger;
|
Module["logger"] = logger;
|
||||||
}
|
}
|
||||||
@ -121,6 +135,7 @@ Module["printErr"] = printErr;
|
|||||||
Module["locateFile"] = _locateFile;
|
Module["locateFile"] = _locateFile;
|
||||||
|
|
||||||
Module["exec"] = exec;
|
Module["exec"] = exec;
|
||||||
|
Module["ffprobe"] = ffprobe;
|
||||||
Module["setLogger"] = setLogger;
|
Module["setLogger"] = setLogger;
|
||||||
Module["setTimeout"] = setTimeout;
|
Module["setTimeout"] = setTimeout;
|
||||||
Module["setProgress"] = setProgress;
|
Module["setProgress"] = setProgress;
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
const EXPORTED_FUNCTIONS = ["_ffmpeg", "_abort", "_malloc"];
|
const EXPORTED_FUNCTIONS = ["_ffmpeg", "_abort", "_malloc", "_ffprobe"];
|
||||||
|
|
||||||
console.log(EXPORTED_FUNCTIONS.join(","));
|
console.log(EXPORTED_FUNCTIONS.join(","));
|
||||||
|
@ -90,8 +90,8 @@ typedef struct InputFile {
|
|||||||
int nb_streams;
|
int nb_streams;
|
||||||
} InputFile;
|
} InputFile;
|
||||||
|
|
||||||
const char program_name[] = "ffprobe";
|
const char program_name_ffprobe[] = "ffprobe";
|
||||||
const int program_birth_year = 2007;
|
const int program_birth_year_ffprobe = 2007;
|
||||||
|
|
||||||
static int do_bitexact = 0;
|
static int do_bitexact = 0;
|
||||||
static int do_count_frames = 0;
|
static int do_count_frames = 0;
|
||||||
@ -382,6 +382,58 @@ static void ffprobe_cleanup(int ret)
|
|||||||
#if HAVE_THREADS
|
#if HAVE_THREADS
|
||||||
pthread_mutex_destroy(&log_mutex);
|
pthread_mutex_destroy(&log_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
do_bitexact = 0;
|
||||||
|
do_count_frames = 0;
|
||||||
|
do_count_packets = 0;
|
||||||
|
do_read_frames = 0;
|
||||||
|
do_read_packets = 0;
|
||||||
|
do_show_chapters = 0;
|
||||||
|
do_show_error = 0;
|
||||||
|
do_show_format = 0;
|
||||||
|
do_show_frames = 0;
|
||||||
|
do_show_packets = 0;
|
||||||
|
do_show_programs = 0;
|
||||||
|
do_show_streams = 0;
|
||||||
|
do_show_stream_disposition = 0;
|
||||||
|
do_show_data = 0;
|
||||||
|
do_show_program_version = 0;
|
||||||
|
do_show_library_versions = 0;
|
||||||
|
do_show_pixel_formats = 0;
|
||||||
|
do_show_pixel_format_flags = 0;
|
||||||
|
do_show_pixel_format_components = 0;
|
||||||
|
do_show_log = 0;
|
||||||
|
do_show_chapter_tags = 0;
|
||||||
|
do_show_format_tags = 0;
|
||||||
|
do_show_frame_tags = 0;
|
||||||
|
do_show_program_tags = 0;
|
||||||
|
do_show_stream_tags = 0;
|
||||||
|
do_show_packet_tags = 0;
|
||||||
|
show_value_unit = 0;
|
||||||
|
use_value_prefix = 0;
|
||||||
|
use_byte_value_binary_prefix = 0;
|
||||||
|
use_value_sexagesimal_format = 0;
|
||||||
|
show_private_data = 1;
|
||||||
|
show_optional_fields = SHOW_OPTIONAL_FIELDS_AUTO;
|
||||||
|
print_format = NULL;
|
||||||
|
stream_specifier = NULL;
|
||||||
|
show_data_hash = NULL;
|
||||||
|
read_intervals = NULL;
|
||||||
|
read_intervals_nb = 0;
|
||||||
|
find_stream_info = 1;
|
||||||
|
input_filename = NULL;
|
||||||
|
print_input_filename = NULL;
|
||||||
|
iformat = NULL;
|
||||||
|
output_filename = NULL;
|
||||||
|
hash = NULL;
|
||||||
|
nb_streams = 0;
|
||||||
|
nb_streams_packets = NULL;
|
||||||
|
nb_streams_frames = NULL;
|
||||||
|
selected_streams = NULL;
|
||||||
|
log_buffer = NULL;
|
||||||
|
log_buffer_size = 0;
|
||||||
|
|
||||||
|
av_log(NULL, AV_LOG_DEBUG, "FFprobe: Cleanup done.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
struct unit_value {
|
struct unit_value {
|
||||||
@ -3491,7 +3543,7 @@ end:
|
|||||||
static void show_usage(void)
|
static void show_usage(void)
|
||||||
{
|
{
|
||||||
av_log(NULL, AV_LOG_INFO, "Simple multimedia streams analyzer\n");
|
av_log(NULL, AV_LOG_INFO, "Simple multimedia streams analyzer\n");
|
||||||
av_log(NULL, AV_LOG_INFO, "usage: %s [OPTIONS] INPUT_FILE\n", program_name);
|
av_log(NULL, AV_LOG_INFO, "usage: %s [OPTIONS] INPUT_FILE\n", program_name_ffprobe);
|
||||||
av_log(NULL, AV_LOG_INFO, "\n");
|
av_log(NULL, AV_LOG_INFO, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3503,7 +3555,7 @@ static void ffprobe_show_program_version(WriterContext *w)
|
|||||||
writer_print_section_header(w, SECTION_ID_PROGRAM_VERSION);
|
writer_print_section_header(w, SECTION_ID_PROGRAM_VERSION);
|
||||||
print_str("version", FFMPEG_VERSION);
|
print_str("version", FFMPEG_VERSION);
|
||||||
print_fmt("copyright", "Copyright (c) %d-%d the FFmpeg developers",
|
print_fmt("copyright", "Copyright (c) %d-%d the FFmpeg developers",
|
||||||
program_birth_year, CONFIG_THIS_YEAR);
|
program_birth_year_ffprobe, CONFIG_THIS_YEAR);
|
||||||
print_str("compiler_ident", CC_IDENT);
|
print_str("compiler_ident", CC_IDENT);
|
||||||
print_str("configuration", FFMPEG_CONFIGURATION);
|
print_str("configuration", FFMPEG_CONFIGURATION);
|
||||||
writer_print_section_footer(w);
|
writer_print_section_footer(w);
|
||||||
@ -3740,7 +3792,7 @@ static int opt_print_filename(void *optctx, const char *opt, const char *arg)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void show_help_default(const char *opt, const char *arg)
|
void show_help_default_ffprobe(const char *opt, const char *arg)
|
||||||
{
|
{
|
||||||
av_log_set_callback(log_callback_help);
|
av_log_set_callback(log_callback_help);
|
||||||
show_usage();
|
show_usage();
|
||||||
@ -4037,6 +4089,7 @@ int ffprobe(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
av_log_set_flags(AV_LOG_SKIP_REPEATED);
|
av_log_set_flags(AV_LOG_SKIP_REPEATED);
|
||||||
|
ffprobe_cleanup(0);
|
||||||
register_exit(ffprobe_cleanup);
|
register_exit(ffprobe_cleanup);
|
||||||
|
|
||||||
options = real_options;
|
options = real_options;
|
||||||
@ -4142,7 +4195,7 @@ int ffprobe(int argc, char **argv)
|
|||||||
(!do_show_program_version && !do_show_library_versions && !do_show_pixel_formats))) {
|
(!do_show_program_version && !do_show_library_versions && !do_show_pixel_formats))) {
|
||||||
show_usage();
|
show_usage();
|
||||||
av_log(NULL, AV_LOG_ERROR, "You have to specify one input file.\n");
|
av_log(NULL, AV_LOG_ERROR, "You have to specify one input file.\n");
|
||||||
av_log(NULL, AV_LOG_ERROR, "Use -h to get full help or, even better, run 'man %s'.\n", program_name);
|
av_log(NULL, AV_LOG_ERROR, "Use -h to get full help or, even better, run 'man %s'.\n", program_name_ffprobe);
|
||||||
ret = AVERROR(EINVAL);
|
ret = AVERROR(EINVAL);
|
||||||
} else if (input_filename) {
|
} else if (input_filename) {
|
||||||
ret = probe_file(wctx, input_filename, print_input_filename);
|
ret = probe_file(wctx, input_filename, print_input_filename);
|
||||||
|
@ -1,27 +1,31 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8" />
|
||||||
<title>FFmpeg Unit Test</title>
|
<meta http-equiv="Cross-Origin-Opener-Policy" content="same-origin" />
|
||||||
<link rel="stylesheet" href="../node_modules/mocha/mocha.css">
|
<meta http-equiv="Cross-Origin-Embedder-Policy" content="require-corp" />
|
||||||
</head>
|
<meta http-equiv="Cross-Origin-Resource-Policy" content="cross-origin" />
|
||||||
<body>
|
<meta http-equiv="Origin-Agent-Cluster" content="?1" />
|
||||||
<div id="mocha"></div>
|
<title>FFmpeg Unit Test</title>
|
||||||
<script src="../node_modules/mocha/mocha.js"></script>
|
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
|
||||||
<script src="../node_modules/chai/chai.js"></script>
|
</head>
|
||||||
<script src="../packages/core-mt/dist/umd/ffmpeg-core.js"></script>
|
<body>
|
||||||
<script src="./test-helper-browser.js"></script>
|
<div id="mocha"></div>
|
||||||
<script type="text/javascript">
|
<script src="../node_modules/mocha/mocha.js"></script>
|
||||||
window.FFMPEG_TYPE = "mt";
|
<script src="../node_modules/chai/chai.js"></script>
|
||||||
</script>
|
<script src="../packages/core-mt/dist/umd/ffmpeg-core.js"></script>
|
||||||
<script>
|
<script src="./test-helper-browser.js"></script>
|
||||||
mocha.setup('bdd');
|
<script type="text/javascript">
|
||||||
mocha.timeout(60000);
|
window.FFMPEG_TYPE = "mt";
|
||||||
</script>
|
</script>
|
||||||
<script src="./ffmpeg-core.test.js"></script>
|
<script>
|
||||||
<script>
|
mocha.setup("bdd");
|
||||||
window.expect = chai.expect;
|
mocha.timeout(60000);
|
||||||
mocha.run();
|
</script>
|
||||||
</script>
|
<script src="./ffmpeg-core.test.js"></script>
|
||||||
</body>
|
<script>
|
||||||
|
window.expect = chai.expect;
|
||||||
|
mocha.run();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,27 +1,31 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8" />
|
||||||
<title>FFmpeg Unit Test</title>
|
<meta http-equiv="Cross-Origin-Opener-Policy" content="same-origin" />
|
||||||
<link rel="stylesheet" href="../node_modules/mocha/mocha.css">
|
<meta http-equiv="Cross-Origin-Embedder-Policy" content="require-corp" />
|
||||||
</head>
|
<meta http-equiv="Cross-Origin-Resource-Policy" content="same-origin" />
|
||||||
<body>
|
<meta http-equiv="Origin-Agent-Cluster" content="?1" />
|
||||||
<div id="mocha"></div>
|
<title>FFmpeg Unit Test</title>
|
||||||
<script src="../node_modules/mocha/mocha.js"></script>
|
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
|
||||||
<script src="../node_modules/chai/chai.js"></script>
|
</head>
|
||||||
<script src="../packages/core/dist/umd/ffmpeg-core.js"></script>
|
<body>
|
||||||
<script src="./test-helper-browser.js"></script>
|
<div id="mocha"></div>
|
||||||
<script type="text/javascript">
|
<script src="../node_modules/mocha/mocha.js"></script>
|
||||||
window.FFMPEG_TYPE = "st";
|
<script src="../node_modules/chai/chai.js"></script>
|
||||||
</script>
|
<script src="../packages/core/dist/umd/ffmpeg-core.js"></script>
|
||||||
<script>
|
<script src="./test-helper-browser.js"></script>
|
||||||
mocha.setup('bdd');
|
<script type="text/javascript">
|
||||||
mocha.timeout(60000);
|
window.FFMPEG_TYPE = "st";
|
||||||
</script>
|
</script>
|
||||||
<script src="./ffmpeg-core.test.js"></script>
|
<script>
|
||||||
<script>
|
mocha.setup("bdd");
|
||||||
window.expect = chai.expect;
|
mocha.timeout(60000);
|
||||||
mocha.run();
|
</script>
|
||||||
</script>
|
<script src="./ffmpeg-core.test.js"></script>
|
||||||
</body>
|
<script>
|
||||||
|
window.expect = chai.expect;
|
||||||
|
mocha.run();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,28 +1,33 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8" />
|
||||||
<title>FFmpeg Unit Test</title>
|
<meta http-equiv="Cross-Origin-Opener-Policy" content="same-origin" />
|
||||||
<link rel="stylesheet" href="../node_modules/mocha/mocha.css">
|
<meta http-equiv="Cross-Origin-Embedder-Policy" content="require-corp" />
|
||||||
</head>
|
<meta http-equiv="Cross-Origin-Resource-Policy" content="cross-origin" />
|
||||||
<body>
|
<meta http-equiv="Origin-Agent-Cluster" content="?1" />
|
||||||
<div id="mocha"></div>
|
<title>FFmpeg Unit Test</title>
|
||||||
<script src="../node_modules/mocha/mocha.js"></script>
|
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
|
||||||
<script src="../node_modules/chai/chai.js"></script>
|
</head>
|
||||||
<script src="../packages/ffmpeg/dist/umd/ffmpeg.js"></script>
|
<body>
|
||||||
<script src="./test-helper-browser.js"></script>
|
<div id="mocha"></div>
|
||||||
<script type="text/javascript">
|
<script src="../node_modules/mocha/mocha.js"></script>
|
||||||
window.FFMPEG_TYPE = "mt";
|
<script src="../node_modules/chai/chai.js"></script>
|
||||||
window.CORE_URL = "http://localhost:3000/packages/core-mt/dist/umd/ffmpeg-core.js";
|
<script src="../packages/ffmpeg/dist/umd/ffmpeg.js"></script>
|
||||||
</script>
|
<script src="./test-helper-browser.js"></script>
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
mocha.setup('bdd');
|
window.FFMPEG_TYPE = "mt";
|
||||||
mocha.timeout(60000);
|
window.CORE_URL =
|
||||||
</script>
|
"http://localhost:3000/packages/core-mt/dist/umd/ffmpeg-core.js";
|
||||||
<script src="./ffmpeg.test.js"></script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
window.expect = chai.expect;
|
mocha.setup("bdd");
|
||||||
mocha.run();
|
mocha.timeout(60000);
|
||||||
</script>
|
</script>
|
||||||
</body>
|
<script src="./ffmpeg.test.js"></script>
|
||||||
|
<script>
|
||||||
|
window.expect = chai.expect;
|
||||||
|
mocha.run();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,28 +1,33 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8" />
|
||||||
<title>FFmpeg Unit Test</title>
|
<meta http-equiv="Cross-Origin-Opener-Policy" content="same-origin" />
|
||||||
<link rel="stylesheet" href="../node_modules/mocha/mocha.css">
|
<meta http-equiv="Cross-Origin-Embedder-Policy" content="require-corp" />
|
||||||
</head>
|
<meta http-equiv="Cross-Origin-Resource-Policy" content="same-origin" />
|
||||||
<body>
|
<meta http-equiv="Origin-Agent-Cluster" content="?1" />
|
||||||
<div id="mocha"></div>
|
<title>FFmpeg Unit Test</title>
|
||||||
<script src="../node_modules/mocha/mocha.js"></script>
|
<link rel="stylesheet" href="../node_modules/mocha/mocha.css" />
|
||||||
<script src="../node_modules/chai/chai.js"></script>
|
</head>
|
||||||
<script src="../packages/ffmpeg/dist/umd/ffmpeg.js"></script>
|
<body>
|
||||||
<script src="./test-helper-browser.js"></script>
|
<div id="mocha"></div>
|
||||||
<script type="text/javascript">
|
<script src="../node_modules/mocha/mocha.js"></script>
|
||||||
window.FFMPEG_TYPE = "st";
|
<script src="../node_modules/chai/chai.js"></script>
|
||||||
window.CORE_URL = "http://localhost:3000/packages/core/dist/umd/ffmpeg-core.js";
|
<script src="../packages/ffmpeg/dist/umd/ffmpeg.js"></script>
|
||||||
</script>
|
<script src="./test-helper-browser.js"></script>
|
||||||
<script>
|
<script type="text/javascript">
|
||||||
mocha.setup('bdd');
|
window.FFMPEG_TYPE = "st";
|
||||||
mocha.timeout(60000);
|
window.CORE_URL =
|
||||||
</script>
|
"http://localhost:3000/packages/core/dist/umd/ffmpeg-core.js";
|
||||||
<script src="./ffmpeg.test.js"></script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
window.expect = chai.expect;
|
mocha.setup("bdd");
|
||||||
mocha.run();
|
mocha.timeout(60000);
|
||||||
</script>
|
</script>
|
||||||
</body>
|
<script src="./ffmpeg.test.js"></script>
|
||||||
|
<script>
|
||||||
|
window.expect = chai.expect;
|
||||||
|
mocha.run();
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const { FFmpeg } = FFmpegWASM;
|
const { FFmpeg } = window.FFmpegWASM;
|
||||||
|
|
||||||
const genName = (name) => `[ffmpeg][${FFMPEG_TYPE}] ${name}`;
|
const genName = (name) => `[ffmpeg][${FFMPEG_TYPE}] ${name}`;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user