RasPi Camera: GStreamer-1.0 w/ Windows 7

As talked about in our previous post, the MJPG-Streamer video rate using the Pi's Camera module was definitely not acceptable for our project. The maximum speed (with dropped frames)of raspistill was far below the video quality needed for our project. After researching multiple different streaming methods we settled on using GStreamer-1.0, an open source visual and audio streaming platform. This method is faster as the software opens up a direct network pipeline between the Raspberry Pi and the OCU (in this case a Windows 7 machine).

This tutorial is Windows 7 specific, but will work on Mac and Linux. The tutorials for Mac and Linux are actually much easier as GStreamer was originally created for those platforms.

1a. First prime the Pi by adding the follow to /etc/apt/sources.list:

2a. Then update the Pi to download dependencies for GStreamer:

3a. Finally download GStreamer-1.0:

4a. The download is complete. To pipe raspivid through GStreamer use the command below.

****Make sure to use this specific code because GStreamer-1.0 for Windows does NOT include gdpdepay or gdppay as plugins.

1b. In Windows, visit http://gstreamer.freedesktop.org/data/pkg/windows/1.2.2/ and download this (make sure you have the correct installer -- Windows 7 comes with a pre downloaded .msi installer, but other versions do not):

2b. Install!

3b. Using cd and dir navigate to /gstreamer/1.0/64_x86/bin

4b. Now you can use the get-launch-1.0.exe command to read the stream coming from the Pi (make sure to use the ip you found using ipconfig above!).

