Loading...
Loading...
Extracts frames at regular intervals from dashcam videos to create compact visual summaries of vehicle movement and location changes. This skill should be used when users need motion trajectory analysis, want to optimize dashcam storage by 90%+, need quick visual review of hours of footage, or want to create visual timelines of trips.
npx skill4agent add yousufjoyian/claude-skills motion-samplerExtract frames every 10 seconds from all Movie_F videos in the CARDV folder.
Sample frames from Movie_R dashcam videos, one frame every 15 seconds.
Create motion samples for all parking camera videos with 5-second intervals.
Extract representative frames from Movie_F and Movie_R for July 27-29, 2025.Movie_FMovie_RPark_FPark_RallMovie_FC:\Users\yousu\Desktop\CARDV{source_dir}/MOTION_SAMPLESYYYYMMDDYYYYMMDD-YYYYMMDD2025072720250727-20250729{output_dir}/
├── INDEX.csv # Comprehensive metadata
├── 20250727150654_052278A_F001_001000ms.jpg # Frame 1 at 1s
├── 20250727150654_052278A_F002_011000ms.jpg # Frame 2 at 11s
├── 20250727150654_052278A_F003_021000ms.jpg # Frame 3 at 21s
└── ...{YYYYMMDDHHMMSS}_{FILEIDA/B}_{POSITION}_{TIMESTAMP_MS}ms.jpg
Example: 20250727150654_052278A_F003_021000ms.jpg
└─────┬─────┘ └──┬──┘ └┬┘ └───┬───┘
Date/Time FileID Pos Timestamp
Components:
- YYYYMMDDHHMMSS: Video start time
- FILEIDA/B: Camera file ID + suffix (A=front, B=rear)
- F###: Frame position (F001, F002, F003...)
- ######ms: Milliseconds into videooriginal_video,frame_file,camera,date,position,timestamp_ms,timestamp_s,frame_number,file_size_kb
20250727150654_052278A.MP4,20250727150654_052278A_F001_001000ms.jpg,Movie_F,20250727,F001,1000,1.0,24,1713.06original_videoframe_filecameradatepositiontimestamp_mstimestamp_sframe_numberfile_size_kb| Interval | Frames/Video | Total Frames | Storage | Reduction |
|---|---|---|---|---|
| 5s | 12 | 5,016 | 9 GB | 80% |
| 10s | 7 | 2,926 | 5 GB | 89% |
| 15s | 5 | 2,090 | 3.7 GB | 92% |
| 30s | 3 | 1,254 | 2.2 GB | 95% |
timestamps = []
current_time = 1.0 # start offset
while current_time < (duration - 1.0):
timestamps.append(current_time)
current_time += sample_interval
timestamps.append(duration - 1.0) # always include endSKIP: video.MP4 too short (2.1s)
ERROR: Cannot open corrupted_video.MP4
WARNING: Failed to read frame 120 from video.MP4Use the motion-sampler skill to extract frames every 10 seconds from all Movie_F videos
in C:\Users\yousu\Desktop\CARDV. Save to MOTION_SAMPLES folder.Extract frames every 5 seconds from Movie_R videos on July 27, 2025.20250727*.MP4Create motion samples with 30-second intervals for all parking cameras (Park_F and Park_R)
to minimize storage while keeping a visual record.max_workersjpeg_qualitysample_intervalmin_durationmin_durationmax_workersG:\My Drive\PROJECTS\skills\motion-sampler\
├── skill.md # This file
├── README.md # Quick start guide
├── SKILL_MANIFEST.md # File inventory & testing
├── scripts/
│ ├── extract_motion_samples.py # Main extraction script
│ └── analyze_results.py # Post-processing analysis
├── assets/
│ ├── config_template.json # Default configuration
│ └── camera_mapping.json # Camera ID mapping
└── references/
├── SAMPLING_ALGORITHM.md # Detailed algorithm docs
└── PERFORMANCE_BENCHMARKS.md # Speed/storage benchmarks{
"camera": "Movie_F",
"source_dir": "C:\\Users\\yousu\\Desktop\\CARDV",
"output_dir": "C:\\Users\\yousu\\Desktop\\CARDV\\MOTION_SAMPLES",
"sample_interval": 10.0,
"jpeg_quality": 92,
"max_workers": 4,
"date_filter": null,
"min_duration": 3.0,
"use_nvdec": false
}{
"status": "success",
"videos_processed": 2146,
"frames_extracted": 15022,
"total_size_mb": 26750.5,
"avg_frames_per_video": 7.0,
"processing_time_s": 305.2,
"throughput_videos_per_sec": 7.03,
"output_dir": "C:\\Users\\yousu\\Desktop\\CARDV\\MOTION_SAMPLES",
"index_file": "C:\\Users\\yousu\\Desktop\\CARDV\\MOTION_SAMPLES\\INDEX.csv"
}