/filmcompress

Bulk recodes videos to HEVC with optional GPU acceleration

Primary LanguagePythonMIT LicenseMIT

filmcompress

This tool will bulk encode supported videos to HEVC (h.265) or AV1 format in given directory, with optional recursion and optional hardware acceleration. Primary use is recompression of multiple short videos from your phone or camera, defaults are tuned for this task. Will do its best to preserve metadata and quality.

Supported input file formats:

  • mov
  • mp4
  • m4a
  • mkv
  • webm
  • avi
  • 3gp

Supported GPUs

  • nVidia
  • Intel
  • AMD

Hardware support is off by default.

Supports Windows, Linux, macOS and probably other OSes.

About Roku mode

Made for fast reformatting videos for compatibility with Roku (and probably other smart TVs).

  • Container is mkv
  • Subtitles saved as embedded SRT
  • Audio is downmixed to stereo, normalized and transcoded to Opus 96k

This will allow soundtrack and subtitle selection, and reduces problems with sound quality.

About hardware encoding

Hardware encoder is multiple times faster, but software encoding (default) provides better quality and compatibility. My own testing shows that nVidia 20 series cards and later produce good results, but other cards may lack quality.

See benchmarks.

About AV1

Supports experimental av1 encoding with --av1. Any --gpu setting will be ignored. You may use amf as codec for AMD hardware support with 7xxx series Radeon and above. CPU Encoding is slow (hundreds of times slower than GPU HEVC), but will produce ~20% smaller file with same quality. Sound will be transcoded to 96K Opus with this option.

About FFmpeg

Command-line FFmpeg is used for transcoding - you must have it installed in your system.

Linux

pip install filmcompress
filmcompress --recursive /home/username/myvideos -o /home/username/myvideos/compressed

Windows

You can download and use it as single Windows binary, see Releases

Unfortunately antiviruses don't like packed Python executables, so expect false positives from them if you go this way. Best way is pip.

You will need ffmpeg binaries in path. It's best to extract 3 exe files from archive to %USERPROFILE%\AppData\Local\Microsoft\WindowsApps

Example use with nVidia hardware encoding:

./filmcompress.exe --gpu nvidia "c:\\Users\\username\\Pictures\\My Vacation" "c:\\Users\\username\\Pictures\\My Vacation\\compressed"

Remember, you need double slashes in Windows.

See also