Posted by: samirghimire | March 4, 2011

Webcam streaming using Python and Gstreamer

 

Welcome

Welcome all to my blog. I have created this blog during my project work in Uni. I will be working in few more projects in future as well, mainly linux and media based. I will be very grateful for your comments and advices. 

STREAMING MEDIA USING AN OPEN SOURCE FRAMEWORK, GSTREAMER
In this blog I  have written about Project on streaming media project using an open source framework, Gstreamer. I have used Python to program and Linux Ubuntu distribution. I managed to successfully do the audio/video playback, audio/video streaming and live video streaming.

Video Streaming
Live Video Streaming

 


Responses

  1. even i was making the same program but the problem is with the multipartdemux so i removed that part from receiving end and it worked.. but i am not sure why the output wont come when multipartdemux is used

    • gst-launch v4l2src ! ffmpegcolorspace ! jpegenc ! multipartmux ! tcpclientsink host = 127.0.0.1 port = 5005
      gst-launch tcpserversrc host=127.0.0.1 port=5005 ! jpegdec ! autovideosink

      pipelines i used just for testing purpose

  2. HI sahil.. thanks for coming up with this idea.. but i already finished my project with audio/video/live video streaming project.. i got everything working…
    I made the same pipeline for live video stream to work thogh the quality was not that good.

    i am not sure why multipartdemux did not work but try linking ffmpegcolorspace with multipartmux and multipartmux with jpegenc

  3. hi, samir. i am going to a project with living audio/video, my problem is, how can i get the audio source from microphone? could you share same relative document with me?
    thanks

    • Hello ajaxhe ! good to hear that you are doing a Gstreamer based project..
      If you are asking me about how you can capture an audio frame from microphone then, here is the solution:
      You can use alsasrc element from gst-plugins-base package which will capture audio frame:
      for example: $ gst-launch-0.10 alsasrc ! audiorate ! wavenc ! filesink location=testsound.wav
      this pipeline will captures audio frame from your alsa source and dump the file into a chosen location , same way you can use a TCP or UDP client sink to stream over the network..
      Hope this resolves your problem..

      • thanks samir, By using your advice, I can get the voice from the mircophone now!
        谢谢

  4. samir, i have another problem, how can i to play the video in wxpython app?
    There is a nice example for pyGTK.
    http://pygstdocs.berlios.de/pygst-tutorial/webcam-viewer.html
    What is the equivalent method -> self.movie_window = gtk.DrawingArea()
    for wxPython?
    How to integrate gstreamer *video* window in wxpython app?
    thanks~

    • i have fixed the problem. Just use imagesink.set_xwindow_id(self.GetHandle()).
      thanks`

  5. Hi Samir,
    Have you used any compression algorithm for video streaming. Actually I am trying to implement gstreamer for voice chat application in python. could you please share your project code for the video streaming.
    Thanks,

    • Hi daya,
      No I haven’t used any compression algorithm. It was just a video streaming, I tried to embed audio as well but was not successful.

  6. [...] http://samirghimire.wordpress.com/2011/03/04/webcam-streaming-using-python-and-gstreamer/ LD_AddCustomAttr("AdOpt", "1"); LD_AddCustomAttr("Origin", "other"); LD_AddCustomAttr("theme_bg", "f0f0f0"); LD_AddCustomAttr("theme_border", "cccccc"); LD_AddCustomAttr("theme_text", "555555"); LD_AddCustomAttr("theme_link", "008DCF"); LD_AddCustomAttr("theme_url", "008DCF"); LD_AddCustomAttr("LangId", "1"); LD_AddCustomAttr("Autotag", "television"); LD_AddCustomAttr("Autotag", "technology"); LD_AddCustomAttr("Tag", "agile-development"); LD_AddCustomAttr("Tag", "flash-2"); LD_AddCustomAttr("Tag", "flex-2"); LD_AddCustomAttr("Tag", "swf"); LD_AddCustomAttr("Tag", "twisted"); LD_AddSlot("wpcom_below_post"); LD_GetBids(); Rate this: Share this:TwitterFacebookEmailPrintDiggRedditStumbleUponLike this:LikeBe the first to like this post. [...]

  7. hi all,

    i am trying to capture audio video from /dev/video0 thru python, get the stream in pipe, then read from it to save each 1 min of the stream to mpeg-ts files. how can i do that with gstreamer. how can i include audio data at same time with the above script.

  8. Hello,

    Did this code get fixed?

    dan


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Categories

Follow

Get every new post delivered to your Inbox.