Skip to content

Run end-to-end tests #807

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Python
uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Nim
if: runner.os != 'macOS'
uses: jiro4989/setup-nim-action@v2
Expand All @@ -42,12 +46,15 @@ jobs:
elif [ "${{ matrix.os }}" = "macos-latest" ]; then
echo "MACOSX_DEPLOYMENT_TARGET=14.0" >> $GITHUB_ENV
fi
echo "DISABLE_HEVC=1" >> $GITHUB_ENV
- name: Build FFmpeg
run: nimble makeff
- name: Compile
run: nimble make
- name: Test
run: nimble test
- name: e2e Test
run: python3 -m pip install av && python3 tests/test.py

windows:
runs-on: ubuntu-latest
Expand All @@ -64,6 +71,7 @@ jobs:
sudo apt-get update
sudo apt-get install -y mingw-w64 mingw-w64-tools mingw-w64-x86-64-dev
sudo apt-get install -y build-essential pkg-config nasm git
echo "DISABLE_HEVC=1" >> $GITHUB_ENV
- name: Build FFmpeg
run: nimble makeffwin
- name: Compile
Expand Down
32 changes: 21 additions & 11 deletions ae.nimble
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ requires "checksums"
import std/os
import std/[strutils, strformat]

var disableHevc = (if getEnv("DISABLE_HEVC").len > 0: "-d:disable_hevc" else: "")

task test, "Test the project":
exec "nim c -r tests/rationals"
exec &"nim c {disableHevc} -r tests/rationals"

task make, "Export the project":
exec "nim c -d:danger --out:auto-editor src/main.nim"
exec &"nim c -d:danger {disableHevc} --out:auto-editor src/main.nim"
when defined(macosx):
exec "strip -ur auto-editor"
exec "stat -f \"%z bytes\" ./auto-editor"
Expand Down Expand Up @@ -58,6 +59,7 @@ type Package = object
sha256: string
buildArguments: seq[string]
buildSystem: string = "autoconf"
ffFlag: string = ""

let nvheaders = Package(
name: "nv-codec-headers",
Expand All @@ -69,43 +71,50 @@ let lame = Package(
sourceUrl: "http://deb.debian.org/debian/pool/main/l/lame/lame_3.100.orig.tar.gz",
sha256: "ddfe36cab873794038ae2c1210557ad34857a4b6bdc515785d1da9e175b1da1e",
buildArguments: @["--disable-frontend", "--disable-decoder", "--disable-gtktest"],
ffFlag: "--enable-libmp3lame",
)
let opus = Package(
name: "opus",
sourceUrl: "https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz",
sha256: "65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1",
buildArguments: @["--disable-doc", "--disable-extra-programs"],
ffFlag: "--enable-libopus",
)
let vpx = Package(
name: "libvpx",
sourceUrl: "https://github.com/webmproject/libvpx/archive/refs/tags/v1.15.2.tar.gz",
sha256: "26fcd3db88045dee380e581862a6ef106f49b74b6396ee95c2993a260b4636aa",
buildArguments: "--disable-dependency-tracking --disable-examples --disable-unit-tests --enable-pic --enable-runtime-cpu-detect --enable-vp9-highbitdepth".split(" "),
ffFlag: "--enable-libvpx",
)
let dav1d = Package(
name: "dav1d",
sourceUrl: "https://code.videolan.org/videolan/dav1d/-/archive/1.5.1/dav1d-1.5.1.tar.bz2",
sha256: "4eddffd108f098e307b93c9da57b6125224dc5877b1b3d157b31be6ae8f1f093",
buildSystem: "meson",
ffFlag: "--enable-libdav1d",
)
let svtav1 = Package(
name: "libsvtav1",
sourceUrl: "https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v3.1.0/SVT-AV1-v3.1.0.tar.bz2",
sha256: "8231b63ea6c50bae46a019908786ebfa2696e5743487270538f3c25fddfa215a",
buildSystem: "cmake",
buildArguments: @["-DBUILD_APPS=OFF", "-DBUILD_DEC=OFF", "-DBUILD_ENC=ON", "-DENABLE_NASM=ON"],
ffFlag: "--enable-libsvtav1",
)
let x264 = Package(
name: "x264",
sourceUrl: "https://code.videolan.org/videolan/x264/-/archive/32c3b801191522961102d4bea292cdb61068d0dd/x264-32c3b801191522961102d4bea292cdb61068d0dd.tar.bz2",
sha256: "d7748f350127cea138ad97479c385c9a35a6f8527bc6ef7a52236777cf30b839",
buildArguments: "--disable-cli --disable-lsmash --disable-swscale --disable-ffms --enable-strip".split(" "),
ffFlag: "--enable-libx264",
)
let x265 = Package(
name: "x265",
sourceUrl: "https://bitbucket.org/multicoreware/x265_git/downloads/x265_4.1.tar.gz",
sha256: "a31699c6a89806b74b0151e5e6a7df65de4b49050482fe5ebf8a4379d7af8f29",
buildSystem: "x265",
ffFlag: "--enable-libx265"
)
let ffmpeg = Package(
name: "ffmpeg",
Expand All @@ -115,7 +124,10 @@ let ffmpeg = Package(
var packages: seq[Package] = @[]
if not defined(macosx):
packages.add nvheaders
packages &= [lame, opus, vpx, dav1d, svtav1, x264, x265]
packages &= [lame, opus, vpx, dav1d, svtav1, x264]
if disableHevc.len == 0:
packages.add x265


func location(package: Package): string = # tar location
if package.name == "libvpx":
Expand Down Expand Up @@ -450,21 +462,19 @@ var commonFlags = &"""
--disable-indevs \
--disable-outdevs \
--disable-xlib \
--disable-bsfs \
--disable-filters \
--enable-filter=scale,pad,format,gblur,aformat,abuffer,abuffersink,aresample,atempo,anull,anullsrc,volume \
--enable-libmp3lame \
--enable-libopus \
--enable-libvpx \
--enable-libdav1d \
--enable-libsvtav1 \
--enable-libx264 \
--enable-libx265 \
--disable-encoder={encodersDisabled} \
--disable-decoder={decodersDisabled} \
--disable-demuxer={demuxersDisabled} \
--disable-muxer={muxersDisabled} \
"""

for package in packages:
if package.ffFlag != "":
commonFlags &= &" {package.ffFlag} \\\n"

if defined(arm) or defined(arm64):
commonFlags &= " --enable-neon \\\n"

Expand Down Expand Up @@ -535,7 +545,7 @@ task windows, "Cross-compile to Windows (requires mingw-w64)":
if not dirExists("build"):
echo "FFmpeg for Windows not found. Run 'nimble makeffwin' first."
else:
exec "nim c -d:danger --os:windows --cpu:amd64 --cc:gcc " &
exec "nim c -d:danger " & disableHevc & " --os:windows --cpu:amd64 --cc:gcc " &
"--gcc.exe:x86_64-w64-mingw32-gcc " &
"--gcc.linkerexe:x86_64-w64-mingw32-gcc " &
"--passL:-lbcrypt " & # Add Windows Bcrypt library
Expand Down
15 changes: 1 addition & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ requires = ["setuptools>=77"]

[project]
name = "auto-editor"
version = "29.0.0"
description = "Auto-Editor: Effort free video editing!"
readme = "README.md"
license = "Unlicense"
Expand All @@ -17,26 +18,12 @@ keywords = [
"processing", "nonlinear", "automatic", "silence-detect",
"silence-removal", "silence-speedup", "motion-detection",
]
dynamic = ["version"]

[tool.setuptools.packages]
find = {}

[tool.setuptools.dynamic]
version = {attr = "auto_editor.__version__"}

[project.urls]
"Bug Tracker" = "https://github.com/WyattBlue/auto-editor/issues"
"Source Code" = "https://github.com/WyattBlue/auto-editor"
homepage = "https://auto-editor.com"

[project.scripts]
"auto-editor" = "auto_editor.__main__:main"
aedesc = "auto_editor.cmds.desc:main"
aeinfo = "auto_editor.cmds.info:main"
aesubdump = "auto_editor.cmds.subdump:main"
aelevels = "auto_editor.cmds.levels:main"

[tool.mypy]
warn_unused_ignores = true
warn_redundant_casts = true
Expand Down
14 changes: 8 additions & 6 deletions src/ffmpeg.nim
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ when defined(macosx):
when defined(linux):
{.passL: "-L./build/lib/x86_64-linux-gnu -L./build/lib64"}
{.passL: "-L./build/lib -lavfilter -lavformat -lavcodec -lswresample -lswscale -lavutil".}
{.passL: "-lmp3lame -lopus -lvpx -lx264 -lx265 -ldav1d -lSvtAv1Enc -lm".}

when defined(macosx): # For x265
{.passL: "-lc++"}
else:
{.passL: "-lstdc++"}
{.passL: "-lmp3lame -lopus -lvpx -lx264 -ldav1d -lSvtAv1Enc".}

when not defined(disable_hevc):
{.passL: "-lx265".}
when defined(macosx):
{.passL: "-lc++"}
else:
{.passL: "-lstdc++"}
{.passL: "-lm".}

import std/posix

Expand Down
10 changes: 5 additions & 5 deletions tests/test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import argparse
import concurrent.futures
import hashlib
import os
import shutil
import subprocess
import sys
import argparse
from collections.abc import Callable
from fractions import Fraction
from hashlib import sha256
Expand All @@ -13,7 +13,6 @@

import av
from av import AudioStream, VideoStream

from ffwrapper import FileInfo
from log import Log

Expand Down Expand Up @@ -332,6 +331,7 @@ def test_premiere_named_export(self) -> None:
self.main(["example.mp4"], ["--export", 'premiere:name="Foo Bar"'])

def test_export_subtitles(self) -> None:
raise SkipTest() # TODO
# cn = fileinfo(self.main(["resources/mov_text.mp4"], [], "movtext_out.mp4"))

# assert len(cn.videos) == 1
Expand Down Expand Up @@ -516,6 +516,8 @@ def test_decode_hevc(self):
assert output.videos[0].pix_fmt == "yuv420p"

def test_encode_hevc(self):
if len(os.getenv("DISABLE_HEVC", "")) > 0:
raise SkipTest()
out = self.main(["resources/testsrc.mp4"], ["-c:v", "hevc"], "out.mkv")
output = fileinfo(out)
assert output.videos[0].codec == "hevc"
Expand Down Expand Up @@ -610,9 +612,7 @@ def main():
for name in dir(Runner)
if callable(getattr(Runner, name)) and name not in ["main", "raw", "check"]
}
tests.extend(
[test_methods[name] for name in ["info", "levels", "subdump", "desc"]]
)
tests.extend([test_methods[name] for name in ["info", "levels", "subdump", "desc"]])
tests.extend(
[
getattr(run, name)
Expand Down
Loading