problems resizing video stream from c++

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

problems resizing video stream from c++

Blaine Bell
my gst-launch-1.0 commands are like this:

gst-launch-1.0 udpsrc port=8009 caps = "application/x-rtp,
media=(string)video, clock-rate=(int)90000, encoding-name=(string)VP8" !
rtpvp8depay ! vp8dec ! videoconvert ! videoscale ! video/x-raw,width=100
! autovideosink

This works perfectly.  But when I try to setup this stream in c++ (with
slightly different output, I want to read images), it fails to go into
PLAYING state.  I am having trouble debugging this, but have isolated it
to attaching the caps using gst_element_link_filtered between the
videoscale and next element (which from c++ is the jpegenc, but have
also tried another videoconvert GstElement).  These all fail.

To be clear, I setup the videoconvert and videoscale element, and the
element after like this:

   videoconvert1 = gst_element_factory_make("videoconvert", "convert1");
   videoscale = gst_element_factory_make("videoscale", "scale");
   jpegenc = gst_element_factory_make("jpegenc", "myenc");

then after the command:

   gst_bin_add_many (GST_BIN (pipeline), src, ....., videoconvert1,
videoscale, jpegenc, ...., NULL);

I create the caps:

   caps = gst_caps_from_string("video/x-raw,width=100");

then use the gst_element_link_filtered() to connect the caps to the
pipeline:

   gst_element_link_filtered(videoscale, jpegenc, caps);

I have tried many versions and combinations of this, but cannot get the
resize to work.  Can someone help explain to me how to resize this video
feed from C++?

Thanks in advance,

Blaine

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

Re: problems resizing video stream from c++

Blaine Bell
figured it out.  need to use a capsfilter as an element explicitly in
the pipeline.  oddly enough, it behaves slightly differently:  if the
width is the only parameter specified, then it does not resize the
height according to the aspect ratio.  In the below gst-launch-1.0, the
aspect ratio is kept the same.

Blaine


On 08/31/2017 10:17 PM, Blaine Bell wrote:

> my gst-launch-1.0 commands are like this:
>
> gst-launch-1.0 udpsrc port=8009 caps = "application/x-rtp,
> media=(string)video, clock-rate=(int)90000, encoding-name=(string)VP8"
> ! rtpvp8depay ! vp8dec ! videoconvert ! videoscale !
> video/x-raw,width=100 ! autovideosink
>
> This works perfectly.  But when I try to setup this stream in c++
> (with slightly different output, I want to read images), it fails to
> go into PLAYING state.  I am having trouble debugging this, but have
> isolated it to attaching the caps using gst_element_link_filtered
> between the videoscale and next element (which from c++ is the
> jpegenc, but have also tried another videoconvert GstElement).  These
> all fail.
>
> To be clear, I setup the videoconvert and videoscale element, and the
> element after like this:
>
>   videoconvert1 = gst_element_factory_make("videoconvert", "convert1");
>   videoscale = gst_element_factory_make("videoscale", "scale");
>   jpegenc = gst_element_factory_make("jpegenc", "myenc");
>
> then after the command:
>
>   gst_bin_add_many (GST_BIN (pipeline), src, ....., videoconvert1,
> videoscale, jpegenc, ...., NULL);
>
> I create the caps:
>
>   caps = gst_caps_from_string("video/x-raw,width=100");
>
> then use the gst_element_link_filtered() to connect the caps to the
> pipeline:
>
>   gst_element_link_filtered(videoscale, jpegenc, caps);
>
> I have tried many versions and combinations of this, but cannot get
> the resize to work.  Can someone help explain to me how to resize this
> video feed from C++?
>
> Thanks in advance,
>
> Blaine
>

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