AppSrc resolution restrictions

Ilya Aleshkov ilya.aleshkov at gmail.com
Sat Nov 23 03:55:58 UTC 2019


Hi  Nicolas,

All I needed was to multiply the stride:

gsize offset[1] = { 0 };
gint stride[1] = { width * 3 };
gst_buffer_add_video_meta_full(buffer,
GST_VIDEO_FRAME_FLAG_NONE, GST_VIDEO_FORMAT_RGB, width, height,
    1, offset, stride); // single plane, zero offset and stride equal to
(width * 3)

Thanks,
Ilya

On Thu, Nov 21, 2019 at 9:23 PM Ilya Aleshkov <ilya.aleshkov at gmail.com>
wrote:

> Hi Nicolas,
>
> Thank you so much! I've never heard about buffer metadata.
>
> Now I'm able to specify metadata for a GRAY8  buffer:
> gsize offset[1] = { 0 };
> gint stride[1] = { width };
> gst_buffer_add_video_meta_full(buffer,
> GST_VIDEO_FRAME_FLAG_NONE, GST_VIDEO_FORMAT_GRAY8, width, height,
>     1, offset, stride); // single plane, zero offset and stride equal to
> width
>
> But I'm stuck dealing with my RGB buffers. I have some observations:
> 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.
> 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".
> 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.
>
> Thanks,
> Ilya
>
> On Tue, Nov 19, 2019 at 4:40 AM Nicolas Dufresne <nicolas at ndufresne.ca>
> wrote:
>
>> Le lundi 18 novembre 2019 à 23:18 +0300, Ilya Aleshkov a écrit :
>> > Hi,
>> >
>> > I am trying to feed a 658x492 frame to AppSrc element.
>> > And I always get the same error: default
>> video-frame.c:175:gst_video_frame_map_id: invalid buffer size 971208 <
>> 972192
>> > It seems that AppSrc element just can't adopt this particular
>> resolution - 658x492 (and some others too).
>> > It's relatively easy to fix by slightly changing the resolution
>> (660x490). I wonder why.
>> > How to deal with it in proper way? I would not want to crop/resize my
>> frames.
>>
>> You forgot to mention which pixel formats. GStreamer will assume some
>> default alignments which do make sense for memory access. If you don't
>> follow the default alignment then add GstVideMeta on the buffer to
>> specify. This can be done using gst_buffer_add_video_meta_full() prior
>> to pushing.
>>
>> Note that some software element don't fully check their alignments and
>> will just crash in some cases. Feel free to fix as needed.
>>
>> Nicolas
>>
>> _______________________________________________
>> gstreamer-devel mailing list
>> gstreamer-devel at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20191123/35c5acb2/attachment.html>


More information about the gstreamer-devel mailing list