Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

127
Vistas
Decoding h264 / avc with OpenCV

I am trying to decode the h264 stream from ws-scrcpy frame by frame to apply some computer vision operations. (ScrCpy is basically a mobile device application that broadcasts the device screen via h264. WS-ScrCpy is a web application that is able to receive and display the stream in a browser).

Since I need to do the computer vision operations in RGB space and on a server (via nodejs), I need to convert frames first from YUV to RGB format. Since JS-only implementations are slow, I am trying to get this done with OpenCV.

Unfortunately, the decoded frames look like this:

yuv -> RGB

Here is what I do in more detail:

I use Broadway Acv decoder to decode data (NALUs?- received via websocket) into frames. Then I use OpenCV to convert YUV frames to RGB.

import Avc from './vendor/Broadway/Decoder'
//...
this.avc.onPictureDecoded = (buffer: Uint8Array, width: number, height: number) => {
  const mYUV = new cv.Mat(h + h / 2, w, cv.CV_8UC1, buffer)
  const mRgb = mYUV.cvtColor(cv.COLOR_YUV420p2BGR)
  cv.imwrite('./del/test.png', mRgb)
}

The fact that the image size of the resulting Mat object is correct, tells me that I am doing something right. But as you can see there also is obviously something wrong.

Any idea what the problem might be?

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda