avoid to copy video frame to appsrc in gstreamer

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

avoid to copy video frame to appsrc in gstreamer

332 Views
yibhan
Contributor III

I am trying to deliver the NV12 video format frame v4l2h264enc. At this time, I am going to do this by passing the video frame to appsrc. The video resolution is 1920x1080, but it takes a lot of time to copy memory. Is there any way to avoid memory copy?

I am using video capture format is YUYV and then, transform YUYV to NV12 using g2d blitter, NV12 is video format and to push NV12 video to v4l2h264enc, I am using appsrc in gstreamer. when push NV12 video to appsrc in gstreamer, I am trying to use memcpy, but  this takes a little bit time and I can't expect video perfomance.

Belows are my psudo codes:

gstbuf = gst_buffer_new_allocate(NULL, size, NULL);

gst_buffer_map(gstbuf, &map, GST_MAP_WRITE);

memcpy(map.data, data, size);

gst_buffer_unmap(gstbuf, &map);

gst_app_src_push_buffer(GST_APP_SRC(appsrc), gstbuf);

If you have any ideas or guides, please let me know.

Thanks,

 

0 Kudos
0 Replies