Import json/strconv for thumbnail ffprobe parsing
This commit is contained in:
parent
93f4dcea76
commit
2389abffdd
|
|
@ -2,10 +2,12 @@ package thumbnail
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
25
main.go
25
main.go
|
|
@ -1645,9 +1645,30 @@ func (s *appState) saveBenchmarkRun(results []benchmark.Result, encoder, preset
|
||||||
func (s *appState) applyBenchmarkRecommendation(encoder, preset string) {
|
func (s *appState) applyBenchmarkRecommendation(encoder, preset string) {
|
||||||
logging.Debug(logging.CatSystem, "applied benchmark recommendation: encoder=%s preset=%s", encoder, preset)
|
logging.Debug(logging.CatSystem, "applied benchmark recommendation: encoder=%s preset=%s", encoder, preset)
|
||||||
|
|
||||||
|
// Map encoder to hardware acceleration setting
|
||||||
|
hwAccel := "none"
|
||||||
|
switch {
|
||||||
|
case strings.Contains(encoder, "nvenc"):
|
||||||
|
hwAccel = "nvenc"
|
||||||
|
case strings.Contains(encoder, "qsv"):
|
||||||
|
hwAccel = "qsv"
|
||||||
|
case strings.Contains(encoder, "amf"):
|
||||||
|
hwAccel = "amf"
|
||||||
|
case strings.Contains(encoder, "videotoolbox"):
|
||||||
|
hwAccel = "videotoolbox"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Map encoder to friendly codec to align Convert defaults
|
||||||
|
if codec := friendlyCodecFromPreset(encoder); codec != "" {
|
||||||
|
s.convert.VideoCodec = codec
|
||||||
|
}
|
||||||
|
s.convert.EncoderPreset = preset
|
||||||
|
s.convert.HardwareAccel = hwAccel
|
||||||
|
s.persistConvertConfig()
|
||||||
|
|
||||||
dialog.ShowInformation("Benchmark Settings Applied",
|
dialog.ShowInformation("Benchmark Settings Applied",
|
||||||
fmt.Sprintf("Recommended encoder noted:\n\nEncoder: %s\nPreset: %s\n\nYou can reference these settings in the Convert module.",
|
fmt.Sprintf("Applied recommended defaults:\n\nEncoder: %s\nPreset: %s\nHardware Accel: %s\n\nThese are now set as your Convert defaults.",
|
||||||
encoder, preset), s.window)
|
encoder, preset, hwAccel), s.window)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *appState) showBenchmarkHistory() {
|
func (s *appState) showBenchmarkHistory() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user