Remote Compression#

PyPI Status Build Status Documentation Status License Code Coverage SWH

rcomp compresses videos in batch with ffmpeg — on this machine, or on a remote server over SSH.

Features#

  • Batch: point it at a directory, it recursively finds the videos worth compressing (already-compliant files are left alone) and shows progress bars.

  • Everything comes out as mkv: subtitles and odd containers (avi, wmv, flv…) stop breaking conversions; text subtitles are converted when needed.

  • Local or remote: -D my_server compresses on a server (Linux or Windows) through a single SSH connection for the whole batch; -D local (or a hostname that resolves to this machine) runs locally.

  • Robust remote: the workspace is created automatically, ffmpeg is checked at connection time, a lost connection is patiently re-established and the running encode is re-attached instead of relaunched.

  • Persistent preferences: a TOML file managed with rcomp config, with named presets; command-line flags always win.

  • Failure log: corrupt and non-profitable files are remembered (centrally, no droppings in your video folders) and skipped on the next runs; inspect it with rcomp failures.

  • Rotation-aware: phone videos with rotation metadata are sized by their display definition — a 1080x1920 portrait is 1080p, not “1920 tall”.

  • Old-source friendly: interlaced material (DVD, AVCHD) is deinterlaced automatically, and odd-dimension oddities no longer break the encoder.

Requirements#

  • ffmpeg and ffprobe in the local PATH.

  • For remote compression:

    • an entry in ~/.ssh/config for the server (private key; ProxyJump supported); -D user@alias is accepted too,

    • the SFTP service enabled on the server (Synology DSM ships with it disabled: Control Panel > File Services > FTP > SFTP),

    • ffmpeg in the PATH of the server (checked at connection, with a clear error message otherwise). The .rcomp workspace is created automatically.

Usage#

$ rcomp movies/                     # compress a directory on the default host
$ rcomp -D nas -P hard movies/      # named preset on a specific server
$ rcomp -D local -n movies/         # local dry-run: show what would be done
$ rcomp config --init               # create the configuration template
$ rcomp remote status               # inspect the server workspace
$ rcomp remote purge --older-than 7d
$ rcomp failures                    # see why files are being skipped
$ rcomp cleanup movies/             # remove legacy .keep files (rcomp < 0.2)
$ rcomp --help

Configuration lives in a TOML file whose location is shown by rcomp config (platform-dependent, e.g. %LOCALAPPDATA%/rcomp on Windows, ~/.config/rcomp on Linux). Notable keys: hostname (your default server), codec, crf, ffmpeg_preset, height, replace, extensions, remote_ffmpeg (explicit server-side binary path, when the non-interactive PATH misses it or the stock build lacks encoders — both typical on Synology), remote_workdir/remote_workdir_sftp (the workspace as seen by the shell and by SFTP respectively — Synology chroots SFTP into the share tree, so pair the default .rcomp with remote_workdir_sftp = "/home/.rcomp"), and [preset.X] tables for your own presets. Each run also writes a full debug log under the directory shown by rcomp config.

Note: rcomp TARGET is a shortcut for rcomp run TARGET; a target literally named config, cleanup, failures, remote or run must therefore be written rcomp run <target>.

Credits#

This package was created with Cookiecutter and the Package Helper 3 project template.