bugtracker icon indicating copy to clipboard operation
bugtracker copied to clipboard

GstreamFilter failed using aspectratiocrop plugin

Open Ogulcan-Ozdemir opened this issue 5 years ago • 6 comments

Prerequisites

  • [X] I have read the SUPPORT document

  • [X] I have checked the Troubleshooting Guide

  • [X] I have tested with the latest version of Kurento

Issue description

GstreamerFilter with command aspectratiocrop aspect-ratio=5/9 failed with Given command is not valid, only one element can be created error.

Context

I am trying crop incoming streams acceptable ratio for webrtc client.

How to reproduce?

My pipeline structure is one to one video conference with Webrtcendpoint and recording each clients separately Recorderendpoints. These works fine but if I add GstreamerFilter between Webrtcendpoint connection with mentioned command above it fails.

(Optional) Possible solution

I tried GstreamFilter with different command such as videobox these plugin works fine and run as expected. videobox plugin is similar to aspectratiocrop plugin both of them in gstreamer good plugins. Also these plugins have only one src and one sink pad. I read about kurento only accept that pad property for gstreamer filter in these issue: https://github.com/Kurento/bugtracker/issues/78#issuecomment-222912857

INFO about Kurento Media Server

  • Kurento version: 6.13.0
  • Server OS: Ubuntu 18.04.4 LTS
  • Installation method:
    • [X] apt-get
    • [] Docker
    • [] AWS
    • [] Built from sources

INFO about your Application Server

  • Language: NodeJs 12.0 LTS
  • Kurento Client version: 6.12.1-dev

INFO about end-user clients

I am using https://github.com/node-webrtc/node-webrtc nodejs wrtc client

INFO about your environment

I am using WebRtcEndPoint, RecordEndPoint and trying GstreamerFilter.

Commands output

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"

$ kurento-media-server --version
Kurento Media Server version: 6.13.0
Found modules:
        'core' version 6.13.0
        'elements' version 6.13.0
        'filters' version 6.13.0

$ dpkg -l | grep -Pi 'kurento|kms-|gst.*1.5|nice'
ii  gstreamer1.5-libav:amd64             1.8.1-1kurento1.18.04               amd64        libav plugin for GStreamer
ii  gstreamer1.5-nice:amd64              0.1.15-1kurento3.18.04              amd64        ICE library (GStreamer 1.5 plugin)
ii  gstreamer1.5-plugins-bad:amd64       1.8.1-1kurento4.18.04               amd64        GStreamer plugins from the "bad" set
ii  gstreamer1.5-plugins-base:amd64      1.8.1-1kurento2.18.04               amd64        GStreamer plugins from the "base" set
ii  gstreamer1.5-plugins-good:amd64      1.8.1-1kurento3.18.04               amd64        GStreamer plugins from the "good" set
ii  gstreamer1.5-plugins-ugly:amd64      1.8.1-1kurento1.18.04               amd64        GStreamer plugins from the "ugly" set
ii  gstreamer1.5-pulseaudio:amd64        1.8.1-1kurento3.18.04               amd64        GStreamer plugin for PulseAudio
ii  gstreamer1.5-x:amd64                 1.8.1-1kurento2.18.04               amd64        GStreamer plugins for X11 and Pango
ii  kms-core                             6.13.0-0kurento1.18.04              amd64        Kurento Core module
ii  kms-elements                         6.13.0-0kurento1.18.04              amd64        Kurento Elements module
ii  kms-filters                          6.13.0-0kurento1.18.04              amd64        Kurento Filters module
ii  kms-jsonrpc                          6.13.0-0kurento1.18.04              amd64        Kurento JSON-RPC library
ii  kmsjsoncpp                           1.6.3-1kurento1.18.04               amd64        Kurento jsoncpp library
ii  kurento-media-server                 6.13.0-0kurento1.18.04              amd64        Kurento Media Server
ii  libgstreamer-plugins-bad1.5-0:amd64  1.8.1-1kurento4.18.04               amd64        GStreamer development files for libraries from the "bad" set
ii  libgstreamer-plugins-base1.5-0:amd64 1.8.1-1kurento2.18.04               amd64        GStreamer libraries from the "base" set
ii  libgstreamer1.5-0:amd64              1.8.1-1kurento2.18.04               amd64        Core GStreamer libraries and elements
ii  libnice10:amd64                      0.1.15-1kurento3.18.04              amd64        ICE library (shared library)
ii  libsrtp0:amd64                       1.6.0-0kurento1.18.04               amd64        Secure RTP (SRTP) and UST Reference Implementations - shared library
ii  libusrsctp                           0.9.2-1kurento1.18.04               amd64        sctp-refimpl library
ii  openh264                             1.4.0-1kurento1.18.04               amd64        OpenH264 library
ii  openh264-gst-plugins-bad-1.5:amd64   1.8.1-1kurento4.18.04               amd64        GStreamer plugins from openh264
ii  openwebrtc-gst-plugins               0.10.0-1kurento1.18.04              amd64        OpenWebRTC specific GStreamer plugins

