question about raspberry camera video straming with gstreamer

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

question about raspberry camera video straming with gstreamer

apostolis paraschoudis
Hello,

Unfortunately I am not an advanced user with raspberries , Gstreamer and networks and I couldn't find a solution to my problem in several forums (i couldn't find any dedicated forum for Gstreamer ! ) . 
I am trying to transmit video from my rapsberry camera (connected to RPI 3 B+) to my windows laptop through gstreamer.


In my laptop i give the command :
gst-launch-1.0.exe -v udpsrc port=5600 caps=“application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264” ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=f

and on my raspberry the command:
raspivid -n -w 1280 -h 720 -b 1000000 -fps 15 -t 0 -o - | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=10 pt=96 ! udpsink host=xxx.xxx.xxx.xxx port=5600

With these commands i am able to transmit the video succesfully…However i get many lost frames and a pixelized video,so when the camera is moving the image is blurry due to dropped frames
Gstreamer parameters and options are endless and after a lot of searching i couldn't achieve a better solution. I just got more confused..

Could you advise me the commands i should use to raspberry and laptop in order to achieve a clean video streaming without dropped frames ?
I would really appreciate any advise that would make possible to stream video without any dropped frames


Thanks a lot 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: question about raspberry camera video straming with gstreamer

Sebastian Dröge-3
On Thu, 2020-05-07 at 22:13 +0300, apostolis paraschoudis wrote:

