Add Unlicense and ship ffmpeg's GPL license in release archives

The project is now public domain under the Unlicense (LICENSE, README).

The packaged archives bundle GPL ffmpeg/ffprobe builds but did not include
their license. fetch_ffmpeg.py now extracts the build's LICENSE.txt into
ffmpeg/LICENSE.txt, and build.py --ffmpeg-dir copies it into the archive as
ffmpeg-LICENSE.txt, failing before the PyInstaller run if it can't find one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-06 18:18:55 +00:00
parent bf0d661eed
commit fb2b5ce91f
4 changed files with 94 additions and 29 deletions

View File

@@ -1,7 +1,8 @@
"""Build a single-file GUI executable for the current OS with PyInstaller.
python build.py # -> dist/FFmpegWrapper(.exe)
python build.py --ffmpeg-dir DIR # also copy ffmpeg + ffprobe from DIR next to the exe
python build.py --ffmpeg-dir DIR # also copy ffmpeg + ffprobe from DIR next to the exe,
# plus ffmpeg's LICENSE from DIR or its parent,
# and pack everything into a .zip / .tar.gz
PyInstaller cannot cross-compile: run this on Windows to get the .exe and on
@@ -21,12 +22,29 @@ IS_WINDOWS = sys.platform.startswith("win")
EXE = ".exe" if IS_WINDOWS else ""
def find_ffmpeg_license(ffmpeg_dir: Path) -> Path | None:
"""ffmpeg's license file. BtbN and gyan.dev builds keep it one level above bin/."""
for folder in (ffmpeg_dir, ffmpeg_dir.parent):
for name in ("LICENSE.txt", "LICENSE", "ffmpeg-LICENSE.txt"):
if (folder / name).is_file():
return folder / name
return None
def main() -> int:
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
ap.add_argument("--ffmpeg-dir", type=Path, help="folder containing ffmpeg and ffprobe to bundle")
ap.add_argument("--onedir", action="store_true", help="build a folder instead of a single file (faster start-up)")
args = ap.parse_args()
if args.ffmpeg_dir:
# Check before the slow PyInstaller run: ffmpeg is GPL, so its license must ship with it.
ffmpeg_license = find_ffmpeg_license(args.ffmpeg_dir)
if ffmpeg_license is None:
print(f"error: no ffmpeg license (LICENSE.txt or LICENSE) in {args.ffmpeg_dir} or its parent "
"folder. ffmpeg is GPL, so the license has to be packaged with it.", file=sys.stderr)
return 1
import PyInstaller.__main__
from ffwrap import __version__
@@ -56,7 +74,7 @@ def main() -> int:
print(f"\nBuilt {built}")
if args.ffmpeg_dir:
# Stage <exe or onedir tree> + ffmpeg + ffprobe in one folder and archive it.
# Stage <exe or onedir tree> + ffmpeg + ffprobe + ffmpeg's license in one folder and archive it.
stage = dist / "package" / NAME
shutil.rmtree(stage.parent, ignore_errors=True)
if args.onedir:
@@ -70,7 +88,8 @@ def main() -> int:
print(f"error: {src} not found", file=sys.stderr)
return 1
shutil.copy2(src, stage)
plat = "windows-x64" if IS_WINDOWS else "linux-x64"
shutil.copy2(ffmpeg_license, stage / "ffmpeg-LICENSE.txt")
plat ="windows-x64" if IS_WINDOWS else "linux-x64"
archive = shutil.make_archive(
str(dist / f"{NAME}-{__version__}-{plat}"), "zip" if IS_WINDOWS else "gztar",
root_dir=stage.parent, base_dir=NAME)