Comments (5)
In the latest version (0.9.3) of ffmpeg.wasm, we are using a separate ffmpeg-core.wasm file by default, so this issue is fixed. ๐
from ffmpeg.wasm.
I'm getting an error : Uncaught (in promise) TypeError: Failed to fetch
I guess this is because the path is not set properly. here's my code :
`import React, { useCallback, useEffect, useState } from "react";
import { useDropzone } from "react-dropzone";
import { createFFmpeg, fetchFile } from "@ffmpeg/ffmpeg";
const ffmpeg = createFFmpeg({
log: true,
corePath: "/node_modules/@ffmpeg/core/dist/ffmpeg-core.js",
});
const VidPrompt = () => {
const [videos, setVideos] = useState(null);
const [frames, setFrames] = useState([]);
const [ready, setReady] = useState(false);
const onDrop = useCallback((acceptedFiles) => {
setVideos(
acceptedFiles.map((file) =>
Object.assign(file, {
preview: URL.createObjectURL(file),
})
)
);
}, []);
useEffect(() => {
(async () => {
await ffmpeg.load();
setReady(true);
})();
}, []);
useEffect(() => {
return () => {
videos?.forEach((file) => URL.revokeObjectURL(file.preview));
};
}, [videos]);
const { getRootProps, getInputProps, isDragActive } = useDropzone({
onDrop,
});
const extractFrames = async (file) => {
ffmpeg.FS("writeFile", "test.mp4", await fetchFile(file));
await ffmpeg.run("-i", "test.mp4", "-vf", "fps=1", "out%d.png");
const data = ffmpeg
.FS("readdir", "/")
.filter((item) => item.includes(".png"));
setFrames(
data.map((image) => {
const data = ffmpeg.FS("readFile", image);
const url = URL.createObjectURL(
new Blob([data.buffer], { type: "image/png" })
);
return url;
})
);
};
useEffect(() => {
if (ready && videos) {
extractFrames(videos[0]);
}
}, [videos, ready]);
return (
<>
{!videos && (
<div
{...getRootProps()}
className="border-dashed border-2 border-red from-purple-400 py-32 px-32 flex flex-col justify-center items-center"
>
<input {...getInputProps()} />
{isDragActive ? (
<p>Drop the videos here ...</p>
) : (
<p>Drag n drop some videos here, or click to select videos</p>
)}
</div>
)}
<div className="flex flex-row">
{videos?.map((video, i) => (
<div key={i}>
<video src={video.preview} controls width="500" />
</div>
))}
</div>
<div className="flex flex-row">
{frames.map((frame, i) => (
<div key={i}>
<img src={frame} alt={`Frame ${i}`} />
</div>
))}
</div>
</>
);
};
export default VidPrompt;
`
without adding corepath to ffmpeg I'm getting the same error.
from ffmpeg.wasm.
Hi @meikidd,
This error is why we don't use @ffmpeg/core-wasm as our default core, it is an issue I am surveying, but haven't got too much progress so far.
from ffmpeg.wasm.
@meikidd Thanks for the tip, manually changing the url did really help.
@jeromewu I looked at chrome's network panel and can say the standard ffmpeg.js core is not loaded, it's only loading the wasm core. But i still see the extrem slow transcoding process to h264 like @meikidd.
from ffmpeg.wasm.
@tpetry manually changing the url to what?
from ffmpeg.wasm.
Related Issues (20)
- Did anyone encounter this issue when adding subtitles? HOT 2
- Deploying to server error: Missing download-assets.js
- Hi! I have built a collaborative video editor with ffmpeg wasm HOT 4
- support silk format HOT 1
- Who has encountered this problem, which brother will help me HOT 1
- 'Cross-Origin-Opener-Policy': 'same-origin', 'Cross-Origin-Embedder-Policy': 'require-corp' HOT 8
- Failed to load resource: net::ERR_REQUEST_RANGE_NOT_SATISFIABLE HOT 3
- load() error๏ผ๏ผ
- createDir error HOT 2
- load error
- When can ffprobe be used?ffprobe
- Upgrade to FFmpeg 6.x HOT 2
- Memory error HOT 2
- (bug/question) How to properly use one ffmpeg.exec() execution output as another's ffmpeg.exec() input? HOT 3
- Help needed solving -> DOMException: Failed to construct 'Worker': Script at 'https://reddit.com/814.ffmpeg.js' cannot be accessed from origin 'https://reddit.com.'
- Why can't ffmpeg.wasm work well on Chrome? Please answer. HOT 4
- Can't absolute paths be used in the ffmpeg.run method HOT 2
- ffmpeg.mount - ErrnoError: FS error HOT 4
- @ffmpeg/core and @ffmpeg/core-mt missing export for the ffmpeg-core.worker.js file.
- Who can give me an example of adding subtitles to a video? When I add subtitles, I always report that the font cannot be found HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ffmpeg.wasm.