kids-video-renamer
v1.0.1
Published
Rename children's video files based on their age at the time of recording
Maintainers
Readme
Kids Video Renamer
Automatically rename children's video files based on their age at the time of recording.
Features
- 📅 Extracts creation date from multiple sources (filename, macOS metadata, file modification time)
- 🎂 Calculates child's age at the time of recording
- 📝 Renames files in the format:
{Name}_{Years}Y{Months}M_{Sequence}.{ext} - 👀 Preview mode to see changes before applying
- 🔄 Safe two-phase rename to avoid conflicts
Installation
Global Installation (Recommended)
npm install -g kids-video-renamerLocal Installation
npm install kids-video-renamerUsage
Command Line
# Preview mode (default)
kids-rename . --name Cindy --birthday 2018-04-18
# Execute rename
kids-rename . --name Cindy --birthday 2018-04-18 --execute
# Short form
kids-rename . -n Cindy -b 2018-04-18 -e
# Specify directory
kids-rename /path/to/videos -n Cindy -b 2018/04/18 -eOptions
[directory]- Video directory (default: current directory)-n, --name <name>- Child's name (required)-b, --birthday <date>- Birthday in YYYY-MM-DD or YYYY/MM/DD format (required)-d, --dry-run- Preview mode (default)-e, --execute- Actually execute the rename operation-V, --version- Output version number-h, --help- Display help information
Example
Before
Video 2019-7-22.mov
DJI_20240728111023.mp4
2021-05-19 17-52-42.movAfter
If the child's name is "Cindy" and birthday is "2018-04-18":
Cindy_1Y3M_1.mov # 1 year 3 months old
Cindy_6Y3M_1.mp4 # 6 years 3 months old
Cindy_3Y1M_1.mov # 3 years 1 month oldSupported Video Formats
.mov.mp4.m4v.avi.mkv
Date Detection
The tool tries to extract the creation date in the following order:
Filename patterns:
Video 2019-7-22or影片 2020-2-52021-05-19 17-52-42.movDJI_20240728111023
macOS metadata (using
mdlscommand)File modification time (fallback)
How It Works
- Scans the directory for video files
- Extracts creation date from each file
- Calculates the child's age (years and months) at that date
- Generates new filename:
{Name}_{Years}Y{Months}M_{Sequence}.{ext} - Sequence numbers are auto-incremented for videos from the same age period
- Uses two-phase rename to avoid conflicts
Programmatic Usage
const { renameVideos } = require('kids-video-renamer');
renameVideos({
directory: './videos',
name: 'Cindy',
birthday: '2018-04-18',
execute: true
});Requirements
- Node.js >= 14.0.0
- macOS (for
mdlsmetadata extraction, optional)
License
MIT
Contributing
Issues and pull requests are welcome!
