Uncaught ReferenceError: createFFmpeg is not defined
How to create an FFMpeg video tag in HTML 5?
<!DOCTYPE html>
<html>
<head>
<title>HTML5 FFmpeg Example</title>
<script src="https://cdn.jsdelivr.net/npm/@ffmpeg/ffmpeg"></script>
</head>
<body>
<h1>HTML5 FFmpeg Example</h1>
<video controls>
<source src="input.mp4" />
</video>
<script>
const ffmpeg = createFFmpeg({ log: true });
const loadFFmpeg = async () => {
await ffmpeg.load();
console.log('FFmpeg loaded');
};
loadFFmpeg();
</script>
</body>
</html>
If you take a look at the CDN js file you are including, the function createFFmpeg doesn't exist.
createFFmpeg was removed in 0.11.x and is now used in 0.12+ as new FFmpeg(). Note that the arguments of createFFmpeg() is moved to ffmpeg.load()`.
Check the migration notes here.
@Braunson
I replaced following my codes.
<!DOCTYPE html>
<html>
<head>
<title>HTML5 FFmpeg Example</title>
<script src="https://cdn.jsdelivr.net/npm/@ffmpeg/ffmpeg"></script>
</head>
<body>
<h1>HTML5 FFmpeg Example</h1>
<video controls>
<source src="input.mp4" />
</video>
<script>
const ffmpeg = new FFmpeg({ log: true });
const loadFFmpeg = async () => {
await ffmpeg.load();
console.log('FFmpeg loaded');
};
loadFFmpeg();
</script>
</body>
</html>
I get this error.
Uncaught ReferenceError: FFmpeg is not defined
Please or to participate in this conversation.