maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   OS2008 / Maemo 4 / Chinook - Diablo (https://talk.maemo.org/forumdisplay.php?f=29)
-   -   Use N800 webcam as a Linux Desktop webcam (https://talk.maemo.org/showthread.php?t=26288)

lntalm 2009-01-17 16:04

Use N800 webcam as a Linux Desktop webcam
 
This post is about using the N800 webcam as a Desktop webcam on a Linux system (personnaly, I never use the emdedded N800 webcam on the tablet, but I was interested in using it on my Desktop with amsn).

The way to do it is to use the gstreamer to send the webcam data over the network, then to use again gstreamer and the vloopback on the desktop side to emulate a v4l2 device.

In this message, $N800_HOST and $DESKTOP_HOST are the n800 and desktop IP. N800 and Desktop computer are on the same wifi LAN.

1. N800, send the image over network

You need first to install the package :
gstreamer0.10-plugins-extra

Then, you can ensure that the following command doesn't throw any error. This command blocks, you can then stop with ctrl-C :
Code:

gst-launch-0.10 -v v4l2src ! 'video/x-raw-yuv,width=320,height=240,framerate=8/1' ! ffmpegcolorspace ! jpegenc ! tcpserversink host=$DESKTOP_HOST port=5434
2. Prepare the vloopback device
You need to compile the vloopback module. This module can be found on this page : http://www.lavrsen.dk/twiki/pub/Moti...ack-1.1.tar.gz

You need to patch this source because there aren't compatible with Linux > 2.6.24, so download also this patch :
http://data.likide.homelinux.org/vloopback-1.1.patch

Go to the folder where you have put these files, ensure you have the correct tools to build linux module (gcc and linux headers files), then :
Code:

tar xzf vloopback-1.1.tar.gz
cd vloopback-1.1
cp ../vloopback-1.1.patch .
patch -p1 -i vloopback-1.1.patch
make

If there is no error, you can then, with root user :
Code:

cp vloopback.ko /lib/modules/`uname --release`
depmod -a
modprobe vloopback

You can verify the module is correctly loaded by checking the presence of /dev/video0 and /dev/video1 files.
Change the permission of these files
Code:

chmod 777 /dev/video*
3. Prepare the gstreamer plugin
To send the data into the the vloopback device, you need a specific gstreamer plugin.

Download it here : http://data.likide.homelinux.org/gst...ack-0.1.tar.gz

Compile it (you need the gstreamer devel packages) :
Code:

./configure
make

If compilation doesn't throw error, install it with root user :
Code:

cp src/.libs/libgstvloopbacksink.so /usr/lib/gstreamer-0.10
Verify the installation by checking that the following command find the plugin :
gst-inspect-0.10 |grep vloopbacksink

4. Plug all the elements

Run the command seen in 1. (N800)

On the desktop, run :
Code:

gst-launch -v tcpclientsrc host=$N800_HOST port=5434 ! jpegdec ! vloopbacksink location=/dev/video0
5. Test the webcam

Code:

xawtv -c /dev/video1
command should display the webcam image on the desktop side.

You can use amsn with /dev/video1 as the webcam source.

Known issues
  • 320x240 image size is currently hardcoded
  • xawtv and amsn are known to work, cheese and skype not to work
  • network and computer load can delay video stream ; 320x200 works fine here with wifi LAN and pentium M 1.8Ghz
  • intensive network, processor and webcam use drain battery on the n800 size ; be warned this utilisation can so shorten your battey life
  • this is a bit difficult, and the n800 webcam's quality is very poor

Lord Raiden 2009-01-17 17:43

Re: Use N800 webcam as a Linux Desktop webcam
 
Interesting post. I've been looking into ways to take a regular webcam on a regular Linux box and turn it into a time lapse camera that takes a picture every couple of seconds and stores it on the drive so I can make a movie out of it. :)

qole 2009-01-18 01:56

Re: Use N800 webcam as a Linux Desktop webcam
 
First, I think it is cool to use the camera this way.

However, why not just run aMSN on the tablet?

codeMonkey 2009-01-18 08:28

Re: Use N800 webcam as a Linux Desktop webcam
 
Quote:

Originally Posted by Lord Raiden (Post 258287)
Interesting post. I've been looking into ways to take a regular webcam on a regular Linux box and turn it into a time lapse camera that takes a picture every couple of seconds and stores it on the drive so I can make a movie out of it. :)

Tried motion? It can do that for you - even making the movie.

lntalm 2009-01-18 09:46

Re: Use N800 webcam as a Linux Desktop webcam
 
Quote:

Originally Posted by qole (Post 258349)
First, I think it is cool to use the camera this way.

However, why not just run aMSN on the tablet?

Because I prefer a big screen and a big keyboard if I am at home... And I don't know there was packages for aMSN. I'll try it.

Benson 2009-01-18 09:57

Re: Use N800 webcam as a Linux Desktop webcam
 
Quote:

Originally Posted by lntalm (Post 258386)
Because I prefer a big screen and a big keyboard if I am at home... And I don't know there was packages for aMSN. I'll try it.

Then attach a webcam to the PC, point it at the N800's screen, and use xawtv to see it; hook up a USB keyboard to the N800. :p

Cool work with the net-forwarding, though. :)

DJArty 2009-01-18 15:02

Re: Use N800 webcam as a Linux Desktop webcam
 
Hi!
Have Black Screen after xawtv -c /dev/video1
or just xawtv
ATI HD3300 Ubuntu 8.10
What is the problem can be? Tnx.

DJArty 2009-01-18 15:36

Re: Use N800 webcam as a Linux Desktop webcam
 
Some trix, but problem don`t solved completely:
1)added Load "v4l" in /etc/X11/xorg.conf
2) After BlackScreen I press Ctrl+Alt+F1 and then Ctrl+Alt+F7 - return to normal screen with camview.

VLC Media player works too :)

Lord Raiden 2009-01-19 01:10

Re: Use N800 webcam as a Linux Desktop webcam
 
Quote:

Originally Posted by codeMonkey (Post 258383)
Tried motion? It can do that for you - even making the movie.

Well, I can shake it all day long, but it doesn't do anything. ;) J/K. Actually, no, I've never heard of it. I'm guessing "motion" is a application, and not an action, right? heh.

mtron 2009-01-20 17:05

Re: Use N800 webcam as a Linux Desktop webcam
 
thanks for the nice tip :)

you can also use mplayer instead of xawtv on the host to view the stream from the webcam.
Code:

mplayer tv:// -fps 15 -tv device=/dev/video1:driver=v4l:input=1:width=320:height=240
I'm not sure that my frame rate is optimal, but the lag is not that bad, and the stream watchable.

MrWeasel 2009-03-02 18:56

Re: Use N800 webcam as a Linux Desktop webcam
 
Quote:

Originally Posted by lntalm (Post 258275)
Known issues
  • ...
  • xawtv and amsn are known to work, cheese and skype not to work
    ...

It DOES work with Skype. You have to use gstfakevideo (which then starts up sykpe) with
Code:

gstfakevideo v4lsrc device=/dev/video0
Wireless webcam... nice =)

Pinatz 2009-03-17 16:37

Re: Use N800 webcam as a Linux Desktop webcam
 
heyhey =)
I have some questions ^^

"mplayer tv:// -fps 15 -tv device=/dev/video1:driver=v4l:input=1:width=320:height=240"
This does not work on the n810 right?

But the gstreamer
Code:

gst-launch-0.10 -v v4l2src ! 'video/x-raw-yuv,width=320,height=240,framerate=8/1' ! ffmpegcolorspace ! jpegenc ! tcpserversink host=192.168.1.101 port=5434
starts streaming the video signal ( the led lights red).
How can I catch the signal with VLC in windows?

I even tried this :
http://wiki.maemo.org/Streaming_vide...uilt-in_webcam
But I think its useless for the n810 ^^

AapoRantalainen 2009-03-22 17:48

Re: Use N800 webcam as a Linux Desktop webcam
 
I got http://wiki.maemo.org/Streaming_vide...uilt-in_webcam working with n810.
You need one script to Tablet and one file to your PC with vlc.
And in tablet there must be package gstreamer-tools installed.

Script to Tablet: (change proper ip-address)
Code:

#!/bin/sh

VPORT=5434
APORT=5432
HOST=PUT_YOUR_PCS_IP_ADDRESS_HERE
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

File in PC: (call it as n810.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

Execute script in Tablet. It say something about pipelines.
In PC type vlc n810.sdp (or start vlc and File->Open->n810.sdp)

Only video, not audio.
You can use resolution up to width=640,height=480.

Pinatz 2009-03-22 20:51

Re: Use N800 webcam as a Linux Desktop webcam
 
Hey thank you for the fast answer.

May the sound be a problem of reading data from the wrong device?
Gstreamer is configured to stream sound I think -> "audio/x-raw-int,channels=1,rate=8000 ! mulawenc ! rtppcmupay mtu=1438 ! \"

arpia49 2009-10-01 14:35

Re: Use N800 webcam as a Linux Desktop webcam
 
Quote:

Originally Posted by AapoRantalainen (Post 273735)
Only video, not audio.

If you want audio working, try 127.0.0.0 in every IP listed in n810.sdp.

It's working for me under Diablo.

marce_245 2010-03-07 23:56

Re: Use N800 webcam as a Linux Desktop webcam
 
Sorry to revive an old thread but I'm kinda stuck. I'm trying to use my N800 as a webcam for my Windows PC. I managed to stream from the tablet's webcam to my pc (I used vlc to play the stream) but I don't know what to do next. How do I get the PC to recognize the N800 stream as a webcam?

Thanks in advance


All times are GMT. The time now is 13:40.

vBulletin® Version 3.8.8