maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   [Maemo 5] Camera stream from N900 to PC? (N900 as webcam) (https://talk.maemo.org/showthread.php?t=31567)

hopla 2010-12-16 12:34

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Quote:

Originally Posted by zehjotkah (Post 897911)
I was able to stream via WiFi to my PC in Linux..
It's relatively easy..

Did you use gstreamer? Can you give us your exact commands?

Also: although I'm using Linux/Unix 99% of my time, I'm still interested to get it working on Windows for that other 1% :S

oleander 2010-12-16 17:50

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
When I want to use gstreamer I am going to get an error in the dataflow and when I want to use gstreamer AND VLC, it will give me no stream and some ugly errors.

Can you post your exact commands?

zehjotkah 2010-12-17 08:12

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
http://talk.maemo.org/showthread.php...136#post566136

You'll have to install gstreamer on your devices, of course...

hopla 2010-12-17 16:22

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Quote:

Originally Posted by zehjotkah (Post 898562)
http://talk.maemo.org/showthread.php...136#post566136

You'll have to install gstreamer on your devices, of course...

Dude, seriously, if that was the problem I wouldn't be posting here :D

beli 2011-01-02 11:01

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Hi all,

I managed to use the N900 camera stream to my PC as a webcam (that you can use in other programs such as Skype) on Ubuntu Linux.

It is pretty easy to do using gstreamer, the scripts allready available here and v4l2loopback.

Here is how to do it:

First on your PC install v4l2loopback kernel module and the gstreamer plugin gst-v4l2loopback. These are available on the following links:
https://v4l2loopback.googlecode.com/hg/
https://github.com/umlaeute/gst-v4l2loopback

Good instructions how to compile and run it can be found here:
http://www.kudanai.com/2010/11/howto...webcam-in.html

Once you get this up and running, on your device execute the following code (same as allready posted here)

Code:

gst-launch v4l2src device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=640,height=480 ! ffmpegcolorspace ! smokeenc ! udpsink host=192.168.1.255 port=1234
and then on your PC the following:
Code:

gst-launch udpsrc port=1234 ! smokedec ! ffmpegcolorspace ! v4l2loopback device=/dev/video0
You can use another /dev/videoX device if video0 is for example allready taken.

This will create a new videodevice that shows the N900 camera stream. Now in Skype you can select that video device and here you go!

titi974 2011-01-02 11:17

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
it's nice man ! too bad it's only for linux... couldn't you do the same for windows ?? But thx man, it's great !

XenGi 2011-01-25 21:54

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
windows isn't so userfriendly so it will be a bit difficult to make a solution.
the linux way is perfect. thanks for this.

lolloo 2011-01-28 18:37

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
any way to do this on windows??

azkay 2011-02-02 13:16

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Any way to give it a higher birate through gstreamer or something?
Its got lots of pixelation.

Anyone got it working with ffdec_h264?
Everything I try on the n900 basically spits out: could not link videoscale/v4l2src/whatever to ffdec_h264

jaimex2 2011-02-02 13:33

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Quote:

Originally Posted by lolloo (Post 930795)
any way to do this on windows??

I noted the windows program Putty has options for it, might be worth a try.

azkay 2011-02-03 06:44

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Quote:

Originally Posted by azkay (Post 934163)
Any way to give it a higher birate through gstreamer or something?
Its got lots of pixelation.

Anyone got it working with ffdec_h264?
Everything I try on the n900 basically spits out: could not link videoscale/v4l2src/whatever to ffdec_h264

Anyone?

Bumping thread up, cant see it on the first couple of pages

azkay 2011-02-04 07:10

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
No one has tried higher quality streams? The furtherest I got was use jpegenc, the quality was great but I could figure out how to get it to /dev/video0, it would only show up in its own window.

XenGi 2011-02-04 09:13

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Quote:

Originally Posted by jaimex2 (Post 934180)
I noted the windows program Putty has options for it, might be worth a try.

What feature of putty did you mean? The only grafical feature that comes to my mind is X-forwarding.

azkay 2011-02-04 22:22

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
I figured it out if anyone cares.

n900:
Code:

gst-launch v4l2camsrc device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=640,height=480 ! ffmpegcolorspace ! dsph264enc ! rtph264pay ! udpsink host=192.168.2.14 port=1234
pc:
Code:

gst-launch-0.10 udpsrc port=1234 caps="application/x-rtp" ! rtph264depay ! ffdec_h264 ! ffmpegcolorspace ! v4l2loopback device=/dev/video0 sync=false
I get a small delay though and a weird green tint.
Can anyone else test it?

EDIT::
I changed it to use jpeg instead of h264, seems to a lot less delay, the tint is still there though.

n900:
Code:

gst-launch v4l2camsrc device=/dev/video0 ! videoscale ! video/x-raw-yuv,width=640,height=480 ! ffmpegcolorspace ! jpegenc ! rtpjpegpay ! udpsink host=192.168.2.14 port=1234
pc:
Code:

gst-launch-0.10 udpsrc port=1234 caps="application/x-rtp" ! rtpjpegdepay ! jpegdec ! ffmpegcolorspace ! v4l2loopback device=/dev/video0 sync=false

mrwormp 2011-02-11 21:08

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Still no break true yet for windows users

fri.K 2011-02-11 21:26

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Quote:

Originally Posted by mrwormp (Post 943203)
Still no break true yet for windows users

But Linux is really easy to use so maybe try Ubuntu.

TiagoTiago 2011-02-12 02:28

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Doesn't the VLC player got a way to use it's output as the video feed of a virtual "webcam" ?

mveplus 2011-02-12 03:49

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
2 Attachment(s)
Quote:

Originally Posted by TiagoTiago (Post 943545)
Doesn't the VLC player got a way to use it's output as the video feed of a virtual "webcam" ?

I would like to ask the same :p

here VLC stream but not tested.

tested - confirmed working with h264 codec on VLC player :rolleyes:

TiagoTiago 2011-02-12 04:21

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
I haven't tried this yet, actually i didn't even knew about this one before finding it with Google, try at your own risk:

http://sourceforge.net/projects/vlvc/



edit: erm, sorry it seems it might not be what you're looking for....

nerobot 2011-02-16 15:26

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Hi,

Thanks for the great work. I can now get the video streaming via WIFI (though there is a bit of a green tint to the screen). Has anyone been able to get the camera to stream vie bluetooth yet. This would be much better for me to use.

Cheers for any help.

tetris11_ 2011-03-06 23:06

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Hey guys,
I had a bit of a go at learning QT yesterday, and created an App for streaming video/audio from the N900 to VLC media player on the PC.

Here's the video showing it:
http://www.youtube.com/watch?v=wfU9uf-lOvQ

I made it as a sort of personal **** you to my Windows-fag mates to show them how awesome linux is!

It's pretty much just a frontend for gst-launch, but with less of the fiddly bits, and can even a generate the .sdp VLC file for your PC (ish).

All you need to do is type in the IP adress of your desktop, and choose whether you want audio or video. (You can also choose image size, front/back camera, etc.)

Hope you guys like it :)