> Hello,
>
> Unfortunately I am not an advanced user with raspberries , Gstreamer
> and networks and I couldn't find a solution to my problem in several
> forums (i couldn't find any dedicated forum for Gstreamer ! ) .
> I am trying to transmit video from my rapsberry camera (connected to
> RPI 3 B+) to my windows laptop through gstreamer.
>
> In my laptop i give the command :
> gst-launch-1.0.exe -v udpsrc port=5600 caps=“application/x-rtp,
> media=(string)video, clock-rate=(int)90000, encoding-
> name=(string)H264” ! rtph264depay ! avdec_h264 ! videoconvert !
> autovideosink sync=f
>
> and on my raspberry the command:
> raspivid -n -w 1280 -h 720 -b 1000000 -fps 15 -t 0 -o - | gst-launch-
> 1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=10 pt=96 !
> udpsink host=xxx.xxx.xxx.xxx port=5600
There are two things to improve here, on both sides.

For the receiver, can you add an `rtpjitterbuffer` element between the
`udpsrc` and the `rtph264depay`? That would allow for some buffering,
fix up packet reordering and create more useful timestamps, among other
things.

On the sender side I would recommend using the `rpicamsrc` element from
  https://github.com/thaytan/gst-rpicamsrc
instead of piping the `raspivid` output to `gst-launch-1.0`. That's
going to work more robust and reliable, and also provide better
timestamp and other metadata to GStreamer.

Once changing that it should work better, maybe already well enough.

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

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

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

Re: question about raspberry camera video straming with gstreamer

apostolis paraschoudis
Dear Sebastian,

thanks for your responses.. I hope you are enjoying your time here especially now that it is like summer.. 
I'm just trying to accomplish a video streaming between raspberry camera and a computer without much latency and without having dropped frames and pixelated images.. The video streaming will be between a drone (raspberry is on the drone) and a computer so i need a clean image without a lot of latency..

I'm not familiar with gstreamer at all.. I have no programming experience.. So its more difficult for me to achieve my goal.. I just search  over the internet and try several commands other people have used so far until i find one that works adequately.. 

So after searching i found the github page of a guy named Jan Schmidt which as far as i understood he works for gstreamer.. And raspicamsrc that you proposed, can be found on his github page and i have already installed it.. That guy Jan, after he saw how i am currently streaming video (same commands that i told you in my previous email) ,he proposed me to use the SRT protocol. Yesterday he replied to me saying:

Without some kind of retransmission, packet loss will always cause trouble like that. You need to switch away from a raw RTP stream, really.
If you have a recent enough GStreamer available, look at using the SRT protocol for streaming instead.

So yesterday i searched how i can do video streaming with raspberry camera using gstreamer with SRT protocol.. And luckily i found a guy in github that has already done exactly what i want to do.. His page  https://github.com/PietroAvolio/Building-Gstreamer-Raspberry-Pi-With-SRT-Support

So i followed his instructions which are quite straightforward even for novice users and i was almost sure that finally i will make things work. He actually says to install SRT from the SRT github page, then execute a script that installs several Gstreamer things and then install the RPICAMSRC element. After doing all these, once i give in raspberry the command:

gst-launch-1.0 -v rpicamsrc preview=true sensor-mode=5 bitrate=8000000! video/x-h264,width=1640,height=922,framerate=40/1,profile=baseline ! mpegtsmux ! srtsink uri=srt://:8888

I get the error   WARNING: erroneous pipeline: no element "srtsink"


As far as I understood i am close to make it run, I just feel that the Gstreamer cannot see the srtsink plugin , although I followed the instructions to install SRT. I guess Gstreamer is looking for srtsink in different locations than where SRT is actually installed. When i run   gst-inspect-1.0 srt  , i get no results.. When i run   gst-inspect-1.0 x264   i get results for this plugin and for several other plugins i tried.   

DO you know how can i fix this  ??  Probably its something easy and i just dont know how to fix it.. How to make  Gstreamer see the srt  plugin.. 

Unfortunately , i cannot contact that guy that wrote this process with Raspberry camera, srt and gstreamer.. I cannot find his email..


I would really appreaciate if you could propose any fix for this .. Thanks a lot


Best Regards,




On Fri, May 8, 2020 at 12:05 PM Sebastian Dröge <[hidden email]> wrote:
On Thu, 2020-05-07 at 22:13 +0300, apostolis paraschoudis wrote:
> Hello,
>
> Unfortunately I am not an advanced user with raspberries , Gstreamer
> and networks and I couldn't find a solution to my problem in several
> forums (i couldn't find any dedicated forum for Gstreamer ! ) .
> I am trying to transmit video from my rapsberry camera (connected to
> RPI 3 B+) to my windows laptop through gstreamer.
>
> In my laptop i give the command :
> gst-launch-1.0.exe -v udpsrc port=5600 caps=“application/x-rtp,
> media=(string)video, clock-rate=(int)90000, encoding-
> name=(string)H264” ! rtph264depay ! avdec_h264 ! videoconvert !
> autovideosink sync=f
>
> and on my raspberry the command:
> raspivid -n -w 1280 -h 720 -b 1000000 -fps 15 -t 0 -o - | gst-launch-
> 1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=10 pt=96 !
> udpsink host=xxx.xxx.xxx.xxx port=5600

There are two things to improve here, on both sides.

For the receiver, can you add an `rtpjitterbuffer` element between the
`udpsrc` and the `rtph264depay`? That would allow for some buffering,
fix up packet reordering and create more useful timestamps, among other
things.

On the sender side I would recommend using the `rpicamsrc` element from
  https://github.com/thaytan/gst-rpicamsrc
instead of piping the `raspivid` output to `gst-launch-1.0`. That's
going to work more robust and reliable, and also provide better
timestamp and other metadata to GStreamer.

Once changing that it should work better, maybe already well enough.

--
Sebastian Dröge, Centricular Ltd · https://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: question about raspberry camera video straming with gstreamer

apostolis paraschoudis
I also tried to add the  rtpjitterbuffer  on my laptop (receiver)  so that the command  was  C:\gstreamer\1.0\x86_64\bin\gst-launch-1.0.exe -v udpsrc port=5600 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264" ! rtpjitterbuffer ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=f   
And on my raspberry i tried the raspicamsrc as you proposed so that the command is  gst-launch-1.0 rpicamsrc bitrate=1000000 ! 'video/x-h264,width=640,height=480,framerate=25/1,profile=baseline' ! h264parse  ! rtph264pay config-interval=1 pt=96 ! udpsink host=xxx.xxx.xxx.xxx port=5600
I don't know what timestamps and metadata are and how and which ones i should provide. So with those commands  i still got dropped frames and pixelized images..

I think my priority would be to make it work with the SRT protocol..As far as i have read, they say it provides very nice performance. I feel i am too close.. It's just that i don't know how to make gstreamer find the SRT libraries although they are already installed..

I also read now that there was a Gstreamer conference that took place in Thessaloniki.. :)

Thank you


On Fri, May 8, 2020 at 8:05 PM apostolis paraschoudis <[hidden email]> wrote:
Dear Sebastian,

thanks for your responses.. I hope you are enjoying your time here especially now that it is like summer.. 
I'm just trying to accomplish a video streaming between raspberry camera and a computer without much latency and without having dropped frames and pixelated images.. The video streaming will be between a drone (raspberry is on the drone) and a computer so i need a clean image without a lot of latency..

I'm not familiar with gstreamer at all.. I have no programming experience.. So its more difficult for me to achieve my goal.. I just search  over the internet and try several commands other people have used so far until i find one that works adequately.. 

So after searching i found the github page of a guy named Jan Schmidt which as far as i understood he works for gstreamer.. And raspicamsrc that you proposed, can be found on his github page and i have already installed it.. That guy Jan, after he saw how i am currently streaming video (same commands that i told you in my previous email) ,he proposed me to use the SRT protocol. Yesterday he replied to me saying:

Without some kind of retransmission, packet loss will always cause trouble like that. You need to switch away from a raw RTP stream, really.
If you have a recent enough GStreamer available, look at using the SRT protocol for streaming instead.

So yesterday i searched how i can do video streaming with raspberry camera using gstreamer with SRT protocol.. And luckily i found a guy in github that has already done exactly what i want to do.. His page  https://github.com/PietroAvolio/Building-Gstreamer-Raspberry-Pi-With-SRT-Support

So i followed his instructions which are quite straightforward even for novice users and i was almost sure that finally i will make things work. He actually says to install SRT from the SRT github page, then execute a script that installs several Gstreamer things and then install the RPICAMSRC element. After doing all these, once i give in raspberry the command:

gst-launch-1.0 -v rpicamsrc preview=true sensor-mode=5 bitrate=8000000! video/x-h264,width=1640,height=922,framerate=40/1,profile=baseline ! mpegtsmux ! srtsink uri=srt://:8888

I get the error   WARNING: erroneous pipeline: no element "srtsink"


As far as I understood i am close to make it run, I just feel that the Gstreamer cannot see the srtsink plugin , although I followed the instructions to install SRT. I guess Gstreamer is looking for srtsink in different locations than where SRT is actually installed. When i run   gst-inspect-1.0 srt  , i get no results.. When i run   gst-inspect-1.0 x264   i get results for this plugin and for several other plugins i tried.   

DO you know how can i fix this  ??  Probably its something easy and i just dont know how to fix it.. How to make  Gstreamer see the srt  plugin.. 

Unfortunately , i cannot contact that guy that wrote this process with Raspberry camera, srt and gstreamer.. I cannot find his email..


I would really appreaciate if you could propose any fix for this .. Thanks a lot


Best Regards,




On Fri, May 8, 2020 at 12:05 PM Sebastian Dröge <[hidden email]> wrote:
On Thu, 2020-05-07 at 22:13 +0300, apostolis paraschoudis wrote:
> Hello,
>
> Unfortunately I am not an advanced user with raspberries , Gstreamer
> and networks and I couldn't find a solution to my problem in several
> forums (i couldn't find any dedicated forum for Gstreamer ! ) .
> I am trying to transmit video from my rapsberry camera (connected to
> RPI 3 B+) to my windows laptop through gstreamer.
>
> In my laptop i give the command :
> gst-launch-1.0.exe -v udpsrc port=5600 caps=“application/x-rtp,
> media=(string)video, clock-rate=(int)90000, encoding-
> name=(string)H264” ! rtph264depay ! avdec_h264 ! videoconvert !
> autovideosink sync=f
>
> and on my raspberry the command:
> raspivid -n -w 1280 -h 720 -b 1000000 -fps 15 -t 0 -o - | gst-launch-
> 1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=10 pt=96 !
> udpsink host=xxx.xxx.xxx.xxx port=5600

There are two things to improve here, on both sides.

For the receiver, can you add an `rtpjitterbuffer` element between the
`udpsrc` and the `rtph264depay`? That would allow for some buffering,
fix up packet reordering and create more useful timestamps, among other
things.

On the sender side I would recommend using the `rpicamsrc` element from
  https://github.com/thaytan/gst-rpicamsrc
instead of piping the `raspivid` output to `gst-launch-1.0`. That's
going to work more robust and reliable, and also provide better
timestamp and other metadata to GStreamer.

Once changing that it should work better, maybe already well enough.

--
Sebastian Dröge, Centricular Ltd · https://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