Ogulcan-Ozdemir avatar Jun 07 '20 23:06 Ogulcan-Ozdemir

Update after research for error message I found it similar problem caused same exception. It is GST_IS_BIN check in GStreamerFilterImpl.cpp:90

However my question change to why kurento reject gstreamer bin objects ? I just started learning gstreamer and usage in of gstreamerFilter in kurento want to learn more about these.

Ogulcan-Ozdemir avatar Jun 08 '20 14:06 Ogulcan-Ozdemir

I don't remember why it doesn't accept GstBins, probably it is due to pad mismatches later on in the code... however maybe that's something we could improve.

Could you try disabling that check? You would need to Build from sources, then comment out or remove the

else if (GST_IS_BIN (filter) ) {
  ...
}

j1elo avatar Jun 25 '20 17:06 j1elo

I don't remember why it doesn't accept GstBins, probably it is due to pad mismatches later on in the code... however maybe that's something we could improve.

Could you try disabling that check? You would need to Build from sources, then comment out or remove the

else if (GST_IS_BIN (filter) ) {
  ...
}

Hi sorry for late response I will try to remove check and build form source this weekend.

Ogulcan-Ozdemir avatar Jul 10 '20 13:07 Ogulcan-Ozdemir

Hi, I stumbled into the same problem. I tried removing the else if branch but the output is just black. Is there any other filter that would allow cropping to a certain aspect ratio. I know of videocrop but this requires knowing the dimensions of the stream.

repomaa avatar Jul 15 '20 18:07 repomaa

Hello guys, I wonder if you find any workaround to use the aspecratiocrop plugin within kurento?

alex1712 avatar Feb 15 '21 16:02 alex1712

Just some more info in case someone gets inspired on how to make it work, I tried without the if to reject the GstBins and it seems that the filter is applied by seeing this logs:

kms_1  | 0:00:41.792902009     1 0x7fdfcc006ed0 DEBUG        aspectratiocrop gstaspectratiocrop.c:110:gst_aspect_ratio_crop_set_cropping:<aspectratiocrop0> set top cropping to: 67
kms_1  | 0:00:41.792926434     1 0x7fdfcc006ed0 DEBUG        aspectratiocrop gstaspectratiocrop.c:114:gst_aspect_ratio_crop_set_cropping:<aspectratiocrop0> set right cropping to: 0
kms_1  | 0:00:41.792931062     1 0x7fdfcc006ed0 DEBUG        aspectratiocrop gstaspectratiocrop.c:118:gst_aspect_ratio_crop_set_cropping:<aspectratiocrop0> set bottom cropping to: 67
kms_1  | 0:00:41.792943045     1 0x7fdfcc006ed0 DEBUG        aspectratiocrop gstaspectratiocrop.c:122:gst_aspect_ratio_crop_set_cropping:<aspectratiocrop0> set left cropping to: 0

But I think then is not able to find any pad to connect on the source based on the follwing logs:

kms_1  | 0:00:37.804157413     1 0x7fdfd80020f0 DEBUG               GST_PADS gstpad.c:3910:gst_pad_query:<aspectratiocrop0:src> doing query 0x7fdfcc044540 (caps)
kms_1  | 0:00:37.804195187     1 0x7fdfd80020f0 DEBUG               GST_PADS gstpad.c:3933:gst_pad_query:<aspectratiocrop0:src> sent query 0x7fdfcc044540 (caps), result 1
kms_1  | 0:00:37.804198147     1 0x7fdfd80020f0 DEBUG               GST_CAPS gstutils.c:2847:gst_pad_query_caps:<aspectratiocrop0:src> query returned EMPTY
kms_1  | 0:00:37.804290893     1 0x7fdfd80020f0 DEBUG               GST_CAPS gstpad.c:2213:gst_pad_link_check_compatible_unlocked:<aspectratiocrop0:src> src caps EMPTY
kms_1  | 0:00:37.804310310     1 0x7fdfd80020f0 INFO                GST_PADS gstpad.c:2462:gst_pad_link_full: link between aspectratiocrop0:src and kmsfilterelement0_kmsagnosticbin2-0:sink failed: no common format

Does that make sense? Does this switch any light by you on how to make it work? I would be open to create a PR if I am able to do it.

Thanks in advance

alex1712 avatar Nov 25 '22 07:11 alex1712