handaxe 2011-03-06 23:10

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
and...... it is available where to like? :)

tetris11_ 2011-03-06 23:42

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Lol :D

There's one teeny tiny minor (possibly major) bug in it that doesn't stop the camera from streaming after you close the app.
(It starts as a new process that you have to manually kill yourself, which probably isnt that safe for the average user.)

But give it another week and I'll probably have that down, and then I'll release it for testing.

PS:
If anyone can help me with understanding how to terminate a QProcess on application exit, I'd really appreciate it!

Edit: Okay, kinda fixed the continuing streaming problem (but it still exists if you exit the app improperly).... gonna have a look at it later again
Edit2: Nope. Done, app seems to work well

gionni88 2011-03-07 09:31

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
QProcess.kill or terminate stops the process but leave it in memory if the app is not run as root and from conky you still see the outgoing process. To solve it I get the PID from the started process and run QProcess::execute("sudo kill PID") when you stop the process or close the app. For the improperly exited app situation, you may try a sudo killall for gst-launch at mainwindow constructor to clean from previous process, if any.

gionni88 2011-03-07 09:35

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Also, which encode do you use? dsph264enc jpegenc?

tetris11_ 2011-03-07 10:25

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Yeah lol, the sudo kill is pretty much what I did to stop it!

My main problem is the QCoreApplication::exit() thing which I dont understand, but I know is VERY neccesary for running a kill script before the application terminates....

