AppSrc resolution restrictions

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

AppSrc resolution restrictions

Ilya Aleshkov
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.

Thanks,
Ilya

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: AppSrc resolution restrictions

Nicolas Dufresne-5
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
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: AppSrc resolution restrictions

Ilya Aleshkov
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 <[hidden email]> 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
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: AppSrc resolution restrictions

Ilya Aleshkov
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 <[hidden email]> 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 <[hidden email]> 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
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel