Saturday, March 22, 2014

4.3. How to get real-time video




In this article, I would like to explain how to get real-time video.





0. Overview of how to get real-time video


・Connect the Raspberry Pi to the web over Wi-Fi.

・Plug a webcam into the Raspberry Pi.

・Install Motion.
 Motion is a program that streams the video from webcam.
 It enables to check the video with a web browser.

・Configure Motion setting file.

・Run Motion.

・Check streaming video with a web browser.



1. Preparing for setting up

Before installing a program on the Raspberry Pi, it needs a number of hardware below.

・To connect to the web
  - Wi-Fi adapter
  - iPhone(for using tethering function)

・To operate the Raspberry Pi
  - Power adapter
  - Mouse
  - Keyboard
  - HDMI-HDMI lead or / DVI lead
  - Display or TV


If you prepare for the hardware above, please confirm below links whether the Raspberry Pi's verified peripherals.


 ・Check working / Non-working Wi-Fi adapters.
 ・Check working / Non-working SD cards.
 ・Check working / Non-working keyboards.
 ・Check working / Non-working mouses.
 ・Check working / Non-working webcams.
  


I use a webcam below this time.

 ・maker:ELECOM
 ・model number:UCAM-DLB200TABK 



2. Connect The Raspberry Pi to the web over Wi-Fi

Please refer to the previous article. I explained how to do this.



3. Plug a webcam into the Raspberry Pi

Please plug a webcam into the Raspberry Pi.

Please run a LXTerminal application, and input "lsusb" to check whether the Raspberry Pi confirms the webcam.




4. Install Motion

Please run a LXTerminal application, and input "sudo apt-get install motion" to install Motion. Its installation starts automatically.



5. Configure Motion setting file

The setting file of Motion exist at "/etc/default/motion".
Please run a LXTerminal application, and input "sudo vi/etc/default/motion" to configure its setting file.

Please configure the setting as shown below.

Itemsbeforeafter
daemonoffon
webcam_localhostonoff
control_localhostonoff
threshold150020000
webcam_maxrate130


Please refer to Motion's official site to check the setting details of above.



6. Run Motion

Please run a LXTerminal application, and input "sudo motion" to execute Motion application.

In some cases, an error message shows up as follows,

[0] Exit motion, cannot create process id file (pid file) /var/run/motion/motion.pid: No such file or directory

If the error message shows, please input "sudo mkdir -p /var/run/motion" to make a folder for Motion.



7. Check streaming video with a web browser

Please run a LXTerminal application, and input "sudo apt-get install chromium" to install brower. Chromium is an open-source browser.

After its installation, please run Chromium, and input its address bar either one of the two as follows.

・http:// (The Raspberry Pi's IP) :8081
・http://localhost:8081



As the picture shows, Motion streams real-time video and enables to check the video with a web browser.

If you can check the video, please input "sudo service motion stop" to stop motion.



In this article, I explained how to get real-time video. I would like to explain how to stream real-time video onto a smartphone in the next article.

No comments:

Post a Comment