Change resolution on the fly

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

Change resolution on the fly

张若
Hi,

I have checked some relative information about changing resolution on the fly in past gstreamer-delevel (the links is here):

What I want to do is using the camera to capture a relative high resolution video, then change the resolution to a proper one before streaming while udp/rtp.

I have done the part from camera capture and streaming like this:

imxv4l2videosrc -> capsfilter1 -> videoscale -> capsfilter2 -> imxvpuenc_h264 -> h264parse -> rtph264pay -> udpsink

By this I can display the video with the resolution set in capsfilter2.

But I am not sure how to change the resolution at any time while the pipeline is running (need the continuous real time camera capture video) by resetting the capsfilter2?

Thanks in advance!

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

Re: Change resolution on the fly

Sebastian Dröge-3
On Sun, 2016-09-25 at 14:48 +0200, 张若 wrote:

> Hi,
>
> I have checked some relative information about changing resolution on
> the fly in past gstreamer-delevel (the links is here):
> http://gstreamer-devel.966125.n4.nabble.com/dynamic-change-element-s-
> parameter-td2536123.html
>
> What I want to do is using the camera to capture a relative high
> resolution video, then change the resolution to a proper one before
> streaming while udp/rtp.
>
> I have done the part from camera capture and streaming like this:
>
> imxv4l2videosrc -> capsfilter1 -> videoscale -> capsfilter2 ->
> imxvpuenc_h264 -> h264parse -> rtph264pay -> udpsink
>
> By this I can display the video with the resolution set in
> capsfilter2.
>
> But I am not sure how to change the resolution at any time while the
> pipeline is running (need the continuous real time camera capture
> video) by resetting the capsfilter2?
You can just change the "caps" property on that second capsfilter at
any time you want.

