Community
cancel
Showing results for 
Search instead for 
Did you mean: 
msoni1
New Contributor I
2,057 Views

imgae capture on intel edison using webcam

hey,

I want to interface USB camera with intel edison and want to have live video streaming over wifi connection on pc. I have followed GitHub tutorial for live video streaming using websocket as per given in below link.

https://github.com/drejkim/edi-cam drejkim/edi-cam · GitHub

At the same time i also want to capture image and store that image of the live video. How to capture image and store image on intel edison and further transmit to pc over wifi again. it would be very helpful if i get some proper guidance.

I am not that much aware of intel edison board.

Thanks,

Malay

18 Replies
Carlos_M_Intel
Employee
195 Views

Hi Malay,

If you are using FFMPEG to interact with the camera I suggest you to look into https://ffmpeg.org/ffmpeg.html the documentation of this package. Also, take a look at: https://trac.ffmpeg.org/ https://trac.ffmpeg.org/ and http://manpages.ubuntu.com/manpages/oneiric/man1/ffmpeg.1.html FFMPEG man

According to the FFMPEG man you can capture an image with: ffmpeg -f fbdev -vframes 1 -r 1 -i /dev/fb0 screenshot.jpeg

Once you have the image in your board it will depend on how you want to send it, you can create your https://github.com/MakersTeam/Edison/blob/master/JavaScript-Examples/SendImagetoWS.js own server, you can https://github.com/MakersTeam/Edison/blob/master/Python-Examples/Email/SendImage.py send it over email or you can http://download.intel.com/support/edison/sb/edison_wifi_331438001.pdf connect your Edison to another device

If what you want is to extract an image from the video you can try with the example: http://blog.roberthallam.org/2010/06/extract-a-single-image-from-a-video-using-ffmpeg/comment-page-1... Extract A Single Image From A Video Using FFMPEG

Regards

Charlie

msoni1
New Contributor I
195 Views

hey, CMata_Intel,

Thank you very much for your help.

I will go through it and let you know my further results.

Thanks,

Malay

msoni1
New Contributor I
195 Views

hello CMata_Intel,

is there any way to automatically start the video streaming via wifi as soon as i power on my edison. I have to configure it for live streaming by giving some commands.

Can you help me with this.?

Thanks,

Malay

msoni1
New Contributor I
195 Views

hello,

I have tried to capture image using ffmpeg, with the help of below code line.

./ffmpeg -s 320x240 -f video4linux2 -i /dev/video0 -vframes 1 image.jpeg

But i am not sure whether I am capturing image or not. I am not able to find the location where that image has been stored,

Can you tell me where that image is stored.?

Thanks,

Malay

msoni1
New Contributor I
195 Views

I am not sure I am going in right direction or not.

I have to interface usb camera to the intel edison and want live streaming on pc or tablet over wifi.

I also want to capture image when it is required.

What is the best way to do this.?

Please guide me for this.

Thanks,

 

Malay
Carlos_M_Intel
Employee
195 Views

Hi Malay,

Yes you can run a script at boot. For this you can create a .sh script and set it as an executable with chmod +x. Then, you have to create a service in /lib/systemd/system with the structure of [Unit] [Service] where you indicates to run the script. Once you have created the service you need to run the commands systemctl start yourservice.service and systemctl enable yourservice.service for make them run after every boot.

For example, if you want to run a python script at boot you need to do something like:

root@edison:~# vi script.sh

# !/bin/sh

/usr/bin/python /home/root/blink.py

In order to make it an executable

root@edison:~# chmod +x script.sh

Then, you must create the service

root@edison:~# vi /lib/systemd/system/blinkpy.service

# !/bin/sh

[Unit]

Description=Blink with Python

After=network.target

[Service]

ExecStart=/home/root/script.sh

Environment="HOME=/home/root"

WorkingDirectory=/home/root/

[Install]

WantedBy=multi-user.target

Finally, you need to start and enable the service

root@edison:~# systemctl daemon-reload

root@edison:~# systemctl start blinkpy.service

root@edison:~# systemctl enable blinkpy.service

After you used ./ffmpeg -s 320x240 -f video4linux2 -i /dev/video0 -vframes 1 image.jpeg are you getting a message in the Terminal Console? Have you checked with ls / ? I think you can also try with use ./ffmpeg -s 320x240 -f video4linux2 -i /dev/video0 -vframes 1 /home/root/image.jpeg.

Are you able to see video0 in /dev?

Were you able to run the server from the tutorial in https://github.com/drejkim/edi-cam drejkim/edi-cam · GitHub ?

Regards,

Charlie

msoni1
New Contributor I
195 Views

hey,

thanks for your reply.

yes, i am able to see video0 in /dev, but i tried the other command also you said which mention the location of image, but i couldn't find any file with image.jpeg.

when should i run this command, i run this command after i start streaming the video but i am not getting any result.

Thanks,

Malay

msoni1
New Contributor I
195 Views

hey CMata_Intel,

