Skip to content

Commit 40eba96

Browse files
committed
Implemented debug mode
1 parent 8769791 commit 40eba96

File tree

5 files changed

+58
-6
lines changed

5 files changed

+58
-6
lines changed

README.MD

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ Follow these steps to use the Anime4K-GUI:
6060
**Higher level will cause worse quality**
6161
- Output format: Format for the output file - MP4 has best support on most devices.
6262
- Disable hardware acceleration: check it **ONLY** if you have performance or compatibility issues.
63+
- Debug mode: show more detailed logs, useful for troubleshooting and debugging
6364

6465
4. **Upscale the Video**
6566
- Click the "Start" button to begin the upscaling process.
@@ -69,6 +70,7 @@ Follow these steps to use the Anime4K-GUI:
6970
## Troubleshooting
7071

7172
If you encounter issues while using the application, please consult the [Issues](https://github.com/your_username/your_project/issues) section on the GitHub repository to check for solutions or report problems. <br>
73+
To get most debug logs run application with `--debug` parameter (mainly for hardware acceleration logs), and enable `Debug Mode` in settings (mainly for upscaling logs). <br>
7274
Issues regarding low output quality will be instantly closed. Problems like that are related to the original Anime4K shaders - I can recommend trying other Shaders mode settings. <br>
7375
Due to limited access to hardware, most tests were done with NVIDIA graphics cards; compatibility with other GPUs may be worse. If you have compatibility problems with your GPU, please create an issue with application logs and your computer's specifications.
7476

ffmpeg.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,9 @@ func searchHardwareAcceleration() {
103103

104104
for index, gpu := range gpus.GraphicsCards {
105105
vendor := strings.ToLower(gpu.DeviceInfo.Vendor.Name)
106+
107+
logDebug(fmt.Sprintf("GPU ID: %d, Vendor: %s", index, vendor), false)
108+
106109
if strings.Contains(vendor, "nvidia") {
107110
nvidia = true
108111
} else if strings.Contains(vendor, "amd") || strings.Contains(vendor, "advanced micro devices") {
@@ -116,10 +119,12 @@ func searchHardwareAcceleration() {
116119

117120
if (nvidia && intel) || (amd && intel) {
118121
intel = false
122+
logDebug("Ignoring Intel iGPU, detected NVIDIA/AMD dGPU)", false)
119123
}
120124

121125
if nvidia && amd { // AMD is iGPU
122126
amd = false
127+
logDebug("Ignoring AMD iGPU, detected NVIDIA dGPU", false)
123128
}
124129

125130
if nvidia {
@@ -141,6 +146,5 @@ func searchHardwareAcceleration() {
141146
// Something weird happened
142147
cvValue = ""
143148
logMessage("There's no available GPU acceleration, application may not work correctly! Please verify your GPU drivers or report bug on GitHub", false)
144-
145149
}
146150
}

gui.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func loop() {
2828
}
2929

3030
g.SingleWindow().Layout(
31-
g.SplitLayout(g.DirectionVertical, 500,
31+
g.SplitLayout(g.DirectionVertical, 515,
3232
g.SplitLayout(g.DirectionHorizontal, 1200,
3333
g.Layout{
3434
g.Table().Flags(g.TableFlagsResizable).Rows(buildTableRows()...).Columns(buildTableColumns()...),
@@ -57,11 +57,14 @@ func loop() {
5757

5858
g.Checkbox("Disable hardware acceleration", &disableHardwareAcceleration),
5959
g.Tooltip("Should be used only for bad performance or compatibility issues"),
60+
61+
g.Checkbox("Debug mode", &debug),
62+
g.Tooltip("Show more detailed logs, useful for troubleshooting and debugging"),
63+
6064
g.Label(""),
6165

6266
g.Button(buttonLabel).OnClick(handleButton).Size(360, 30),
6367

64-
g.Label(""),
6568
g.Label(""),
6669
g.Label("GPU Usage: " + gpuUsage),
6770
g.Label("VRAM Usage: " + vramUsage),

main.go

+28-3
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"syscall"
1010
)
1111

12-
const version = "1.0.2"
12+
const version = "1.0.3"
1313

1414
var (
1515

@@ -45,6 +45,7 @@ var (
4545
selectedCompressionPreset int32 = 2
4646
selectedOutputFormat int32
4747
disableHardwareAcceleration bool
48+
debug bool
4849

4950
// UI variables
5051
currentSpeed = "Speed:"
@@ -72,10 +73,11 @@ var (
7273
)
7374

7475
func main() {
76+
checkDebugParam()
7577
searchHardwareAcceleration()
7678
go monitorSensors()
7779

78-
window := g.NewMasterWindow("Anime4K-GUI", 1600, 935, g.MasterWindowFlagsNotResizable)
80+
window := g.NewMasterWindow("Anime4K-GUI", 1600, 950, g.MasterWindowFlagsNotResizable)
7981
window.SetDropCallback(handleDrop)
8082
window.Run(loop)
8183
}
@@ -108,6 +110,11 @@ func startProcessing() {
108110

109111
logMessage("Started upscaling! Upscaled videos will be saved in original directory, with _upscaled suffix in files name", false)
110112

113+
logDebug("Hardware acceleration param: "+hwaccelParam, false)
114+
logDebug("Hardware acceleration value: "+hwaccelValue, false)
115+
logDebug("CV value: "+cvValue, false)
116+
g.Update()
117+
111118
for index, anime := range animeList {
112119
if animeList[index].Status == Finished {
113120
continue
@@ -120,7 +127,25 @@ func startProcessing() {
120127

121128
outputPath := buildOutputPath(anime, outputFormat)
122129
ffmpegParams := buildUpscalingParams(anime, resolution, shadersMode, compressionPreset, outputPath)
123-
logMessage("FFMPEG params: ffmpeg.exe "+strings.Join(ffmpegParams, " "), false)
130+
131+
workingDirectory, err := os.Getwd()
132+
if err != nil {
133+
animeList[index].Status = Error
134+
buttonLabel = "Start"
135+
processing = false
136+
g.Update()
137+
handleSoftError("Getting working directory error:", err.Error())
138+
return
139+
}
140+
141+
logDebug("Working directory: "+workingDirectory, false)
142+
logDebug("Input path: "+anime.Path, false)
143+
logDebug("Output path: "+outputPath, false)
144+
logDebug("Target resolution: "+resolution.Format(), false)
145+
logDebug("Shaders: "+shadersMode.Path, false)
146+
logDebug("Compression preset (ffmpeg name): "+compressionPreset.FfmpegName, false)
147+
logDebug("Output format: "+outputFormat, false)
148+
logDebug("FFMPEG command: .\\ffmpeg.exe\\ffmpeg.exe "+strings.Join(ffmpegParams, " "), false)
124149
g.Update()
125150

126151
cmd := exec.Command(".\\ffmpeg\\ffmpeg.exe", ffmpegParams...)

utils.go

+18
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"fmt"
55
g "github.com/AllenDang/giu"
66
"log"
7+
"os"
78
"time"
89
)
910

@@ -24,6 +25,12 @@ func formatMillis(millis int64) string {
2425
return fmt.Sprintf("%02d:%02d:%02d", hours, minutes, seconds)
2526
}
2627

28+
func logDebug(message string, additionalLineBefore bool) {
29+
if debug {
30+
logMessage("[Debug] "+message, additionalLineBefore)
31+
}
32+
}
33+
2734
func logMessage(message string, additionalLineBefore bool) {
2835
if additionalLineBefore {
2936
logs += "\n"
@@ -59,6 +66,17 @@ func calcFinished() int {
5966
return i
6067
}
6168

69+
func checkDebugParam() {
70+
if len(os.Args) != 0 {
71+
for _, arg := range os.Args {
72+
if arg == "--debug" {
73+
debug = true
74+
break
75+
}
76+
}
77+
}
78+
}
79+
6280
func check(err error) {
6381
if err != nil {
6482
log.Fatal(err)

0 commit comments

Comments
 (0)