Motion video capturing and remote web video monitoring based on USB camera

Source: Internet
Author: User

Http://www.geek-workshop.com/thread-3559-1-1.html

I. First, make sure that the USB camera can be used,

Copy and print bash code

 
 
  1. CD/Dev
  2. Ls|GrepVideo
  3. If the name of a device is video0 (the numbers of multiple cameras increase progressively ),

2. This solution uses motion, a simple tool. Let's install the bash code and copy and print it.

 
 
  1. sudo apt-get update
  2. sudo apt-get install motion

3. Configure motion. confbash to copy and print code

 
 
  1. sudo nano /etc/motion/motion.conf

CTRL + W search for "target_dir" followed by an image/video file storage location
CTRL + W search for "control_localhost" and change on to off to allow non-local access to the HTTP Console

CTRL + x y save and exit

4. Start Motion

Pi @ raspberrypi/dev $ sudo Motion

[0] processing Thread 0-config file/etc/motion. conf
[0] motion 3.2.12 started
[0] FFMPEG libavcodec_build 3482368 libavformat_build 3478784
[0] thread 1 is from/etc/motion. conf
[0] motion-httpd/3.2.12 running, accepting connections
[0] motion-HTTPd: Waiting for data on port tcp 8080
[1] thread 1 started
[1] Cap. DRIVER: "uvcvideo"
[1] Cap. Card: "HD pro webcam c920"
[1] Cap. bus_info: "usb-bcm2708_usb-1.2"
[1] Cap. Capabilities = 0x04000001
[1]-video_capture
[1]-streaming
[1] Test palette yuyv (640x480)
[1] using palette yuyv (640x480) bytesperlines 1280 sizeimage 614400 colorspace 00000008
[1] Found Control 0x00980900, "brightness", range 0,255
[1] "brightness", default-8193, current 128
[1] Found Control 0x00980901, "contrast", range 0,255
[1] "contrast", default 57343, current 128
[1] Found Control 0x00980902, "saturation", range 0,255
[1] "saturation", default 57343, current 128
[1] Found Control 0x00980913, "gain", range 0,255
[1] "gain", default 57343, current 0
[1] MMAP information:
[1] frames = 4
[1] 0 length = 614400
[1] 1 Length = 614400
[1] 2 length = 614400
[1] 3 length = 614400
[1] Using v4l2
[1] resizing pre_capture buffer to 1 items

5. Remote Control of motion

Remotely access "http: // ip: 8080" through a browser for control

For more information about these configurations, see the motion wiki.
Http://www.lavrsen.dk/twiki/bin/view/motion/config options in webhome. Here, I will explain only a few of them.
Daemon off, disable deamon mode. It is best to choose off. Otherwise, after running motion, it will run directly in the background. You need to use the top command to check the PID of motion and then manually kill the process.
When the locate on setting detects motion in the image, place the motion area in a rectangle.
Videodevice/dev/video0 is used to set the device that loads the USB camera. Generally, this is video0. When using network webcam, you need to set netcam_url. In this case, the videodevice option will automatically fail.
Threshold_tune off sets whether to automatically adjust the motion detection threshold. When it is set to on, the next setting threshold 4500 will automatically expire. When off is set, threshold can be used to specify the number of pixel changes detected, and it is determined that there is motion in the image.
Ffmpeg_cap_new on indicates that videos are recorded during detect to motion.
Ffmpeg_video_codec msmpeg4 sets the Video Encoder
Target_dir/root/motion/snapshots: Specifies the path where images and videos are saved when motion is detected. The default value is/var/lib/motion/snapshots.
Snapshot_interval 1 sets the automatic image acquisition cycle. When a motion is detected, the acquisition frequency increases automatically.



Webcam_localhost must be set to off when you use the online video of remote port 8081.

After writing a mess, I have very limited ability to describe. I hope new people can understand it. Based on the principle of being able to share some ideas, it would be great if I could help some people. If you have any questions, please reply and learn from each other.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.