And yep Im using dsph264enc for VLC at the moment, but I plan on giving the option for jpegenc, and smokeenc in the future.... (though there's no way smoke can be used through VLC)

gionni88 2011-03-07 13:54

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Quote:

Originally Posted by tetris11_ (Post 962370)
My main problem is the QCoreApplication::exit() thing which I dont understand, but I know is VERY neccesary for running a kill script before the application terminates....

The application closes when you click on the top right X of the top window(the one called in main function) inside the app, or the X in task manager, or when you call the function qApp->exit() (which is the inherited QCoreApplication::exit() you wrote; qApp is a global pointer to your QApplication istance) . When the app closes, the event loop handles all closing events, so you can put the kill all execution inside the main window destructor, MainWindow::~MainWindow() usually with QtCreator, to make it launch when the app is closing.

gionni88 2011-03-07 14:04

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Ah, another hint: if the stream is started before the camera lens cover, video will be without autofocus and auto white balance etc. You may add a banner at app start just to remind to open it if video streaming is planned to get used.

tetris11_ 2011-03-07 16:52

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Quote:

Originally Posted by gionni88 (Post 962492)
You may add a banner at app start just to remind to open it if video streaming is planned to get used.

STOP READING MY MIND! :eek:

And total and complete thanks for the hints dude!
That streaming problem is now completely sorted! :D:D:D

I'm just gonna give it a few more run throughs, and tidy it up aesthetically abit, and I'll release it tomorrow!

Again, thanks ALOT man!

tetris11_ 2011-03-07 22:32

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
3 Attachment(s)
Okay, it's finished. The newest install is on the attachment.

Edit1: Do not use if you have kernel-power v46
Workaround: http://talk.maemo.org/showpost.php?p...&postcount=152
Edit2: If the app appears to do nothing (i.e. no streaming), then make sure gst-tools, rootsh, and expect are installed on your phone.
"sudo apt-get install gst-tools rootsh expect"
Edit3: If it's crashing when you click "generatesdp", then launch the app from terminal "/usr/local/bin/tester" but not as root. Repeat NOT as root.

It's called PhoneStreamer in case you guys are looking for the icon after install.

If you are using this app for the first time (which I imagine it probably is for most of you guys), then push the "ShowDebugConsole" button and generate both an audio and video sdp file for your desktop.

In future, I plan to just SCP these files (n900videostrm.sdp, n900audiostrm.sdp) over to the desktop PC from within the app, but that's later.
After generating the sdp file, you can then click "Send sdp to Linux Desktop" if you are a linux user, where it will prompt you for username and password and then send it straight to your PC's desktop.

For now just play around with it: choose your settings -> hit stream -> open sdp file on desktop.
(then point your desktop webcam at your pc screen, maximise VLC, and show the people on AIM or MSN, the ups and downs of your neighbourhood or the state of your room or even the inside of your fridge....)


PS: BIG thanks to gionni88 who pointed me in the right direction and saved me from hoooours of painful work, and justice4all3000 for finding the workaround, and leetnoob who thoroughly tested it and found major bugs. Thanks guys!

0.0.3 Fixed: Bug where wrong sdp is generated, hopefully implemented workaround for titans power kernel.

latest deb:External Mirror

justice4all3000 2011-03-08 00:00

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
just installed it and i have been unable to connect to the stream any advice?

gionni88 2011-03-08 09:43

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Installed, and it works ofc. Good job!

Some points:

Do you kill the process directly? I guess you do, since the front camera indicator led doesn't shut down as it should. You have to stop it with terminate() and after few secs you kill it. In this way it has time to handle its own close events (like shutting down front camera led indicator).

Window title is "MainWindow", guess you have already realized it.

Settings don't get saved between one session and another one: you may use QSettings to do it.

Ui is fingerfoe: have you set a main layout in desiner? Top right corner (object subwindow) > right click on main window > layout> vertical layout.

ShowDebug button is not so needed, it can be swapped with maemo standard banners (QMaemo5InformationBox, and add QT += maemo5 in project file, than run qmake) to save space.

The calibrate window is in window style? Use a message box with detailed text instead (QMessageBox) to be more hildon oriented.

Binary is a bit big just to be a front end. Have you compiled it as release or debug?

Package is not optified, it installs in /usr/local/bin

tetris11_ 2011-03-08 11:57

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Quote:

Originally Posted by justice4all3000 (Post 962832)
just installed it and i have been unable to connect to the stream any advice?

Did you type in your desktop PC's IP address at the top, and then generate an sdp file for it? You have to copy that generated file onto your PC before you can stream anything.

lolloo 2011-03-08 12:09

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
when clicking Generate sdp file, it freezes and craches.

tetris11_ 2011-03-08 12:25

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Quote:

Originally Posted by gionni88 (Post 963034)
Installed, and it works ofc. Good job!
Do you kill the process directly? I guess you do, since the front camera indicator led doesn't shut down as it should.

The led doesnt shut down? It does for me. And I kill it with a "killall gst-launch-0.10" command, which seems to work well... but yeah I dont terminate the QProcess....its gonna be tricky terminating from another function. I currently just use:
Code:

QProcess*proc = new QProcess();
proc->start(streamout);

where streamout is just the string "gst-launch blah". How do I make proc accessible from another function? I've already tried adding "QProcess proc;" to the private slot in the header like I would with any other shared variable, but it doesnt work.

Quote:

Originally Posted by gionni88 (Post 963034)
Settings don't get saved between one session and another one: you may use QSettings to do it.

Ah yeah I forgot about that, that should be easy to do

Quote:

Originally Posted by gionni88 (Post 963034)
Ui is fingerfoe: have you set a main layout in desiner?

Yep, but the buttons stretched too big, so I set maximum policies on them..... guesss they're too small now huh? :-D

Quote:

Originally Posted by gionni88 (Post 963034)
ShowDebug button is not so needed, it can be swapped with maemo standard banners (QMaemo5InformationBox, and add QT += maemo5 in project file, than run qmake) to save space.

definitely, I just needed something to output to (Im not sure how to output to the qconsole...

Quote:

Originally Posted by gionni88 (Post 963034)
The calibrate window is in window style? Use a message box with detailed text instead (QMessageBox) to be more hildon oriented.

Nope, it's actually a qwidget that lies over the mainwindow as hidden at startup. for some reason I can't hide it again, so I have to inefficiently QSize it to nothing....

Quote:

Originally Posted by gionni88 (Post 963034)
Binary is a bit big just to be a front end. Have you compiled it as release or debug?
Package is not optified, it installs in /usr/local/bin

It's debug, I didnt realise there was a difference.... and opt will not be a problem..

Thanks for the feedback man, I can't promise I'll get it done soon since I've been ignoring other work of mine... but hopefully in a few weeks...:D

Edit: I also forgot to add dependencies, and am now editing my control file....

tetris11_ 2011-03-08 12:35

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Quote:

Originally Posted by lolloo (Post 963107)
when clicking Generate sdp file, it freezes and craches.

Ah sorry, I think I know why that happens...
Can you print me the full readout of "sudo ifconfig" from your phone?
(do: "sudo ifconfig > /home/user/MyDocs/output.txt" and then copy that file)


ALSO: wow I cant believe I forgot to mention this:: you need to have gst-tools and rootsh installed before using this app. VERY IMPORTANT. I'm implementing this in now.

justice4all3000 2011-03-08 13:52

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
yeah i entered my computers ip address and generated the sdp for it could it be a firewall or router issue?

tetris11_ 2011-03-08 14:32

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
well you need to post me the output so I can see what going on.
I think it crashes because you don't have rootsh installed on your system, so the "sudo ifconfig" command is not recognised.

Or if you do, then you have other connections other than "wlan0".

But I really need to see that output before I change anything.

CrckMc 2011-03-08 21:37

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
hey thanks for your app but unfortunately it doesn't work for me either.
when i click on generate file it just crash.
theres no output.txt so heres what i get when i launch it from a root terminal:

Nokia-N900:~# tester
ASSERT failure in QList<T>::at: "index out of range", file /home/tetris11/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-20.2010.36-2-slim//usr/include/QtCore/qlist.h, line 455
Aborted

hope this helps you

tetris11_ 2011-03-08 22:26

Re: [Maemo 5] Camera stream from N900 to PC? (N900 as webcam)
 
Cheers, but Im fairly new at this and have no idea what that error means or what it references to...

Im pretty sure this is related to your ifconfig output, so can you just do:
"sudo ifconfig > /home/user/MyDocs/output.txt" on your device, then copy the output.txt here?


All times are GMT. The time now is 09:53.

vBulletin® Version 3.8.8