• Motion on Ubuntu


    Motion is a program that monitors the video signal from one or more cameras and is able to detect if a significant part of the picture has changed.

    The program is written in C and is made for the Linux operating system, (using the video4linux interface). Motion is a command line based tool whose output can be either jpeg, ppm fies or mpeg video sequences. Motion is strictly command line driven and can run as a daemon with a rather small footprint and do.

    Motion is the perfect tool for keeping an eye on your property, keeping only those images that are interesting.

    installation on ubuntu

    sudo apt-get install motion

    使用Motion利用USB摄像头录制视频

    1.在用户目录下(~)创建.motion文件夹,将/etc/motion下的motion.conf复制到~/.motion下,并获得其修改权限。Motion读取配置文件的优先级是~/.motion/motion.conf;/etc/motion/motion.conf。监视多个摄像头则读取thread1.conf;thread2.conf,以此类推。

    2.修改~/.motion/motion.conf文件,近涉及视频录制部分

    # Image width (pixels). Valid range: Camera dependent, default: 352 %画面宽度
    width 1280

    # Image height (pixels). Valid range: Camera dependent, default: 288 %画面高度
    height 720

    # Maximum number of frames to be captured per second. %帧率即FPS
    # Valid range: 2-100. Default: 100 (almost no limit).
    framerate 25

    # Output 'normal' pictures when motion is detected (default: on) %关闭图片输出
    # Valid values: on, off, first, best, center
    # When set to 'first', only the first picture of an event is saved.
    # Picture with most motion of an event is saved when set to 'best'.
    # Picture with motion nearest center of picture is saved when set to 'center'.
    # Can be used as preview shot for the corresponding movie.
    output_normal off

    # Codec to used by ffmpeg for the video compression. %视频编码
    # Timelapse mpegs are always made in mpeg1 format independent from this option.
    # Supported formats are: mpeg1 (ffmpeg-0.4.8 only), mpeg4 (default), and msmpeg4.
    # mpeg1 - gives you files with extension .mpg
    # mpeg4 or msmpeg4 - gives you files with extension .avi
    # msmpeg4 is recommended for use with Windows Media Player because
    # it requires no installation of codec on the Windows client.
    # swf - gives you a flash film with extension .swf
    # flv - gives you a flash video with extension .flv
    # ffv1 - FF video codec 1 for Lossless Encoding ( experimental )
    # mov - QuickTime ( testing )
    ffmpeg_video_codec mpeg4

    # Target base directory for pictures and films %输出文件夹
    # Recommended to use absolute path. (Default: current working directory)
    target_dir /tmp/motion

    3.motion命令启动视频录制

    4.Ctrl+c退出视频录制

    website

    http://sourceforge.net/projects/motion/
    http://www.lavrsen.dk/foswiki/bin/view/Motion/WebHome
    http://www.lavrsen.dk/foswiki/bin/view/Motion/MotionGuide

    ref

    http://blog.csdn.net/shulianghe/article/details/8230352

    ERROR: V4L2_CID_PRIVATE_BASE undeclared

    gcc -g -O2 -D_REENTRANT -DMOTION_V4L2 -DMOTION_V4L2_OLD -DTYPE_32BIT="int" -DHAVE_BSWAP   -march=i686 -Wall -DVERSION="3.2.11" -Dsysconfdir="/usr/local/etc"    -c -o track.o track.c
    track.c: In function ‘uvc_center’:
    track.c:587:29: error: storage size of ‘control_s’ isn’t known
    track.c:589:24: error: ‘V4L2_CID_PRIVATE_BASE’ undeclared (first use in this function)
    track.c:589:24: note: each undeclared identifier is reported only once for each function it appears in
    track.c:592:24: error: ‘VIDIOC_S_CTRL’ undeclared (first use in this function)
    track.c:601:31: error: storage size of ‘queryctrl’ isn’t known
    track.c:605:24: error: ‘VIDIOC_QUERYCTRL’ undeclared (first use in this function)
    track.c:601:31: warning: unused variable ‘queryctrl’ [-Wunused-variable]
    track.c:587:29: warning: unused variable ‘control_s’ [-Wunused-variable]
    track.c:636:25: error: storage size of ‘control_s’ isn’t known
    track.c:636:25: warning: unused variable ‘control_s’ [-Wunused-variable]
    track.c: In function ‘uvc_move’:
    track.c:724:29: error: storage size of ‘control_s’ isn’t known
    track.c:726:24: error: ‘V4L2_CID_PRIVATE_BASE’ undeclared (first use in this function)
    track.c:729:24: error: ‘VIDIOC_S_CTRL’ undeclared (first use in this function)
    track.c:724:29: warning: unused variable ‘control_s’ [-Wunused-variable]
    track.c:779:25: error: storage size of ‘control_s’ isn’t known
    track.c:779:25: warning: unused variable ‘control_s’ [-Wunused-variable]

    inserted "*#include <linux/videodev2.h>*" into track.h on line 13, just after the alg.h include

    ref: http://sourceforge.net/mailarchive/forum.php?thread_name=50133364.7050501%40depowell.com&forum_name=motion-user

  • 相关阅读:
    关于万门大学api接口反爬措施的解决
    磁盘
    汇编实验九
    汇编语言第六章-包含多个段的程序
    汇编实验四
    汇编实验二
    汇编语言实验四
    汇编语言第四章——第一个程序
    汇编语言第三章——寄存器(内存访问)
    汇编语言第二张寄存器
  • 原文地址:https://www.cnblogs.com/snigoal/p/3188596.html
Copyright © 2020-2023  润新知