You might also want to change the "caps-change-mode" property to
"delayed" though.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (949 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Change resolution on the fly

张若
Sorry, I am a new comer to gstreamer.
I am not sure where can I change the caps of the second filter? Because the pipeline is running.
On the terminal or in the c file ?

Thanks

2016-09-26 8:24 GMT+02:00 Sebastian Dröge <[hidden email]>:
On Sun, 2016-09-25 at 14:48 +0200, 张若 wrote:
> Hi,
>
> I have checked some relative information about changing resolution on
> the fly in past gstreamer-delevel (the links is here):
> http://gstreamer-devel.966125.n4.nabble.com/dynamic-change-element-s-
> parameter-td2536123.html
>
> What I want to do is using the camera to capture a relative high
> resolution video, then change the resolution to a proper one before
> streaming while udp/rtp.
>
> I have done the part from camera capture and streaming like this:
>
> imxv4l2videosrc -> capsfilter1 -> videoscale -> capsfilter2 ->
> imxvpuenc_h264 -> h264parse -> rtph264pay -> udpsink
>
> By this I can display the video with the resolution set in
> capsfilter2.
>
> But I am not sure how to change the resolution at any time while the
> pipeline is running (need the continuous real time camera capture
> video) by resetting the capsfilter2?

You can just change the "caps" property on that second capsfilter at
any time you want.

You might also want to change the "caps-change-mode" property to
"delayed" though.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com

_______________________________________________
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: Change resolution on the fly

Sebastian Dröge-3
On Mon, 2016-09-26 at 09:06 +0200, 张若 wrote:
> Sorry, I am a new comer to gstreamer.
> I am not sure where can I change the caps of the second filter?
> Because the pipeline is running.
> On the terminal or in the c file ?

Inside the code. You should already have some code there that calls
g_object_set() to set the caps property, just call it again when you
want the resolution to be changed.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (949 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Change resolution on the fly

张若
So I just add another g_objext_set () later there to change?
But when will it change?
My goal is when the pipeline is running, at some time I want to change the resolution for streaming, then it changes.

2016-09-26 9:15 GMT+02:00 Sebastian Dröge <[hidden email]>:
On Mon, 2016-09-26 at 09:06 +0200, 张若 wrote:
> Sorry, I am a new comer to gstreamer.
> I am not sure where can I change the caps of the second filter?
> Because the pipeline is running.
> On the terminal or in the c file ?

Inside the code. You should already have some code there that calls
g_object_set() to set the caps property, just call it again when you
want the resolution to be changed.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com

_______________________________________________
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: Change resolution on the fly

Sebastian Dröge-3
On Mon, 2016-09-26 at 09:21 +0200, 张若 wrote:
> So I just add another g_objext_set () later there to change?
> But when will it change?
> My goal is when the pipeline is running, at some time I want to
> change the resolution for streaming, then it changes.

On the next video frame in your specific pipeline.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (949 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Change resolution on the fly

张若
Yes, I know.

But my problem is:
I have a c code file (change_resolution.c). I use the g_object_set () to set the original resolution inside. Then I compile the file and run it.
While the pipeline is running (receive the camera capture in client side), how can I change the resolution?
As you said, just call the function g_object_set () again to change the "caps" in the c code file while running? Is it possible?

Maybe it is a stupid question, but that is the main question and problem i have.



2016-09-26 9:24 GMT+02:00 Sebastian Dröge <[hidden email]>:
On Mon, 2016-09-26 at 09:21 +0200, 张若 wrote:
> So I just add another g_objext_set () later there to change?
> But when will it change?
> My goal is when the pipeline is running, at some time I want to
> change the resolution for streaming, then it changes.

On the next video frame in your specific pipeline.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com

_______________________________________________
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: Change resolution on the fly

bobsaccamano
Hi,

I'm facing a similar problem: my pipeline is:
 v4l2src --> capsfilter1 --> nvvidconv --> videoscale --> capsfilter2 -->
enc --> parse --> rtppay --> udpsink.  

It seems to be working from gst-launch. When I use g_object_set on
capsfilter2 I cannot use gst_caps_new_simple as I am changing the image
format to NVMM (Nvidia)) after nvvidconv. Instead I use gst_caps_from_string
for capsfilter2 modification. However, now there is no way to set NVMM
memory with gst_caps_new_simple. See the issue  here
<https://devtalk.nvidia.com/default/topic/934515/using-x-raw-memory-nvmm-in-gstreamer-program/>
.

Any help is much appreciated.

~Bob



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

Re: Change resolution on the fly

Nicolas Dufresne-5
Le mardi 21 janvier 2020 à 17:43 -0600, bobsaccamano a écrit :

> Hi,
>
> I'm facing a similar problem: my pipeline is:
>  v4l2src --> capsfilter1 --> nvvidconv --> videoscale --> capsfilter2 -->
> enc --> parse --> rtppay --> udpsink.  
>
> It seems to be working from gst-launch. When I use g_object_set on
> capsfilter2 I cannot use gst_caps_new_simple as I am changing the image
> format to NVMM (Nvidia)) after nvvidconv. Instead I use gst_caps_from_string
> for capsfilter2 modification. However, now there is no way to set NVMM
> memory with gst_caps_new_simple. See the issue  here
> <
> https://devtalk.nvidia.com/default/topic/934515/using-x-raw-memory-nvmm-in-gstreamer-program/

No way ?

  caps = gst_caps_new_simple ("video/x-raw", "width", G_TYPE_INT, 1280,
                                             "height", G_TYPE_INT, 720,
                                             NULL);
  features = gst_caps_get_features (caps, 0);
  gst_caps_features_add (featurs, "memory:NVMM");
  g_object_set (capsfilter, "caps", cpas, NULL);

> >
> .
>
> Any help is much appreciated.
>
> ~Bob
>
>
>
> --
> Sent from: http://gstreamer-devel.966125.n4.nabble.com/
> _______________________________________________
> 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: Change resolution on the fly

bobsaccamano
In reply to this post by 张若
Hi,

I'm facing a similar problem: my pipeline is:
 v4l2src --> capsfilter1 --> nvvidconv --> videoscale --> capsfilter2 -->
enc --> parse --> rtppay --> udpsink.  

It seems to be working from gst-launch. When I use g_object_set on
capsfilter2 I cannot use gst_caps_new_simple as I am changing the image
format to NVMM (Nvidia)) after nvvidconv. Instead I use gst_caps_from_string
for capsfilter2 modification. However, now there is no way to set NVMM
memory with gst_caps_new_simple. See the issue  here
<https://devtalk.nvidia.com/default/topic/934515/using-x-raw-memory-nvmm-in-gstreamer-program/>
.

Any help is much appreciated.

~Bob



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

Re: Change resolution on the fly

bobsaccamano
In reply to this post by Nicolas Dufresne-5
Thanks Nicolas!

I tried that, and the pipeline is running. However, after the resolution
change the streaming stops i.e. the receiver (running with udpsrc) no longer
displays video. I dont see any errors in the receiver side and the
transmitter side gives no indication of streaming being halted.

Pastebin of the sender side log excerpt: https://pastebin.com/a5Q8B9JT

How can I debug the issue here?

Thanks,
B



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel