Skip to content
Draft
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
9 changes: 7 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ on:
jobs:

build:
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

Expand All @@ -21,7 +25,8 @@ jobs:
with:
go-version: '1.25'

- name: Install system dependencies
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libxkbcommon-dev libxkbcommon-x11-dev libwayland-dev libvulkan-dev libx11-dev libx11-xcb-dev libxi-dev libxext-dev libegl-dev libgles-dev libxcursor-dev libxrandr-dev libxinerama-dev libxfixes-dev libgtk-3-dev pkg-config


Expand Down
41 changes: 41 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "GUI",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/gui"
},
{
"name": "CLI - Church (fetch github.com/struffel/simple-deflicker-test-data into ../simple-deflicker-test-data first)",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/cli",
"args": [
"-source",
"${workspaceFolder}/../simple-deflicker-test-data/real/church",
"-destination",
"${workspaceFolder}/../simple-deflicker-test-data/real/church/deflickered",
]
},
{
"name": "CLI - Clouds (fetch github.com/struffel/simple-deflicker-test-data into ../simple-deflicker-test-data first)",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/cli",
"args": [
"-source",
"${workspaceFolder}/../simple-deflicker-test-data/real/clouds",
"-destination",
"${workspaceFolder}/../simple-deflicker-test-data/real/clouds/deflickered",
]
}
]
}
32 changes: 8 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,30 @@ A minimalist, easy to use tool for deflickering image sequences such as timelaps
Timelapse flickering can occur if one or more settings of the camera have been left on "auto" which causes it to randomly switch between two settings (for example shutter speeds).

## How to use this software
* Download the latest version from the [releases page](https://github.com/StruffelProductions/simple-deflicker/releases). Prebuilt binaries are provided for Windows, and macOS builds are CLI-only.
* Execute `simple-deflicker.exe` on Windows to use the GUI. Check the console for error messages.
![image](https://user-images.githubusercontent.com/31403260/115123359-f2bbe400-9fbc-11eb-84d7-29615c5030fb.png)
* Download the latest version from the [releases page](https://github.com/struffel/simple-deflicker/releases). Prebuilt binaries are provided only for Windows at this time.
* Execute `simple-deflicker.exe` to use the GUI or `simple-deflicker-cli.exe` to use the CLI version.

## CLI usage
Simple Deflicker can run without the GUI by passing a source and destination directory:

```bash
simple-deflicker -source "/path/to/input" -destination "/path/to/output"
simple-deflicker-cli -source "/path/to/input" -destination "/path/to/output"
```

Optional flags:

```bash
simple-deflicker -source "/path/to/input" -destination "/path/to/output" -rollingAverage 15 -jpegCompression 95 -threads 8
simple-deflicker-cli -source "/path/to/input" -destination "/path/to/output" -rollingAverage 15 -format png -jpegQuality 95
```

Build a CLI-only binary:
## Building from source
The GUI and CLI are separate binaries, built from `./cmd/gui` and `./cmd/cli` respectively:

```bash
go build -tags cli -o simple-deflicker
go build -o simple-deflicker ./cmd/gui
go build -o simple-deflicker-cli ./cmd/cli
```

macOS builds are CLI-only:

```bash
GOOS=darwin GOARCH=arm64 go build -o simple-deflicker-macos-arm64
GOOS=darwin GOARCH=amd64 go build -o simple-deflicker-macos-amd64
```

On platforms built with the `cli` tag, the GUI is disabled and `-source` plus `-destination` are required.


## Current limitations of the tool
* Only JPG and PNG (8bit) are supported
* JPGs will always be saved with a compression setting of 95
Expand All @@ -48,10 +39,3 @@ On platforms built with the `cli` tag, the GUI is disabled and `-source` plus `-

## How does the deflickering work?
The current implementation uses a technique called [histogram matching](https://en.wikipedia.org/wiki/Histogram_matching). It basically creates a list of how often a certain brighness (or rather every individual brightness level) appears, creates a [rolling average](https://en.wikipedia.org/wiki/Moving_average) to allow for gradual brightness changes (for example in a day to night transition) and finally shifts the brightness to match the "smoothed out" brightness levels.

## How is the software structured? (only important for developers, not for users)
The software uses several other packages:
* [Imaging](https://github.com/disintegration/imaging) for loading, saving and manipulating image files.
* [dialog](https://github.com/sqweek/dialog) for creating the dialog boxes and file selection windows.
* [uiprogress](https://github.com/gosuri/uiprogress) for creating the progress bars in the console.
* [nucular](https://github.com/aarzilli/nucular) for the GUI.
34 changes: 34 additions & 0 deletions cmd/cli/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package main

import (
"fmt"
"os"

"github.com/struffel/simple-deflicker/internal/deflicker"
"github.com/struffel/simple-deflicker/internal/progress"
)

func main() {

// Read CLI parameters.
settings := deflicker.NewSettingsFromArgs()

// In CLI mode, check the settings immediately
validationErrors := settings.Validate()
if len(validationErrors) > 0 {
for _, err := range validationErrors {
fmt.Println(err)
}
os.Exit(1)
}

// Run the actual deflickering
deflickeringError := deflicker.Run(settings, &progress.ConsoleUpdater{})
if deflickeringError != nil {
fmt.Println("An error occured:")
fmt.Println(deflickeringError)
os.Exit(1)
}
os.Exit(0)

}
16 changes: 16 additions & 0 deletions cmd/gui/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package main

import (
"fmt"
"os"

"github.com/struffel/simple-deflicker/internal/ui"
)

func main() {
if err := ui.StartGUI(); err != nil {
fmt.Println(err)
os.Exit(1)
}
os.Exit(0)
}
56 changes: 0 additions & 56 deletions config.go

This file was deleted.

39 changes: 0 additions & 39 deletions files.go

This file was deleted.

28 changes: 18 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
module github.com/struffel/simple-deflicker

go 1.15
go 1.25.0

require (
github.com/aarzilli/nucular v0.0.0-20210203155122-9112adf75b4f
gioui.org v0.10.1
github.com/disintegration/imaging v1.6.2
github.com/gosuri/uilive v0.0.4 // indirect
github.com/gosuri/uiprogress v0.0.1
github.com/inancgumus/screen v0.0.0-20190314163918-06e984b86ed3
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/sqweek/dialog v0.0.0-20200911184034-8a3d98e8211d
golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad // indirect
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c // indirect
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf // indirect
github.com/ncruces/zenity v0.10.14
golang.org/x/sync v0.22.0
)

require (
gioui.org/shader v1.0.8 // indirect
github.com/akavel/rsrc v0.10.2 // indirect
github.com/dchest/jsmin v0.0.0-20220218165748-59f39799265f // indirect
github.com/go-text/typesetting v0.3.4 // indirect
github.com/josephspurrier/goversioninfo v1.4.1 // indirect
github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844 // indirect
golang.org/x/exp/shiny v0.0.0-20250408133849-7e4ce0ab07d0 // indirect
golang.org/x/image v0.26.0 // indirect
golang.org/x/net v0.48.0 // indirect
golang.org/x/sys v0.39.0 // indirect
golang.org/x/text v0.32.0 // indirect
)
Loading
Loading