#ffmpeg #directory #watch #run

app ffwatch

Watch a directory for changes and run ffmpeg

3 releases

new 0.1.2 Mar 10, 2025
0.1.1 Mar 10, 2025
0.1.0 Mar 9, 2025

#62 in Video

42 downloads per month

GPL-3.0-or-later

18KB
120 lines

ffwatch

ffwatch is a simple tool to watch a directory for changes and run ffmpeg when a change is detected.

Files found in the directory that have an allowed extension will be enqueued and processed by ffmpeg.

Installation

cargo install ffwatch

Usage

Best used with docker. Create a docker-compose.yml file with the following content:

services:
  ffwatch:
    image: arbezerra/ffwatch:latest
    volumes:
      - ./data:/data
    devices:
      - /dev/dri:/dev/dri
    command:
      [
        "-c:v",
        "libx264",
        "-crf",
        "20",
        "-preset",
        "ultrafast",
        "-c:a",
        "aac",
        "-b:a",
        "128k",
      ]

Then run:

docker compose up

You can customize with environment variables:

Variable Description Default
WATCH_DIR Directory to watch /data/watch
COMPLETE_DIR Directory to move completed files /data/complete
TRANSCODING_DIR Directory to store currently transcoding files /data/transcoding
ALLOWED_EXTENSIONS Comma separated list of allowed extensions mkv,mp4,avi,mov,flv
HWACCEL FFmpeg hardware acceleration auto
PUID User ID of the resulting files 1000
PGID Group ID of the resulting files 1000

Dependencies

~0.4–7MB
~44K SLoC