Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

438
Views
Convertir video blob en javascript a uint8array y luego volver a video

Actualmente estoy grabando video desde una fuente HTML de la siguiente manera. Los blobs tienen una longitud de 500 ms y luego estoy registrando la forma de matriz del Blob. Esto se debe a que no tengo acceso al almacenamiento, pero tengo acceso al registro y planeo recrear el video a partir de la salida del registro.

 let recorder = new MediaRecorder(stream); let data = []; recorder.ondataavailable = (event) => { event.data.arrayBuffer().then(buffer => { console.log("[" + new Uint8Array(buffer) + "]") }) } recorder.start(500);

En el lado de la reconstrucción, estoy usando el siguiente código:

 let data = []; rl.on('line', (line) => { let match = line.match(regex) || []; if (match != []) { for (const m of match) { const [, value] = m.split(' '); let arrUint8 = new Uint8Array(value.split(',')) data.push(new Blob([arrUint8], { type: "video/x-matroska;codecs=avc1,opus" })) } } }) rl.on('close', () => { const blob = new Blob(data, { type: "video/vp8" }); console.log(blob); blob.arrayBuffer().then(buffer => { let buff = Buffer.from(buffer); fs.writeFile('video.webm', buff, () => console.log('video saved!')); }) })

El archivo de video se está generando pero no parece reproducirse. ¿Me estoy perdiendo algo en la lectura y reconstrucción?

PD: la expresión regular es solo para aislar uint8array en la salida del registro.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!