Skip to content

MediaDurationRecursiveChecker is a Python script to calculate the total duration and size of media files (video/audio) in a directory, supporting formats like `.mp3`, `.mp4`, `.avi`, `.mkv`, `.mov`, `.wav`, and `.flac`, with recursive scanning, progress bar, and JSON output.

License

Notifications You must be signed in to change notification settings

thiswillbeyourgithub/MediaDurationRecursiveChecker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MediaDurationRecursiveChecker

Une version française de ce fichier README est disponible : README_fr.md
A French version of this README is available: README_fr.md

Screenshot of the GUI

MediaDurationRecursiveChecker

This Python script calculates the total duration of media files (video/audio) in a directory and estimates the total processing time. It was created to help estimate the total duration of daily/rush footage on a hard drive. The project was renamed from FileSizeTreeChecker to MediaDurationRecursiveChecker to better reflect its purpose.

Features

  • Supports common media formats: .mp3, .mp4, .avi, .mkv, .mov, .wav, .flac
  • Recursively scans directories
  • Excludes hidden files (those starting with '.')
  • Provides:
    • Total number of media files
    • Total size in GB
    • Total duration of all files (and estimation every 10 files)
    • Verbose output with individual file durations
    • Results optionally saved to JSON file

Requirements

  • Python 3.6+ (only tested on 3.8 and 3.11)
  • moviepy (for media duration extraction)
  • pyperclip (to handle copying and pasting the path)

Installation and Usage

You have two options to run MediaDurationRecursiveChecker:

1. Run from Source (GUI)

  1. Install required Python packages:
# On macOS:
sudo python3 -m pip install moviepy pyperclip

# On other platforms:
pip install moviepy pyperclip
  1. Ensure ffmpeg is installed on your system
  2. Run the script:
python MediaDurationRecursiveChecker.py
  1. Use the graphical interface to select folders and process files

2. Build Your Own Executable

If you prefer to build it yourself:

  1. Install PyInstaller:
pip install pyinstaller
  1. Build the executable:
pyinstaller --onefile --name MediaDurationRecursiveChecker MediaDurationRecursiveChecker.py --noconsole --hidden-import=imageio_ffmpeg
  1. The executable will be in the dist directory

Note: This has been tested to work on macOS 11 when using the command:

sudo pyinstaller --onefile --windowed --name MediaDurationRecursiveChecker MediaDurationRecursiveChecker.py --clean

A pre-compiled .app for macOS is available in the 1.0.1 release.

Output Example

Found 1234 media files (456.78 GB)
Processing files: 100%|████████████████████| 1234/1234 [12:34<00:00,  1.23it/s]
Current: 12h 34m | Estimated total: 15h 30m

Total duration: 15h 30m
Results saved to media_durations.json

JSON Output Format

The output JSON file contains:

{
  "/path/to/file.mp4": {
    "duration": 3600,  // in seconds
    "size": 1048576   // in bytes
  },
  ...
}

Notes

  • Files are processed in random order to provide better time estimates
  • The script handles errors gracefully, skipping files it can't process

About

MediaDurationRecursiveChecker is a Python script to calculate the total duration and size of media files (video/audio) in a directory, supporting formats like `.mp3`, `.mp4`, `.avi`, `.mkv`, `.mov`, `.wav`, and `.flac`, with recursive scanning, progress bar, and JSON output.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages