how to get the video resolution from pipeline

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

how to get the video resolution from pipeline

zhi
Hi guys,

I am newbin to gstreamer, and want to know how to get the video resolution (width,height) from pipeline as below:

GstElement *pipeline = gst_parse_launch("rtspsrc name=src latency=0 ! decodebin name=dec ! appsink name=sink", &error);

when receiving the video data from appsink (new-sample), i need to know the resolution of video go ahead!

I have tried to research the signal of decodebin, and don't know how to do.

thanks in advance
-zhi


 


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

Re: how to get the video resolution from pipeline

Florian Zwoch
In your sample callback try something like this:

gint width;
gint height;

GstSample* sample = gst_app_sink_pull_sample (appsink);
GstBuffer* buffer = gst_sample_get_buffer (sample);
GstCaps* caps = gst_sample_get_caps (sample);
GstStructure* structure = gst_caps_get_structure (caps, 0);

gst_structure_get_int (structure, "width", &width);
gst_structure_get_int (structure, "height", &height);

g_print ("video size is %dx%d\n", width, height);

gst_sample_unref (sample);

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

Re: how to get the video resolution from pipeline

brizio
In reply to this post by zhi
Hi there!

I am not an expert, but I had the same problem and maybe this can be of some help to you. Look here:

Hope that helps!
regards
Fabrizio


On Tue, Feb 6, 2018 at 1:23 PM, zhi <[hidden email]> wrote:
Hi guys,

I am newbin to gstreamer, and want to know how to get the video resolution (width,height) from pipeline as below:

GstElement *pipeline = gst_parse_launch("rtspsrc name=src latency=0 ! decodebin name=dec ! appsink name=sink", &error);

when receiving the video data from appsink (new-sample), i need to know the resolution of video go ahead!

I have tried to research the signal of decodebin, and don't know how to do.

thanks in advance
-zhi


 


_______________________________________________
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