# Modifying frames with OpenCV before writing to encoded video file

Source: https://forum.modalai.com/topic/4400/modifying-frames-with-opencv-before-writing-to-encoded-video-file
Category: General Questions (https://forum.modalai.com/category/2/general-questions)
Posted: 2025-05-07 13:31:45 UTC by voxluser12341
Replies: 1 · Views: 430

## voxluser12341 · 2025-05-07 13:31:45 UTC

Hi, I'd like to develop a program very similar to `voxl-record-video` for the camera i have connected as `hires`, except that upon receiving a frame, I want to edit it using [OpenCV's drawing functionalities](https://docs.opencv.org/4.x/d6/d6e/group__imgproc__draw.html#ga5126f47f883d730f633d74f07456c576), specifically `arrowedLine()` and `putText()`, before writing it to file. In `voxl-record-video`, I believe that the [frame is already encoded when received as a char*](https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-mpa-tools/-/blob/master/tools/voxl-record-video.c?ref_type=heads#L170). Is there a way to transform this into a matrix of pixel values that OpenCV's methods can work with, then transform it back into the format it needs to be in to be written to video? Or is there another approach that you recommend to do this?

## Reply by voxluser12341 · 2025-05-08 13:35:06 UTC

It seems that a similar functionality has been shown in an experimental python branch: https://gitlab.com/voxl-public/voxl-sdk/utilities/voxl-mpa-tools/-/blob/pympa-experimental/tools/python/pympa-resize.py. Is this a recommended way to go about this (if so, how do I get these libraries and their C-bindings onto my voxl2) or is there an easier approach?
