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

128
Views
línea verde al renderizar video en lienzo

Estoy renderizando una secuencia de video en un lienzo, en algún momento aparece una línea verde al costado del video renderizado, ¿por qué? y como arreglar esto?

¡Ocurre cuando el tamaño del lienzo es más pequeño que la resolución del video!

El código es muy simple

 let videoConstraints: MediaTrackConstraints; if (options) { if (!CameraResolutions[options.resolution]) options.resolution = CameraQuality.Auto; videoConstraints = { deviceId: options.deviceId, frameRate: { ideal: 30 }, // facingMode: options.facingMode, width: { ideal: CameraResolutions[options.resolution][0] }, // 720 height: { ideal: CameraResolutions[options.resolution][1] }, // 720 }; } const constraints: MediaStreamConstraints = { video: videoConstraints ?? true, audio: false, }; navigator.mediaDevices.getUserMedia(options.constraints); ... this.ctx.drawImage(this.video, 0, 0, this.canvas.width, this.canvas.height);

this.video es un MediaStream recibido de una cámara web.

estoy probando en chrome

ACTUALIZACIÓN: Basado en el comentario de coralee actualizado a esto y funcionó :) La mayoría de las veces :( Pero necesito una mejor solución

 const w = this.canvas.width - 10; const h = this.canvas.height - 10; const x = 5; // to center the video on canvas const y = 5; this.ctx.drawImage(this.video, x, y, w, h);

ACTUALIZACIÓN 2: El verdadero problema: nuestro SDK de WebRTC está habilitando la transmisión simultánea y usa el códec vp8 https://en.wikipedia.org/wiki/VP8 y, por lo tanto, el tamaño del lienzo debe dividirse por 4, 8 o 16 La solución: Math.round(Math.min(videoWidth, maxSize) / 16) * 16;

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

Depende del formato del archivo.

Solía ser editor de video y recuerdo que este era un problema común con las exportaciones de video.

La mejor manera de solucionarlo era escalar el video un píxel. Entonces, si su video fue 100%, lo hace 101%.

about 4 years ago · Santiago Gelvez 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!