Hi, have trouble finding sample code to save the →
struct mbuf_raw_video_frame *frame : as a image file (e.g. JPG) (obtained from pdraw).
Appreciate any assistance
thanks!
Hi, have trouble finding sample code to save the →
struct mbuf_raw_video_frame *frame : as a image file (e.g. JPG) (obtained from pdraw).
Appreciate any assistance
thanks!
Hi vincej56,
You can extract the plane data from the struct mbuf_raw_video_frame as follow:
const uint8_t *plane_data[VDEF_RAW_MAX_PLANE_COUNT];
plane_count = vdef_get_raw_frame_plane_count(&info->format);
for (unsigned int i = 0; i < plane_count; i++) {
size_t plane_len;
res = mbuf_raw_video_frame_get_plane(
frame, i, (const void **)&plane_data[i], &plane_len);
if (res < 0) {
ULOG_ERRNO("mbuf_raw_video_frame_get_plane", -res);
goto out;
}
}
With the plane buffers, you can either save the frame as raw video file (.yuv), or encode the frame in JPEG format with libjpeg-turbo for instance.
Regards,
Mathieu
This topic was automatically closed after 30 days. New replies are no longer allowed.