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

694
Views
¿Puedo usar el archivo de video local en el mediapipe? (JS)

Soy un estudiante de programación. No soy bueno en inglés, así que lo escribí usando un traductor.

Estoy estudiando el canal multimedia. https://google.github.io/mediapipe/solutions/face_mesh

¿Sabes cómo usar el video local en lugar de la cámara web?

 let videoElement = document.querySelector(".input_video") //@mediapipe/camera_utils/camera_utils.js" const camera = new Camera(videoElement, { onFrame: async () => { await holistic.send({ image: videoElement }); }, width: 640, height: 480, }); camera.start();

Este es el código para obtener la cámara web. Creo que necesito cambiar este código, pero no sé cómo hacerlo.

así que traté de averiguar sobre '@mediapipe/camera_utils/camera_utils.js', no pude encontrar ningún dato.

Y encontré usando el video local en la demostración de codepen. https://codepen.io/mediapipe/detalles/KKgVaPJ

Pero no sé qué parte del código usar.

Por favor, enséñame el camino.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

En lugar de crear una nueva cámara, debe enviar los fotogramas mediante requestAnimationFrame(). Sin embargo, como el envío debe estar en una función asíncrona, requestAnimationFrame debe estar dentro de una Promesa.

Tienes la configuración estándar de mediapipe

 let videoElement = document.querySelector(".input_video"); const config = { locateFile: (file) => { return 'https://cdn.jsdelivr.net/npm/@mediapipe/face_mesh@' + `${mpFaceMesh.VERSION}/${file}`; } }; const solutionOptions = { selfieMode: false, enableFaceGeometry: false, maxNumFaces: 1, refineLandmarks: true, //false, minDetectionConfidence: 0.5, minTrackingConfidence: 0.5 }; const faceMesh = new mpFaceMesh.FaceMesh(config); faceMesh.setOptions(solutionOptions); faceMesh.onResults(onResults);

pero en lugar de la nueva Camera() o SourcePicker(), necesita un bucle de cuadro de animación

 async function onFrame() { if (!videoElement.paused && !videoElement.ended) { await faceMesh.send({ image: videoElement }); // https://stackoverflow.com/questions/65144038/how-to-use-requestanimationframe-with-promise await new Promise(requestAnimationFrame); onFrame(); } else setTimeout(onFrame, 500); }

carga el video

 // must be same domain otherwise it will taint the canvas! videoElement.src = "./mylocalvideo.mp4"; videoElement.onloadeddata = (evt) => { let video = evt.target; canvasElement.width = video.videoWidth; canvasElement.height = video.videoHeight; videoElement.play(); onFrame(); }
about 4 years ago · Juan Pablo Isaza Report
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!