<div dir="ltr"><div dir="ltr">Hi 

Nicolas,</div><div dir="ltr"><br></div><div dir="ltr">All I needed was to multiply the stride:<br><div><br></div><div>gsize offset[1] = { 0 };<br></div><div>gint stride[1] = { width * 3 };<br>gst_buffer_add_video_meta_full(buffer, GST_VIDEO_FRAME_FLAG_NONE, GST_VIDEO_FORMAT_RGB, width, height,<br></div><div>    1, offset, stride); // single plane, zero offset and stride equal to (width * 3)</div><div><br></div><div>Thanks,</div><div>Ilya</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Nov 21, 2019 at 9:23 PM Ilya Aleshkov <<a href="mailto:ilya.aleshkov@gmail.com">ilya.aleshkov@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Nicolas,<div><br></div><div>Thank you so much! I've never heard about buffer metadata.</div><div><br></div><div>Now I'm able to specify metadata for a GRAY8  buffer:</div><div>gsize offset[1] = { 0 };<br>gint stride[1] = { width };<br>gst_buffer_add_video_meta_full(buffer, GST_VIDEO_FRAME_FLAG_NONE, GST_VIDEO_FORMAT_GRAY8, width, height,</div><div>    1, offset, stride); // single plane, zero offset and stride equal to width</div><div><div><br></div><div>But I'm stuck dealing with my RGB buffers. I have some observations:</div><div>1 ) gst_buffer_add_video_meta(buffer

, GST_VIDEO_FRAME_FLAG_NONE, GST_VIDEO_FORMAT_RGB, width, height); // It allows me to use an arbitrary resolution. But I've got a distorted image. Artifacts look like errors with strides.</div><div>2 ) gst_buffer_add_video_meta_full

(buffer

, GST_VIDEO_FRAME_FLAG_NONE, GST_VIDEO_FORMAT_RGB, width, height, 3, ...);  // It leaves me with error "gst_video_frame_map_id: assertion 'info->finfo->n_planes == meta->n_planes' failed".</div><div>3 ) gst_buffer_add_video_meta_full

(buffer

, GST_VIDEO_FRAME_FLAG_NONE, GST_VIDEO_FORMAT_RGB, width, height, 1, ...);  //  I've got the same distorted image again.</div><div><div><br></div><div>Thanks,</div><div>Ilya</div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Nov 19, 2019 at 4:40 AM Nicolas Dufresne <<a href="mailto:nicolas@ndufresne.ca" target="_blank">nicolas@ndufresne.ca</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Le lundi 18 novembre 2019 à 23:18 +0300, Ilya Aleshkov a écrit :<br>
> Hi,<br>
> <br>
> I am trying to feed a 658x492 frame to AppSrc element.<br>
> And I always get the same error: default video-frame.c:175:gst_video_frame_map_id: invalid buffer size 971208 < 972192<br>
> It seems that AppSrc element just can't adopt this particular resolution - 658x492 (and some others too).<br>
> It's relatively easy to fix by slightly changing the resolution (660x490). I wonder why.<br>
> How to deal with it in proper way? I would not want to crop/resize my frames.<br>
<br>
You forgot to mention which pixel formats. GStreamer will assume some<br>
default alignments which do make sense for memory access. If you don't<br>
follow the default alignment then add GstVideMeta on the buffer to<br>
specify. This can be done using gst_buffer_add_video_meta_full() prior<br>
to pushing.<br>
<br>
Note that some software element don't fully check their alignments and<br>
will just crash in some cases. Feel free to fix as needed.<br>
<br>
Nicolas<br>
<br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org" target="_blank">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a></blockquote></div>
</blockquote></div></div>