How motion-project/motion works
Motion monitors camera video for image changes. Camera input is acquired from local devices or network streams, processed per camera for motion detection, and can produce snapshots, recordings, and web-accessible views; configuration, scheduling, logging, and database support round out the runtime. The excerpts directly show camera setup for network/libcamera sources, motion-difference processing, and snapshot handling. Other links are limited to references in the source index or are marked unverified because the relevant implementation was not shown.
Main entry points: camera.cpp Camera handler · webu_ans.cpp Request handling · motion.cpp Application runtime · webu.cpp Web server
Components 31
Runtime and configuration
- Application runtime
src/motion.cpp - Configuration
src/conf.cpp - Scheduling
src/schedule.cpp - Logging
src/logger.hpp
Capture and detection
- Camera handler
src/camera.cpp - V4L2 capture
src/video_v4l2.cpp - Network capture
src/netcam.cpp - libcamera capture
src/libcam.cpp - Motion detection
src/alg.cpp - Secondary detection
src/alg_sec.cpp - Image drawing
src/draw.cpp
Media outputs
- Movie recording
src/movie.cpp - Snapshots and images
src/picture.cpp - Video conversion
src/video_convert.cpp - JPEG utilities
src/jpegutils.cpp - Image rotation
src/rotate.cpp - Video loopback
src/video_loopback.cpp - Sound processing
src/sound.cpp
Web and persistence
- Web server
src/webu.cpp - Request handling
src/webu_ans.cpp - Video streams
src/webu_stream.cpp - All-camera view
src/webu_allcam.cpp - Database
src/dbse.cpp - Web controls
src/webu_post.cpp - JSON responses
src/webu_json.cpp - MPEG-TS output
src/webu_mpegts.cpp - File responses
src/webu_file.cpp - Text responses
src/webu_text.cpp - Image requests
src/webu_getimg.cpp
Other components
- Operator
- Camera input
Connections 32
- Operator → Configuration: configures
- Camera input → Camera handler: supplies video
- Camera handler → Network capture: starts capture
src/camera.cpp - Camera handler → libcamera capture: creates capture
src/camera.cpp - Camera handler → Motion detection: computes differences
src/camera.cpp - Camera handler → Snapshots and images: processes snapshots
src/camera.cpp - Application runtime → Camera handler: coordinates
- Application runtime → Configuration: uses settings
- Camera handler → V4L2 capture: selects capture
- Camera handler → Secondary detection: invokes detection
- Camera handler → Image drawing: renders images
- Camera handler → Movie recording: records events
- Camera handler → Image rotation: rotates images
- Camera handler → Video loopback: outputs video
- Application runtime → Scheduling: uses schedule
- Application runtime → Sound processing: starts sound
- Application runtime → Database: starts database
- Application runtime → Web server: starts web
- Operator → Web server: requests views
- Web server → Request handling: dispatches requests
src/webu.cpp - Request handling → Web controls: routes controls
src/webu_ans.cpp - Request handling → JSON responses: routes JSON
src/webu_ans.cpp - Request handling → Video streams: routes streams
src/webu_ans.cpp - Request handling → File responses: routes files
src/webu_ans.cpp - Request handling → Text responses: routes text
src/webu_ans.cpp - Request handling → MPEG-TS output: routes MPEG-TS
src/webu_ans.cpp - Web server → All-camera view: dispatches view
src/webu.cpp - Web server → Image requests: dispatches images
- Video streams → JPEG utilities: uses utilities
- MPEG-TS output → Snapshots and images: uses images
- Snapshots and images → Database: records metadata
- Movie recording → Database: records metadata