Latest revision |
Your text |
Line 1: |
Line 1: |
- | It is possible to use the [[Nokia N800|N800]] and [[Nokia N900|N900]] camera as a source of streaming video.
| + | {{Midgard article}} |
| | | |
- | == N800 ==
| + | It is possible to use the N800 camera as a source of streaming video. This was originally described [https://maemo.org/community/wiki/howtostreamvideo/ here], but the referenced example has an error which prevents it working. |
| | | |
- | This was originally described [https://maemo.org/community/wiki/howtostreamvideo/ here], but the referenced example has an error which prevents it from working. | + | This note describes how to stream video from the platform to an RTP sink, for example the [https://maemo.org/community/wiki/howtostreamvideo/ vlc] media player. |
| | | |
- | This note describes how to stream video from the platform to an RTP sink, for example the [[VLC]] media player.
| + | # Install the necessary gstreamer packages. The following list may be excessive, but "works": |
| + | #* gstreamer-tools |
| + | #* gstreamer0.10-3gp-osso |
| + | #* gstreamer0.10-adpcm-osso |
| + | #* gstreamer0.10-ffmpeg-osso |
| + | #* gstreamer0.10-gnomevfs |
| + | #* gstreamer0.10-hantro |
| + | #* gstreamer0.10-id3lib-osso |
| + | #* gstreamer0.10-mpeg1demux-osso |
| + | #* gstreamer0.10-mpegstream-osso |
| + | #* gstreamer0.10-plugins-bad |
| + | #* gstreamer0.10-plugins-base |
| + | #* gstreamer0.10-plugins-base-extra |
| + | #* gstreamer0.10-plugins-base-kulve |
| + | #* gstreamer0.10-plugins-good |
| + | #* gstreamer0.10-plugins-good-extra |
| + | #* gstreamer0.10-plugins-good-kulve |
| + | #* gstreamer0.10-tools |
| + | #* gstreamer0.10-wma |
| + | # On the N800, the following script will stream video from the camera. Here, 172.31.0.244 is the Linux box with VLC installed, and 172.31.0.245 is the N800. I call this script <tt>~/bin/rtpstream.sh</tt>.<br/> <tt><nowiki>#!/bin/sh</nowiki></tt><br/> |
| + | <tt>VPORT=5434</tt><br/> <tt>APORT=5432</tt><br/> <tt>HOST=${1:-172.31.0.244}</tt><br/> |
| + | <tt>gst-launch-0.10 v4l2src ! \</tt><br/> <tt>video/x-raw-yuv,width=176,height=144,framerate=\(fraction\)15/1 ! \</tt><br/> <tt>hantro4200enc stream-type=1 profile-and-level=1001 ! \</tt><br/> <tt>video/x-h263,framerate=\(fraction\)15/1 ! rtph263ppay mtu=1438 ! \</tt><br/> <tt>udpsink host=$HOST port=$VPORT dsppcmsrc ! queue ! \</tt><br/> <tt>audio/x-raw-int,channels=1,rate=8000 ! mulawenc ! rtppcmupay mtu=1438 ! \</tt><br/> udpsink host=$HOST port=$APORT |
| + | # On the Linux box, the sample .sdp file from [http://web.media.mit.edu/%7Elifton/snippets/n800_to_sl/ the original article], with the address of our VLC player, saved as a file i.e. <tt>/tmp/n800.sdp</tt><br/> <tt>v=0</tt><br/> <tt>o=- 37 614155991 IN IP4 127.0.0.0</tt><br/> <tt>s=QuickTime</tt><br/> <tt>t=0 0</tt><br/> <tt>a=range:npt=now-</tt><br/> <tt>m=audio 5432 RTP/AVP 0</tt><br/> <tt>c=IN IP4 172.31.0.245</tt><br/> <tt>b=AS:63</tt><br/> <tt>m=video 5434 RTP/AVP 96</tt><br/> <tt>c=IN IP4 172.31.0.245</tt><br/> <tt>a=rtpmap:96 H263-2000/90000</tt><br/> <tt>a=fmtp:96 </tt><br/> <tt>a=cliprect:0,0,144,176</tt><br/> a=framesize:96 176-144 |
| + | # On the N800, pop out the camera and run:<br/> $ ~/bin/rtpstream.sh # assume on PATH, +x etc. |
| + | # On Linux box (note VLC runs on other platforms as well):<br/> $ vlc /tmp/n800.sdp |
| + | # Enjoy streaming video (and sound) from the N800. |
| | | |
- | First, you must install the '''gstreamer-tools''' package from the diablo repo on repository.maemo.org.
| + | Thanks to [http://web.media.mit.edu/%7Elifton/snippets/n800_to_sl/ Josh Lifton] for the original leg work. |
| | | |
- | * On the N800, the following script will stream video from the camera. Here, 172.31.0.244 is the Linux box with VLC installed, and 172.31.0.245 is the N800. I call this script <code>~/bin/rtpstream.sh</code>.
| |
- | #!/bin/sh
| |
- | VPORT=5434
| |
- | APORT=5432
| |
- | HOST=${1:-172.31.0.244}
| |
- | gst-launch-0.10 v4l2src ! video/x-raw-yuv,width=176,height=144,framerate=\(fraction\)15/1 ! hantro4200enc stream-type=1 profile-and-level=1001 ! video/x-h263,framerate=\(fraction\)15/1 ! rtph263ppay mtu=1438 ! udpsink host=$HOST port=$VPORT dsppcmsrc ! queue ! audio/x-raw-int,channels=1,rate=8000 ! mulawenc ! rtppcmupay mtu=1438 ! udpsink host=$HOST port=$APORT
| |
| | | |
- | * On the Linux box, the sample .sdp file from [http://web.media.mit.edu/%7Elifton/snippets/n800_to_sl/ the original article], with the address of our VLC player, saved as a file i.e. <code>/tmp/n800.sdp</code>
| |
- | v=0
| |
- | o=- 37 614155991 IN IP4 127.0.0.0
| |
- | s=QuickTime
| |
- | t=0 0
| |
- | a=range:npt=now-
| |
- | m=audio 5432 RTP/AVP 0
| |
- | c=IN IP4 172.31.0.245
| |
- | b=AS:63
| |
- | m=video 5434 RTP/AVP 96
| |
- | c=IN IP4 172.31.0.245
| |
- | a=rtpmap:96 H263-2000/90000
| |
- | a=fmtp:96
| |
- | a=cliprect:0,0,144,176
| |
- | a=framesize:96 176-144
| |
- | * On the N800, pop out the camera and run:
| |
- | $ ~/bin/rtpstream.sh
| |
- | assume on PATH, +x etc.
| |
- | * On Linux box (note VLC runs on other platforms as well):
| |
- | $ vlc /tmp/n800.sdp
| |
- | * Enjoy streaming video (and sound) from the N800.
| |
| | | |
| | | |
- | Thanks to [http://web.media.mit.edu/%7Elifton/snippets/n800_to_sl/ Josh Lifton] for the original leg wor
| + | [[Category:Users]] |
- | | + | [[Category:Midgard wiki]] |
- | On a N800, to make the image vertically flip automatically when the camera's pointing backwards (so it's not upside-down), change the source name from "v4l2src" to "gconfv4l2src".
| + | |
- | | + | |
- | To adjust the video encoding quality, have a look at the parameters described by entering "gst-inspect hantro4200enc" at a shell prompt. Setting the "bit-rate" parameter to its maximum (515) and the "profile-and-level" parameter to 1007 produces a much better quality image. Also, I suspect the "stream-type" parameter should be "5" (H263), not "1" (MPEG4 Video).
| + | |
- | | + | |
- | | + | |
- | == N900 ==
| + | |
- | | + | |
- | The instructions for the N900 are very similar to the N800.
| + | |
- | First install gstreamer-tools.
| + | |
- | | + | |
- | $ apt-get install gstreamer-tools
| + | |
- | | + | |
- | Note: on PC you might need to replace gst-launch by gst-launch-0.10 in the examples below
| + | |
- | | + | |
- | To access the back camera use:
| + | |
- | <br>''/dev/video0''
| + | |
- | <br>for the front
| + | |
- | <br>''/dev/video1''
| + | |
- | | + | |
- | In the example below the IP for the two devices are as follows
| + | |
- | *PC IP 192.168.1.101
| + | |
- | *N900 IP 192.168.1.105
| + | |
- | | + | |
- | On the N900 the command you want to run is:
| + | |
- | | + | |
- | $ gst-launch v4l2src device=/dev/video0 ! videoscale! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! jpegenc ! tcpserversink host=192.168.1.101 port=5000
| + | |
- | | + | |
- | | + | |
- | On the PC run
| + | |
- | | + | |
- | $ gst-launch tcpclientsrc host=192.168.1.105 port=5000 ! jpegdec ! autovideosink
| + | |
- | | + | |
- | The below also works
| + | |
- | <br>'''N900'''
| + | |
- | | + | |
- | $ gst-launch v4l2camsrc device=/dev/video0 ! videoscale! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! jpegenc ! tcpserversink host=192.168.1.101 port=5000
| + | |
- | | + | |
- | Another example using a different encoder/decoder and udp
| + | |
- | <br>'''N900'''
| + | |
- | | + | |
- | $ gst-launch v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! smokeenc ! udpsink host=192.168.1.101 port=5000
| + | |
- | | + | |
- | <br>'''PC'''
| + | |
- | | + | |
- | $ gst-launch udpsrc port=5000 ! smokedec ! autovideosink
| + | |
- | | + | |
- | | + | |
- | Another example using omap3cam driver
| + | |
- | <br>'''N900'''
| + | |
- | | + | |
- | $ gst-launch-0.10 v4l2camsrc device=/dev/video0 driver-name=omap3cam ! videoscale ! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! jpegenc ! tcpserversink host=192.168.1.101 port=5000
| + | |
- | | + | |
- | <br>'''PC'''
| + | |
- | | + | |
- | $ gst-launch tcpclientsrc host=192.168.1.105 port=5000 ! jpegdec ! autovideosink
| + | |
- | | + | |
- | | + | |
- | There are many ways to skin this particular cat. Recommendations are to look at [http://www.gstreamer.net/ gstreamer] and familiarise yourself.
| + | |
- | | + | |
- | | + | |
- | To stream from the N900 to VLC follow these [http://blog.pclewis.com/2010/02/streaming-nokia-n900-camera-to-vlc/ instructions]
| + | |
- | | + | |
- | | + | |
- | === For the future ===
| + | |
- | =====vloopback=====
| + | |
- | http://talk.maemo.org/showthread.php?t=26288
| + | |
- | http://tektipsentriks.blogspot.com/2010/05/how-to-install-vloopback-on-ubuntu.html
| + | |
- | | + | |
- | ===Webcam threads===
| + | |
- | http://talk.maemo.org/showthread.php?t=31567
| + | |
- | http://talk.maemo.org/showthread.php?t=46046
| + | |
- | | + | |
- | ===Flumotion mention===
| + | |
- | http://talk.maemo.org/showthread.php?t=31567&page=7
| + | |
- | extras-devel
| + | |
- | http://maemo.org/packages/package_instance/view/fremantle_extras-devel_free_i386/flumotion/0.7.0.1-1maemo4/
| + | |
- | | + | |
- | == Streaming over ssh N900 ==
| + | |
- | | + | |
- | Here is an alternative way of streaming video on the [[Nokia N900|N900]] over ssh.
| + | |
- | | + | |
- | First get ssh to do X11 forwarding by installing xauth as follows:
| + | |
- | | + | |
- | # Install libxmuu1 (needed by xauth) by "apt-get install libxmuu1"
| + | |
- | # Install the xauth from https://bugs.maemo.org/show_bug.cgi?id=2494
| + | |
- | | + | |
- | Now ssh to your N900 with the flag "-X" and then give the command:
| + | |
- | | + | |
- | gst-launch-0.10 v4l2src \
| + | |
- | ! videoscale ! video/x-raw-yuv,width=320,height=240 \
| + | |
- | ! xvimagesink
| + | |
- | | + | |
- | A 320x240 video window should now popup on your desktop.
| + | |
- | | + | |
- | [[Category:Connectivity]]
| + | |
- | [[Category:Media]] | + | |
- | [[Category:Power users]] | + | |