As you can see the quality of the stream is as good as the Pi Module can give. Unlike the jerky MJPG-Streamer, the GStreamer pipeline has <.3 seconds of delay!! This is perfect for our Pi-based submersible. Unfortunately, there is not yet a Java API built for GStreamer-1.0. We will be defaulting to the older version (GStreamer-.10) in order to use this video streaming software.


  1. Thanks, finally got it to work on Windows 7.
    It took me a while to figure out that the IP in the Raspberry Pi command should be the IP of the Windows machine, because I confused UDP with the TCP commands I used earlier...
    Here are the commands of which you made screenshots (easier to copy):

    On the Raspberry Pi:
    raspivid -t 999999 -w 1280 -h 720 -fps 10 -rot 270 -b 2000000 -o - | gst-launch-1.0 -e -vvv fdsrc ! h264parse ! rtph264pay pt=96 config-interval=5 ! udpsink host=IP-OF-WINDOWS-MACHINE port=5000

    On the Windows machine (find the IP with ipconfig):
    gst-launch-1.0 udpsrc port=5000 ! application/x-rtp, payload=96 ! rtpjitterbuffer ! rtph264depay ! avdec_h264 ! fpsdisplaysink sync=false text-overlay=false

  2. Thanks for the comment and clarification. We're glad the post helped!

  3. Hi, this is the only guide that has worked for me, however, although I get video, it's distorted with green bars. http://i.imgur.com/23xyNNZ.jpg Would you happen to know how to fix this? Also, is there a way for me to record the output? Thanks.

    1. I got the same green bars as you (got a Logitech c920 but still), but what's funny is that when I save the stream to a file encoding at the same time (like for example rtph264depay ! avdec_h264 ! x264enc ! avimux ! filesink location=stream.avi) then I got no green bars at all.
      So I guess there may be something wrong with how the stream is defined (like nasty caps...), or else we're missing a point windows side. I'll try streaming to a linux machine to see what's up.

    2. That would be awesome if you could find the root of this problem. The reason we've ended up using the c920 with MJPG-Streamer instead of G-Streamer is partially because of poor quality, especially when the camera is moved quickly. The quality drop associated with movement is different than the green lines, but I believe that the problems may be related. Anyway, thanks for the comment!

    3. Well I confirm the problem is on windows only, no problem with linux.
      I guess the trouble is in the display sink since saving in a file works.
      I'm sorry I have no time to look further into it, my project client is on linux and I got other issues to tackle ^_^

    4. Ich bin mir nicht sicher ob es euch hilft aber wenn ich die Auflösung auf ( -w 1024 -h 768) setze verschwinden die grünen Linien bei mir.

  4. An easy way to record the Pi's video stream is by using netcat. Install netcat on the Pi (apt-get install netcat) and then on your windows machine (http://joncraton.org/blog/46/netcat-for-windows/ ---> might have to download using Internet Explorer as Chrome views the netcat download as a virus). After downloading netcat, run this command on the Pi:

    raspivid -t 999999 -o - | nc 5001

    In the directory where you installed Netcat on your laptop:

    netcat -p -l 5001 > video.h264

    Recording video through GStreamer is also very easy (GStreamer ONLY records video up until 10s before you end the program. Keep GStreamer running well after the event you would like to record has passed.). Run the same command from the Pi as mentioned above. On your laptop run this:

    gst-launch-1.0 -e -v udpsrc port=5000 ! application/x-rtp, payload=96 ! rtpjitterbuffer ! rtph264depay ! ------------------>avdec_h264 ! x264enc ! avimux ! file sink=movie.avi

    As for the green lines, it seems you might have an encoding issue. Are you using the Pi camera or different hardware? GStreamer encoding (and decoding) h264 video, but if your camera does not stream h264 then the setup above will not work. If you are using the Pi Camera and the green lines are still there, comment again and we can help you out.

    Thanks for the comment.

    1. Hi, thanks for the guide. I also get the green lines. I use the PI camera. What could be the problem?

    2. ok, I got this to work with the help of gst-rpicamsrc.

      1. build gst-rpicamsrc from https://github.com/thaytan/gst-rpicamsrc

      on Pi use:
      sudo gst-launch-1.0 -e -vvv rpicamsrc bitrate=1000000 ! h264parse ! rtph264pay pt=96 config-interval=5 ! udpsink host= port=5000

      on windows use:
      gst-launch-1.0 udpsrc port=5000 ! application/x-rtp, payload=96 ! rtpjitterbuffer ! rtph264depay ! avdec_h264 ! fpsdisplaysink sync=false text-overlay=false

      Hope it helps.

    3. Were you able to remove the green lines? Sorry that we weren't much of a help with that.

      Just-cause we're interested...what sorts of projects are you using the Pi camera for?

  5. May I have some questions?

    First, I gt warning from window command line. "Erroneous pipeline: no element "avdec_h264"".
    Can anyone tell me how to fix this? In Raspi, ran perfectly. But in window pc, I got like this.

    Please help me, Thank you in advance

  6. Hi,

    I have tried various permutations on the pi command line but alsway end up with the error :-erroneous pipeline: no element "h264parse".

    The command line is :-
    raspivid -n -t 0 -w 1080 -h 720 -fps 25 -hf -b 6000000 -o - | gst-launch -v fdsrc ! h264parse ! rt ph264pay pt=96 config-interval=5 ! tcpserversink host= port=8080

    I have run gst-inspect-1.0 and h264parse is OK, there but under "videoparsersbad".

    Many thanks,

  7. This comment has been removed by the author.

  8. I had the same issues

    "Erroneous pipeline: no element "avdec_h264"

    Doing a complete install of gstreamer instead of typical.

  9. I'm getting the following output in cmd :

    'Setting pipeline to PAUSED ...
    Pipeline is live and does not need PREROLL ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock'

    and no video.
    Please Help!

  10. hah ! โพสต์ที่ดี
    หาอื่น ๆ ROV PC,ROV คือ,ROV download เกม pc ro ช่วยให้คุณตอนนี้

  11. Thank you a lot ! Worked like a charm !

  12. Amazing Article, thank you!. I am very glad to read your informative & practical blog. Kindly keep updating your blog. Java Developer is a wonderful career for
    IT students.To start Dream Career to become a Java developer learn from Java Training in Chennai.
    or learn thru Java Online Training from India .

    gst-launch-1.0 -v alsasrc device=plughw:1,0 ! mulawenc ! rtppcmupay ! udpsink host=windows-ip-address port=5001 & raspivid -t 999999 -w 1280 -h 720 -fps 10 -rot 270 -b 2000000 -o - | gst-launch-1.0 -e -vvv fdsrc ! h264parse ! rtph264pay pt=96 config-interval=5 ! udpsink host=windows-ip-address port=5000
    gst-launch-1.0 udpsrc port=5000 ! application/x-rtp, payload=96 ! rtpjitterbuffer ! rtph264depay ! avdec_h264 ! fpsdisplaysink sync=false text-overlay=false

  14. please give the details for viewing the stream video in a android app .Thank you

  15. Read all the information that i've given in above article. It'll give u the whole idea about it.
    python Training in Pune
    python Training in Chennai
    python Training in Bangalore

  16. Awesome..You have clearly explained …Its very useful for me to know about new things..Keep on blogging..
    Best Devops Training in pune
    Devops Training in Bangalore
    Power bi training in Chennai

  17. Well done! Pleasant post! This truly helps me to discover the solutions for my inquiry. Trusting, that you will keep posting articles having heaps of valuable data. You're the best! 
    Data Science course in Chennai
    Data science course in bangalore
    Data science course in pune
    Data science online course
    Data Science Interview questions and answers
    Data Science Tutorial
    Data science course in bangalore

  18. Great post. I was once checking constantly this weblog and I'm impressed! Extremely useful information specially the closing part. I maintain such information much. I was once seeking this specific information for a very long time. Many thanks and best of luck.
    oneplus service center velachery