Discussion:
Frame resolution settings in gstreamer pipeline
Mohammad, Jamal M
2018-02-02 04:37:10 UTC
Permalink
Hi Guys,

I am streaming my laptop screen on my IP based display using gstreamer.
Here is the pipeline on both ends:

Laptop:
C:\gstreamer\1.0\x86_64\bin\gst-launch-1.0.exe -v dx9screencapsrc ! queue ! videoconvert ! x264enc ! "video/x-h264,profile=baseline" ! h264parse config-interval=-1 ! rtph264pay pt=96 config-interval=-1 ! udpsink host=<ipaddr> port=5004 sync=true

IP Display:

gst-launch -v udpsrc port=5004 ! application/x-rtp, payload=96 ! rtph264depay ! vpudec low-latency=true ! imxv4l2sink sync=false

The problem is IP Display resolution is 1024x768 but the source plugin is generating 1920x1080, which is my laptop resolution..

I need to convert this to the resolution of IP Display, I modified the pipeline on the laptop to following:
C:\gstreamer\1.0\x86_64\bin\gst-launch-1.0.exe -v dx9screencapsrc ! video/x-raw, width=1024,height=768,framerate=30/1 !queue ! videoconvert ! x264enc ! "video/x-h264,profile=baseline" ! h264parse config-interval=-1 ! rtph264pay pt=96 config-interval=-1 ! udpsink host=<IPAddress> port=5004 sync=true

It fails with the following error:
WARNING: erroneous pipeline: could not link dx9screencapsrc0 to queue0, dx9screencapsrc0 can't handle caps video/x-raw, width=(int)1024, height=(int)768, framerate=(fraction)30/1

Looking at the caps of dx9screencapsrc using gst-inspect-1.0, it has cap for width and height.
How can I acheive my requirement of capturing the whole screen but converting it to 1024x768

Thanks,
Mohammad Jamal Mohiuddin
Software Engineer, Retail Hosp/HW
NCR Corporation India Pvt Ltd.
***@ncr.com<mailto:***@ncr.com> | www.ncr.com<http://www.ncr.com>
<< OLE Object: Picture (Device Independent Bitmap) >>
aasim
2018-02-02 06:23:57 UTC
Permalink
Hi Mohammed,

This was my link when i was using Tx2 hardware , you can modify your command
based on this

gst-launch-1.0 nvcamerasrc sensor-id=0 ! queue !
'video/x-raw(memory:NVMM),width=1280, height=720, format=NV12' ! omxh264enc
bitrate=3000000 control-rate=2 ! 'video/x-h264,
streamformat=(string)byte-stream' ! h264parse ! flvmux name=mux alsasrc
device=plughw:1 ! audioresample ! audio/x-raw,rate=48000,channels=1 ! queue
! voaacenc bitrate=32000 ! queue ! mux. mux. ! queue ! rtmpsink
location='rtmp://192.168.1.236:1935/live/102'





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
Mohammad, Jamal M
2018-02-02 06:35:23 UTC
Permalink
I got error.

C:\Windows\System32>C:\gstreamer\1.0\x86_64\bin\gst-launch-1.0.exe -v dx9screencapsrc ! queue ! 'video/x-raw,width=1024,height=768' ! videoconvert ! x264enc ! "video/x-h264,profile=baseline" ! h264parse config-interval=-1 ! rtph264pay pt=96 config-interval=-1 ! udpsink host=153.77.205.139 port=5009 sync=true

(gst-launch-1.0:10452): GStreamer-CRITICAL **: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
WARNING: erroneous pipeline: syntax error

-----Original Message-----
From: gstreamer-devel [mailto:gstreamer-devel-***@lists.freedesktop.org] On Behalf Of aasim
Sent: Friday, February 02, 2018 11:54 AM
To: gstreamer-***@lists.freedesktop.org
Subject: Re: Frame resolution settings in gstreamer pipeline

Hi Mohammed,

This was my link when i was using Tx2 hardware , you can modify your command based on this