one more query is, can guide me how can i start this live streaming followed in https://github.com/drejkim/edi-cam drejkim/edi-cam · GitHub at boot startup.

Like when i power on my edison it should directly start streaming live video on laptop through wifi. So, the other thing is it also should get connected to available wifi.?

Thanks,

Malay

Carlos_M_Intel
Employee
195 Views

Hi Malay,

 

While you are streaming try to run the command ffmpeg -i /dev/video0 /home/root/picture1.jpg then you should have a file called picture1.jpg in /home/root

If you want to run the server at boot, you need to do the same thing I did in but with the server. You may need to include Environment=NODE_PATH=/usr/lib/node_modules while setting [Service] in your service.

Regards,

Charlie

Carlos_M_Intel
Employee
195 Views

Hi Malay,

Do you have updates on this?

Regards,

Charlie

msoni1
New Contributor I
195 Views

hey CMata_Intel

It's working now. I created a script file which runs my camera at boot startup.

One more query is, can you look on this https://github.com/drejkim/edi-cam drejkim/edi-cam · GitHub tutorial. The problem is i want to stream live video on any of the devices which are connected through wi-fi network. But I can only stream the video in my laptop through which i had configured my edison. when I click that link http://myedison.local:8080 http://myedison.local:8080 from other laptops which are already connected through the same wifi. It shows that the web page is not available.

Can you suggest me where i have to change in my code..

Thanks,

Malay

idata
Community Manager
195 Views

hi CMata_Intel

I'm streaming video successfully from my edison as given on this link https://github.com/drejkim/edi-cam drejkim/edi-cam · GitHub

 

but when I try to run the following command from ssh while streaming as u suggested, it gives me the following errors:-

 

 

 

./ffmpeg -s 320x240 -f video4linux2 -i /dev/video0 -vframes 1 image.jpeg

-sh: No such file or directory

ffmpeg -s 320x240 -f video4linux2 -i /dev/video0 -vframes 1 image.jpeg

-sh: ffmpeg: command not found

ffmpeg -f fbdev -vframes 1 -r 1 -i /dev/fb0 screenshot.jpeg

-sh: ffmpeg: command not found

I've already installed ffmpeg and I can stream video also. Then why this error shows "ffmpeg: command not found?"

I cannot take picture while streaming video with this command.

how can i solve this ??

Carlos_M_Intel
Employee
195 Views

Hi Malay_soni, I ran the tutorial edi-cam, I tested with an Edison running version 146 and I was able to use 4 different PCs as clients at the same time while using the same network

Are you having an error message while trying to see the stream on the other devices/PCs? Or is it that is not loading?

If the problem is that the devices are not loading the stream, it could be a problem with the network and not with the code itself.

Hi falak.desai@yahoo.com , the message "ffmpeg: command not found" is due to a proble m while searching the command/package/library. How did you installed ffmpeg? Did you install the latest version?

Regards,

Charlie

msoni1
New Contributor I
195 Views

Great..!!! Thanks for your the guidance.

I don't think there is any network problem. I will look into it and let you know.

Thanks,

Malay

jjun
Novice
195 Views

Hi, i managed to follow through the instructions on https://github.com/drejkim/edi-cam GitHub - drejkim/edi-cam: Video streaming on Intel Edison , my webcam is Logitech C270 however when i node server.js it only display

WebSocket server listening on port 8084 

HTTP server listening on port 8080

 

Listening for video stream on port 8082

There is a missing line of  

"Stream Connected: 127.0.0.1:52995 size: 320x240"

Also, when i run my web server of http://172.27.152.201:8084 http://172.27.152.201:8084 it only display a white screen with two words of "not implemented"

Can you suggest where did i go wrong?

Cheers!

Carlos_M_Intel
Employee
195 Views

Hi,

Which image are you running?

Are you getting the correct outputs after running find /lib/modules/* -name 'uvc', lsmod | grep uvc and ls -l /dev/video0?

On the edi-camedi-cam/web/client/index.html you need to put the IP address of the board and not the hostname.

Also, on the web browser you need to type the IPaddres:8080 in order to have access to the camera.

Regards,

Charlie

jjun
Novice
195 Views

Thankyou, I tried replacing 8084 with 8080 and I am able to run my server with http://172.27.152.201:8080/ http://172.27.152.201:8080/

However, now it only shows "Loading" instead only viewing my real-time footage of webcam.

Any idea where did i went wrong this time?

Yes I'm getting the correct outputs for the three commands.

Also, when i type in the following command:

configure_edison --version

It shows me a output of :159.devkit for my version of image.

Cheers!

Carlos_M_Intel
Employee
195 Views

Hi,

Check the file edi-cam/web/client/index.html and be sure that you have placed the correct IP address of your board in the 34th line for the wsUrl variable.

I got the same behavior but I checked again the IP address of my board with ifconfig noticing that the IP address had changed. Let me know if this is happening to you too.

Regards,

Charlie

Reply