The free and privacy-friendly screen recorder with no limits π₯
JavaScript annotationannotation-toolaudiocamerachrome-extensiondesigneditorffmpegjavascriptproductivityrecorderscreen-capturescreen-recorderscreencasttensorflowvideo
super fast video editor
Alyssa Xc6b777bc6359
diff --git a/src/pages/EditorWebCodecs/Sandbox.jsx b/src/pages/EditorWebCodecs/Sandbox.jsxindex 83cf049..05df521 100644--- a/src/pages/EditorWebCodecs/Sandbox.jsx+++ b/src/pages/EditorWebCodecs/Sandbox.jsx@@ -36,6 +36,13 @@ const Sandbox = () => {}};+ function isMp4Blob(blob) {+ return blob+ .slice(4, 12)+ .text()+ .then((t) => t === "ftyp");+ }+const toBase64 = (blob) =>new Promise((resolve, reject) => {const reader = new FileReader();@@ -87,6 +94,27 @@ const Sandbox = () => {}case "base64-to-blob": {+ // Decode the base64 blob (type might be wrong or missing)+ const rawBlob = await fetch(message.base64).then((r) => r.blob());++ // Real MP4 signature check+ const header = await rawBlob.slice(4, 12).text();+ const looksMp4 = header === "ftyp";++ if (looksMp4) {+ console.log("Already MP4, skipping conversion.");+ // β¬οΈ Already MP4 β skip all conversion+ sendMessage({+ type: "updated-blob",+ base64: message.base64,+ topLevel: true,+ });+ break;+ }++ console.log("Converting WebM to MP4...");++ // Otherwise treat it as WebM β MP4const webmBlob = base64ToWebmBlob(message.base64);const mp4Blob = await convertWebmToMp4(webmBlob, (progress) =>sendMessage({@@ -94,6 +122,7 @@ const Sandbox = () => {progress: Math.round(progress * 100),}));+const base64 = await toBase64(mp4Blob);sendMessage({ type: "updated-blob", base64, topLevel: true });break;diff --git a/src/pages/Recorder/Recorder.jsx b/src/pages/Recorder/Recorder.jsxindex ef3b414..b988fca 100644--- a/src/pages/Recorder/Recorder.jsx+++ b/src/pages/Recorder/Recorder.jsx@@ -340,8 +340,15 @@ const Recorder = () => {videoBitrate: videoBitsPerSecond,audioBitrate: audioBitsPerSecond,onFinalized: async () => {- console.log("[RECORDER] WebCodecs finalize event β assembling MP4");- await assembleAndDownload(); // β only downloaded here+ // Finish writing any remaining chunks (usually none)+ await waitForDrain();++ // Let the editor know the MP4 blobs are ready+ if (!sentLast.current) {+ sentLast.current = true;+ isFinishing.current = false;+ chrome.runtime.sendMessage({ type: "video-ready" });+ }},onChunk: (chunkData, timestampUs) => {// chunkData = Uint8Array from muxer@@ -360,11 +367,6 @@ const Recorder = () => {},onStop: async () => {await waitForDrain();- if (!sentLast.current) {- sentLast.current = true;- isFinishing.current = false;- chrome.runtime.sendMessage({ type: "video-ready" });- }},});@@ -461,33 +463,6 @@ const Recorder = () => {};}- async function assembleAndDownload() {- const keys = await chunksStore.keys();- const items = await Promise.all(keys.map((k) => chunksStore.getItem(k)));- const ordered = items.sort((a, b) => a.index - b.index);-- const blob = new Blob(- ordered.map((o) => o.chunk),- {- type: "video/mp4",- }- );-- const url = URL.createObjectURL(blob);- const a = document.createElement("a");- a.href = url;- a.download = "recording.mp4";- a.click();-- setTimeout(() => URL.revokeObjectURL(url), 2000);-- console.log(- "[RECORDER] Auto-downloaded recording.mp4",- ordered.length,- "chunks"- );- }-async function stopRecording() {if (isFinishing.current) {console.log("[RECORDER] stopRecording ignored (already running)");diff --git a/src/pages/Sandbox/context/ContentState.jsx b/src/pages/Sandbox/context/ContentState.jsxindex 073f57d..a5058a8 100644--- a/src/pages/Sandbox/context/ContentState.jsx+++ b/src/pages/Sandbox/context/ContentState.jsx@@ -105,7 +105,10 @@ const ContentState = (props) => {c.chunk instanceof Blob ? c.chunk : new Blob([c.chunk]));- const blob = new Blob(parts, { type: "video/webm" });+ const first = parts[0];+ const inferredType = first?.type || "video/webm";++ const blob = new Blob(parts, { type: inferredType });reconstructVideo(blob);};@@ -258,11 +261,40 @@ const ContentState = (props) => {}, [contentState.blob]);const reconstructVideo = async (withBlob) => {- const blob = withBlob+ let blob = withBlob? withBlob- : new Blob(videoChunks.current, {- type: "video/webm; codecs=vp8, opus",- });+ : new Blob(videoChunks.current, { type: "video/webm; codecs=vp8,opus" });++ if (blob.type === "video/mp4" || /\.mp4$/i.test(blob.name || "")) {+ setContentState((prev) => ({+ ...prev,+ blob: blob,+ webm: null,+ mp4ready: true,+ ready: true,+ rawBlob: blob,+ isFfmpegRunning: false,+ noffmpeg: false,+ }));++ // Extract duration, width, height+ const video = document.createElement("video");+ video.preload = "metadata";+ video.onloadedmetadata = () => {+ setContentState((prev) => ({+ ...prev,+ duration: video.duration,+ width: video.videoWidth,+ height: video.videoHeight,+ }));++ URL.revokeObjectURL(video.src);+ };+ video.src = URL.createObjectURL(blob);++ chrome.runtime.sendMessage({ type: "recording-complete" });+ return;+ }const { recordingDuration } = await chrome.storage.local.get("recordingDuration"