gst-launch-1.0 nvcamerasrc sensor-id=0 ! queue !
'video/x-raw(memory:NVMM),width=1280, height=720, format=NV12' ! omxh264enc
bitrate=3000000 control-rate=2 ! 'video/x-h264, streamformat=(string)byte-stream' ! h264parse ! flvmux name=mux alsasrc
device=plughw:1 ! audioresample ! audio/x-raw,rate=48000,channels=1 ! queue ! voaacenc bitrate=32000 ! queue ! mux. mux. ! queue ! rtmpsink location='rtmp://192.168.1.236:1935/live/102'
--
Sent from: https://urldefense.proofpoint.com/v2/url?u=http-3A__gstreamer-2Ddevel.966125.n4.nabble.com_&d=DwIGaQ&c=gJN2jf8AyP5Q6Np0yWY19w&r=HoPNfXl6KDHgz0TaiQjVDg&m=sklaskU7KJ6p3REakQyi_8l3LOFkCvgIOPJLrjp_2cI&s=3LQttvyVhDWHQp-waw6GRdDTTAVMR-V0jkAdW7QMDjo&e=
_______________________________________________
gstreamer-devel mailing list
gstreamer-***@lists.freedesktop.org
https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.freedesktop.org_mailman_listinfo_gstreamer-2Ddevel&d=DwIGaQ&c=gJN2jf8AyP5Q6Np0yWY19w&r=HoPNfXl6KDHgz0TaiQjVDg&m=sklaskU7KJ6p3REakQyi_8l3LOFkCvgIOPJLrjp_2cI&s=ybL9WonaPp0ZHb9rKeMNxWIIyP0Oum2-LdkAmmaNC-4&e=
Antonio Ospite
2018-02-02 09:41:06 UTC
Permalink
On Fri, 2 Feb 2018 04:37:10 +0000
Post by Mohammad, Jamal M
Hi Guys,
I am streaming my laptop screen on my IP based display using gstreamer.
C:\gstreamer\1.0\x86_64\bin\gst-launch-1.0.exe -v dx9screencapsrc ! queue ! videoconvert ! x264enc ! "video/x-h264,profile=baseline" ! h264parse config-interval=-1 ! rtph264pay pt=96 config-interval=-1 ! udpsink host=<ipaddr> port=5004 sync=true
[...]
Post by Mohammad, Jamal M
C:\gstreamer\1.0\x86_64\bin\gst-launch-1.0.exe -v dx9screencapsrc ! video/x-raw, width=1024,height=768,framerate=30/1 !queue ! videoconvert ! x264enc ! "video/x-h264,profile=baseline" ! h264parse config-interval=-1 ! rtph264pay pt=96 config-interval=-1 ! udpsink host=<IPAddress> port=5004 sync=true
WARNING: erroneous pipeline: could not link dx9screencapsrc0 to queue0, dx9screencapsrc0 can't handle caps video/x-raw, width=(int)1024, height=(int)768, framerate=(fraction)30/1
Looking at the caps of dx9screencapsrc using gst-inspect-1.0, it has cap for width and height.
How can I acheive my requirement of capturing the whole screen but converting it to 1024x768
The dx9screencapsrc element may define caps for width and height, but
your instance only accepts some values for it, you should see the values
in the output of "gst-launch-1.0 -v" if you look close enough.

So requesting invalid values on the source element will make caps
negotiation to fail.

What you really want to do here is to *resize* the captured 1920x1080
frame down to 1024x768 before encoding it, and that can be done with
the videoscale element:

gst-launch-1.0.exe -v dx9screencapsrc ! queue ! videoconvert ! videoscale ! video/x-raw,width=1024,height=768 ! x264enc ...

Ciao,
Antonio
--
Antonio Ospite
https://ao2.it
https://twitter.com/ao2it

A: Because it messes up the order in which people normally read text.
See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
Mohammad, Jamal M
2018-02-02 09:50:53 UTC
Permalink
Thanks for your help..

The caps has changed to 1024,768 but the display is not full screen.

-----Original Message-----
From: Antonio Ospite [mailto:***@ao2.it]
Sent: Friday, February 02, 2018 3:11 PM
To: gstreamer-***@lists.freedesktop.org
Cc: Mohammad, Jamal M <***@ncr.com>
Subject: Re: Frame resolution settings in gstreamer pipeline

On Fri, 2 Feb 2018 04:37:10 +0000
Post by Mohammad, Jamal M
Hi Guys,
I am streaming my laptop screen on my IP based display using gstreamer.
C:\gstreamer\1.0\x86_64\bin\gst-launch-1.0.exe -v dx9screencapsrc !
queue ! videoconvert ! x264enc ! "video/x-h264,profile=baseline" !
h264parse config-interval=-1 ! rtph264pay pt=96 config-interval=-1 !
udpsink host=<ipaddr> port=5004 sync=true
[...]
Post by Mohammad, Jamal M
C:\gstreamer\1.0\x86_64\bin\gst-launch-1.0.exe -v dx9screencapsrc !
video/x-raw, width=1024,height=768,framerate=30/1 !queue !
videoconvert ! x264enc ! "video/x-h264,profile=baseline" ! h264parse
config-interval=-1 ! rtph264pay pt=96 config-interval=-1 ! udpsink
host=<IPAddress> port=5004 sync=true
WARNING: erroneous pipeline: could not link dx9screencapsrc0 to
queue0, dx9screencapsrc0 can't handle caps video/x-raw,
width=(int)1024, height=(int)768, framerate=(fraction)30/1
Looking at the caps of dx9screencapsrc using gst-inspect-1.0, it has cap for width and height.
How can I acheive my requirement of capturing the whole screen but
converting it to 1024x768
The dx9screencapsrc element may define caps for width and height, but your instance only accepts some values for it, you should see the values in the output of "gst-launch-1.0 -v" if you look close enough.

So requesting invalid values on the source element will make caps negotiation to fail.

What you really want to do here is to *resize* the captured 1920x1080 frame down to 1024x768 before encoding it, and that can be done with the videoscale element:

