The free and privacy-friendly screen recorder with no limits 🎥
JavaScript annotationannotation-toolaudiocamerachrome-extensiondesigneditorffmpegjavascriptproductivityrecorderscreen-capturescreen-recorderscreencasttensorflowvideo
Route video to MediaRecorder when AAC encode is unsupported
Alyssa X566979e4b806
diff --git a/src/pages/CloudRecorder/encoder/chooseEncoder.js b/src/pages/CloudRecorder/encoder/chooseEncoder.jsindex 543cf37..4a25c1a 100644--- a/src/pages/CloudRecorder/encoder/chooseEncoder.js+++ b/src/pages/CloudRecorder/encoder/chooseEncoder.js@@ -107,6 +107,21 @@ export const inspectTrackPlan = async ({ track, probeOptions }) => {reason: `hw-probe-${track}-unsupported`,};}+ // MP4/WebCodecs can't carry audio without AAC. When AAC encode is missing+ // (rare: Chromium with H.264 but no proprietary AAC) the WebCodecs path+ // would produce a silent MP4, so route video tracks to MediaRecorder+ // (VP9-WebM), which records audio natively. AAC support is device-global, so+ // both inspectTrackPlan callers (TUS filetype hint and recorder) agree.+ // `=== false` so an older cached probe without the field fails open.+ if (hwSlots.summary.aacSupported === false) {+ return {+ kind: "mediarecorder",+ container: "video/webm",+ codec: "vp9",+ hwSlots: hwSlots.summary,+ reason: "aac-unsupported",+ };+ }if (track === "camera" && hwSlots.summary.mode === "screen-hw-camera-mr") {return {kind: "mediarecorder",diff --git a/src/pages/CloudRecorder/encoder/hwSlotProbe.js b/src/pages/CloudRecorder/encoder/hwSlotProbe.jsindex ab5bd46..6280368 100644--- a/src/pages/CloudRecorder/encoder/hwSlotProbe.js+++ b/src/pages/CloudRecorder/encoder/hwSlotProbe.js@@ -231,6 +231,29 @@ const probeConcurrentHw = async ({ codec, framerate }) => {};};+// MP4 carries AAC audio. probeOne only verifies the H.264 *video* encoder, so+// a build that encodes H.264 but not AAC (some Chromium builds without+// proprietary codecs) would pick the WebCodecs MP4 path and then silently drop+// audio. AAC support is device-global, so probe it once; when missing,+// chooseEncoder routes video tracks to MediaRecorder (VP9-WebM), which records+// audio natively. isConfigSupported-only, matching the video probe's style.+const AAC_PROBE_CONFIG = {+ codec: "mp4a.40.2",+ sampleRate: 48000,+ numberOfChannels: 2,+ bitrate: 128000,+};++const probeAacSupported = async () => {+ if (typeof AudioEncoder === "undefined") return false;+ try {+ const support = await AudioEncoder.isConfigSupported(AAC_PROBE_CONFIG);+ return Boolean(support?.supported);+ } catch {+ return false;+ }+};+export const probeHwSlots = async ({framerate = 30,} = {}) => {@@ -289,6 +312,8 @@ export const probeHwSlots = async ({// rejected every codec candidate at the individual probe step.const cameraHwViable = cameraProbe.supported;+ const aacSupported = await probeAacSupported();+return {screen: screenProbe,camera: cameraProbe,@@ -296,6 +321,7 @@ export const probeHwSlots = async ({summary: {screenHw: screenProbe.supported,cameraHw: cameraHwViable,+ aacSupported,cameraHwAvailable,cameraHwAdvertised: cameraProbe.supported,cameraPreferSoftware,