How chcolte/auto-video-compressor works
• Service Manager (systemd): Represented by the auto_video_compressor.service file that manages the lifecycle of the script.
• Compression Script (autovideocompressor.sh): The core automation process that executes the compression logic.
• Directories:
• WATCH_DIR: The monitored input directory containing original videos.
• OUTPUT_DIR: The destination directory for compressed videos.
• PROCESSED_DIR: The directory where original files are moved after compression.
• External Dependency: ffmpeg – the tool used for actual video compression.
• Logging: A log component indicating where the process writes execution details (log_file.log).
Relationships and Data Flow
• systemd launches the script process using the auto_video_compressor.service when the daemon starts.
• The script continuously monitors WATCH_DIR for new videos.
• When a video is detected, the script calls ffmpeg (with FFMPEG_OPTIONS) to compress the video.
• The compressed video is output to OUTPUT_DIR.
• The original file is then moved to PROCESSED_DIR.
• Throughout this flow, the script logs its actions to the log file specified (LOG_FILE).
• Optionally, indicate the SLEEP_INTERVAL that determines how often the script checks the directory, representing a polling mechanism.
Architectural Patterns
• Daemon Pattern: The script runs continuously as a background service via systemd.
• Polling Mechanism: The script uses a sleep interval to repeatedly check the WATCH_DIR.
• Separation of Concerns: The system is modular with clear responsibilities—system management (systemd), file monitoring/processing (script), and external media processing (ffmpeg).
Incorporate Relevant Technologies
• systemd for process management.
• ffmpeg for media conversion.
• Bash scripting for automation and control.
• File system directories for organizing input, output, and processed videos.