gst-launch-1.0.exe -v dx9screencapsrc ! queue ! videoconvert ! videoscale ! video/x-raw,width=1024,height=768 ! x264enc ...

Ciao,
Antonio

--
Antonio Ospite
https://urldefense.proofpoint.com/v2/url?u=https-3A__ao2.it&d=DwICAg&c=gJN2jf8AyP5Q6Np0yWY19w&r=4h__2a8-7N65qoDnmtsyGh_QYq3kPCn-Loy2L0LHnCs&m=kCnVF3RJC-HQMatVBVA0ElpzZ6jvmU-gTyjHhjKH95A&s=6YX4r3Vzk51QYD59fwOIklf7Pzz2pkc3D9m2TT5suDU&e=
https://urldefense.proofpoint.com/v2/url?u=https-3A__twitter.com_ao2it&d=DwICAg&c=gJN2jf8AyP5Q6Np0yWY19w&r=4h__2a8-7N65qoDnmtsyGh_QYq3kPCn-Loy2L0LHnCs&m=kCnVF3RJC-HQMatVBVA0ElpzZ6jvmU-gTyjHhjKH95A&s=Jxjd0777746yBGcgWNzF0vKTAj-fh6vgNLb6X2Fyey0&e=

A: Because it messes up the order in which people normally read text.
See https://urldefense.proofpoint.com/v2/url?u=http-3A__en.wikipedia.org_wiki_Posting-5Fstyle&d=DwICAg&c=gJN2jf8AyP5Q6Np0yWY19w&r=4h__2a8-7N65qoDnmtsyGh_QYq3kPCn-Loy2L0LHnCs&m=kCnVF3RJC-HQMatVBVA0ElpzZ6jvmU-gTyjHhjKH95A&s=xTS5sZAKaR_th2MAfIb8NWqEcVe333OPy5wOLm7octw&e=
Q: Why is top-posting such a bad thing?
Antonio Ospite
2018-02-02 10:22:39 UTC
Permalink
On Fri, 2 Feb 2018 09:50:53 +0000
Post by Mohammad, Jamal M
Thanks for your help..
The caps has changed to 1024,768 but the display is not full screen.
Do you mean that you see borders around the picture?
Or do you see only a part of the captured screen?

If it's the former it's just that 1920x1080 is 16:9 while 1024x768 is
4:3, and videoscale adds borders by default.

Ciao,
Antonio
--
Antonio Ospite
https://ao2.it
https://twitter.com/ao2it

A: Because it messes up the order in which people normally read text.
See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
Mohammad, Jamal M
2018-02-02 10:55:04 UTC
Permalink
There is no cropping, I get borders. It means 16:9?

-----Original Message-----
From: Antonio Ospite [mailto:***@ao2.it]
Sent: Friday, February 02, 2018 3:53 PM
To: gstreamer-***@lists.freedesktop.org
Cc: Mohammad, Jamal M <***@ncr.com>
Subject: Re: Frame resolution settings in gstreamer pipeline

On Fri, 2 Feb 2018 09:50:53 +0000
Post by Mohammad, Jamal M
Thanks for your help..
The caps has changed to 1024,768 but the display is not full screen.
Do you mean that you see borders around the picture?
Or do you see only a part of the captured screen?

If it's the former it's just that 1920x1080 is 16:9 while 1024x768 is 4:3, and videoscale adds borders by default.

Ciao,
Antonio

--
Antonio Ospite
https://urldefense.proofpoint.com/v2/url?u=https-3A__ao2.it&d=DwICAg&c=gJN2jf8AyP5Q6Np0yWY19w&r=4h__2a8-7N65qoDnmtsyGh_QYq3kPCn-Loy2L0LHnCs&m=pBwnVracLf2Au44w3HUDEPG1majpDR2UsczNuwj1kKw&s=zP1x4WVqxylXZJ4x66LsDKWpVdjsJ2U87qGif3qW9r4&e=
https://urldefense.proofpoint.com/v2/url?u=https-3A__twitter.com_ao2it&d=DwICAg&c=gJN2jf8AyP5Q6Np0yWY19w&r=4h__2a8-7N65qoDnmtsyGh_QYq3kPCn-Loy2L0LHnCs&m=pBwnVracLf2Au44w3HUDEPG1majpDR2UsczNuwj1kKw&s=1z-VMJQk7z_7USSVlJsA_OUA6r-esW1MNRfdx1xZMJ8&e=

A: Because it messes up the order in which people normally read text.
See https://urldefense.proofpoint.com/v2/url?u=http-3A__en.wikipedia.org_wiki_Posting-5Fstyle&d=DwICAg&c=gJN2jf8AyP5Q6Np0yWY19w&r=4h__2a8-7N65qoDnmtsyGh_QYq3kPCn-Loy2L0LHnCs&m=pBwnVracLf2Au44w3HUDEPG1majpDR2UsczNuwj1kKw&s=_CojgZH4xjUdxTUnsCdXC7NkEE_Uv5Q9GwjIHh4sHF0&e=
Q: Why is top-posting such a bad thing?

Loading...