Capture the video from the camera on the Raspberry Pi and filter it in OpenGL before encoding

I want a way to capture video from the camera interface in Raspberry Pi, run it through a filter written as an OpenGL shader, and then send it to a hardware encoder.

This blog post discusses applying OpenGL shader filters to the output of the camera when using raspistill. This is the corresponding source code. However, the output in this case will not enter the video Encoder, and this will not run on video, only on still images. Also (not completely sure) I think this is related to the preview, please look at these bits: raspitex_state pointer to the GL preview state and state->ops. redraw = sobel_redraw.

This blog also talks about “fast path”, can someone explain what it means in this case?

The texture conversion is applicable to any MMAL opaque buffer, that is, the camera preview, still (up to 2000×2000 Resolution) video. However, the sample code only executes the GL pipeline for static previews. I think someone posted a patch on the RPI forum to make it work with RaspiVid, so you can use it.

Fastpath basically means not copying buffer data to ARM memory and performing software conversion. Therefore, for GL rendering, it means only passing the handle to GL, so the GPU driver can do this directly. /p>

Currently, there is no support/fast path in the driver for feeding the OpenGL rendering buffer to the video encoder. Instead, the slow and possibly impractical path is to call glReadPixels to convert the buffer to YUV And pass the converted buffer to the encoder.

The fast path is definitely possible, I have done some work to port it to the RPI driver, but some other frameworks are needed until the new one It’s only a year for me to have a chance to see it.

I want a way to capture video from the camera interface in Raspberry Pi, through a filter written as an OpenGL shader Run it and send it to the hardware encoder.

This blog post discusses applying OpenGL shader filters to the camera output when using raspistill. This is the corresponding source code However, the output in this case will not go to the video encoder, and this will not run on the video, only on the still image. Also (not completely sure) I think this is related to the preview, please look at these bits : Raspitex_state pointer to GL preview state and state-> ops.redraw = sobel_redraw.

This blog also talks about “fast path”, can someone explain the meaning in this case?

Texture conversion is suitable for any MMAL opaque buffer, i.e. camera preview, still (up to 2000×2000 resolution) video. However, the sample code is only static Preview the execution of the GL pipeline. I think someone posted a patch on the RPI forum to make it work with RaspiVid, so you can use it.

Fastpath basically means not buffering The data is copied to the ARM memory and software converted. Therefore, for GL rendering, it means that you only need to pass the handle to GL, so the GPU driver can do this directly.

Currently, there is no in the driver The support/fast path is used to feed the OpenGL rendering buffer into the video encoder. Instead, the slow and possibly impractical path is to call glReadPixels, convert the buffer to YUV and pass the converted buffer to the encoder.

The fast path is definitely possible, I have done some work to port it to the RPI driver, but some other frameworks are needed, and I won’t have a chance to see it until the new year.

p>

Leave a Comment

Your email address will not be published.