Streaming Nokia N900 Camera to VLC

February 3, 2010 by · 26 Comments 

I recently had need to look at the back of my own head, and using the camera on my phone seemed like the easiest way to do it. I found a guide on the Maemo wiki, but it was for the N800 and I didn’t have the hantro4200 encoder it was trying to use. After learning more than I ever wanted to about gstreamer and sdp files, I came up with a way that works for me.

In my setup, my computer is and the phone is You will have to replace them with your own IP addresses.

Here is the command to start gstreamer on the phone. You will probably want to put it in a script:

gst-launch v4l2camsrc device=/dev/video0 ! \
           dsph264enc ! \
           rtph264pay ! \
           udpsink host= port=5434

If gst-launch is not found, you probably need to install the gstreamer-tools package:

apt-get install gstreamer-tools

To use the camera on the front of the phone, you can change the device to /dev/video1.

Here is the minimal sdp file I was able to use with VLC to get it to play. Using the “Open Network” dialog to try and play an RTP stream did not work.

m=video 5434 RTP/AVP 96
c=IN IP4
a=rtpmap:96 H264/90000

The second line (m=) contains the port, the third (c=) contains the IP address of the phone, and the fourth (a=) specifies the codec.

To use MP4 instead of H264, you can just change h264 to mp4v everywhere. In the SDP file, it should be MP4V-ES, as in: a=rtpmap:96 MP4V-ES/90000. If you get errors in VLC like:

avcodec warning: cannot decode one frame (14922 bytes)

Then add send-config=true to the rtpmp4v part of the gstreamer pipeline, and make sure you start VLC before you start streaming:

gst-launch v4l2camsrc device=/dev/video0 ! \
           dspmp4venc ! \
           rtpmp4vpay send-config=true ! \
           udpsink host= port=5434

For H263, you can try dsph263enc, rtph263pay and H263-1998 or H263-2000, but I couldn’t get it to work.

I don’t know if there’s a way to control the focus, white balance, etc, but I was able to use the flashlight-applet to turn on the camera LEDs while streaming after I downgraded to 0.2-0:

apt-get install flashlight-applet=0.2-0

About pcl
pcl is a cool guy.


26 Responses to “Streaming Nokia N900 Camera to VLC”
  1. Pritam says:


    Can we run VLC on Nokia n900 for music files? I mean VLC music player be installed on Nokia n900?


  2. zack says:

    How do you open the sdp file?

  3. HermitoZ says:

    This works for me if I type the commands in trough ssh or terminal manually, but I can’t manage to get a script working. The script seems to start fine and it outputs the exact same thing in the terminal window. But VLC doesn’t find anything if I start from script. Could you please paste a script that would work?

    I pasted this (with the right IP) in an executable file called “vlc-stream”:
    gst-launch v4l2camsrc device=/dev/video0 ! \
    dsph264enc ! \
    rtph264pay ! \
    udpsink host= port=5434

  4. Maddy says:

    Excellent Stuff!!!!!!!

    I tried both the primary and secondary camera and both worked amazingly fast.

    Thank You

  5. Sandeep Mohil says:

    Everything works gr8 except the video has yellowish green layer on it.
    Any idea ?

    • tetris11 says:

      1. slide open camera + launch the camera app first
      2. adjust zoom and focus
      3. keeping camera app open, launch streaming script
      4. camera app should now automatically close (‘operation failed’), and you should now be streaming without green-yellow tinge.

  6. RG says:


    how do you make vlc work stand by, as your video starts streaming, you don’t need to invoke the script again, but it is done automatic?

    thanks a bunch

  7. Alvin says:

    How to make the .sdp file?

    Grtz Alvin

  8. antennenmann says:


    I use to stream video from the n900 with gstreamer (gst-launch) and it works very fine. from terminal to terminal and from terminal to vlc. like this:


    gst-launch v4l2src \ ! videoscale ! video/x-raw-yuv,width=320,height=240,framerate=30/1 ! dsph264enc ! rtph264pay ! udpsink host= port=5000


    m=video 5000 RTP/AVP 96
    c=in IP4
    a=rtpmap:96 H264/90000

    now i want to stream audio from the internal mircophone to vlc or gst-launch but i could not find out a working code for both, n900 and vlc/gst-launch. i tried several times with different codes but no

    for example:


    gst-launch pulsesrc ! audio/x-raw-int,channels=1,rate=8000 ! mulawenc ! tcpserversink host= port=5001


    gst-launch tcpclientsrc host= port=5001 ! mulawdec

    i dont know much about gstreamer and the documentation is hard to understand for noobs.

    did someone here know a working codeline for the n900 to stream
    audio from the internal microphone with gst-launch?

    and on the other side a working vlc .sdp or gst-launch code ?

    best regards

  9. Felipe Lauksas says:

    I have some delay, about 6 sec… any ideas?

  10. aldebarab says:

    Hallo pclewis,

    can you give me any pointer where sdp file syntax is described? My vlc (1.01) under debian linux doesn’t recognize the stream fom gstreamer wether it is h264 nor mp4v.

    vlc –list gives:
    h264 H264 video demuxer
    packetizer_h264 H.264 video packetizer

    mux_mp4 MP4/MOV muxer
    mp4 MP4 stream demuxer

    rtp Real-Time Protocol (RTP) input
    stream_out_rtp RTP stream output

  11. Allwise says:

    This is awesome!

    Now I’d like to set up a webradio from my N900, so that I can play that stream from my HTPC that runs Ubuntu. I’ve got it to work with the internal microphone, but I can’t really say that I get a party going from that. Now, I’d like to be able to stream either directly from the media player, or maybe from the system sound. I’ve tried some gstreamer commands but all I can get to stream is the test sine sound or the internal microphone, not the system sound. Any one got ideas?

  12. kktester says:

    I have got this to work between my N900 and windows pc using the vlc player. My question is will this work over the internet. will it get through a nat. any advice would be great.

  13. n900bie says:

    Thank you very much for this howto! Works great!

    “I don’t know if there’s a way to control the focus, white balance, etc,”-OP

    Open the camera app (just slide the door open) before you start gst-launch. This will enable the camera auto focus, white balance, etc. while you stream.

  14. mveplus says:

    Great blog, Thanks!
    I saved everything in n900stram.vlc and it working fine with VLC player.

  15. shahzad says:

    how to make n900 commands set a executable script file? copied the commands on notebook app saved to n900 MyDocs via ssh, changed permissions to 755 even 777 and ran with “./file name” in file directory, still permission denied! where am i wrong?

    • shahzad says:

      got it working, used sh command before the filename! Thank you for sharing these brilliant scripts and helping linux newbies like me! God bless you.

  16. RiDDicK says:


    can some 1 help me to guide from 1st step until the last… like where to go and where to edit this command… i don’t understand where to start…

    if some guide me, it’ll be a great help…

    thanks in advance…

  17. B3bis says:

    From all the codecs which would be the best quality. I cannot manage to get mp4v working. Only the h264.

  18. haiku says:

    How you can put the streaming to /dev/video output on the PC? This would be veary usefull to use with skype, for example.

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!