updated for multi platform
This commit is contained in:
parent
0ac5f369f1
commit
0411025384
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@ backend/nsfwapp.exe
|
|||||||
backend/web/dist
|
backend/web/dist
|
||||||
backend/recorder_settings.json
|
backend/recorder_settings.json
|
||||||
backend/data/pending-autostart/__global__.json
|
backend/data/pending-autostart/__global__.json
|
||||||
|
backend/.gocache
|
||||||
|
|||||||
@ -19,7 +19,6 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -617,10 +616,7 @@ func extractVideoFrameAt(ctx context.Context, outPath string, atSec float64) (im
|
|||||||
)
|
)
|
||||||
|
|
||||||
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000, // CREATE_NO_WINDOW
|
|
||||||
}
|
|
||||||
|
|
||||||
if out, err := cmd.CombinedOutput(); err != nil {
|
if out, err := cmd.CombinedOutput(); err != nil {
|
||||||
return nil, appErrorf("ffmpeg fehlgeschlagen: %v: %s", err, strings.TrimSpace(string(out)))
|
return nil, appErrorf("ffmpeg fehlgeschlagen: %v: %s", err, strings.TrimSpace(string(out)))
|
||||||
@ -756,10 +752,7 @@ func extractVideoFramesBatch(
|
|||||||
pattern,
|
pattern,
|
||||||
)
|
)
|
||||||
|
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000,
|
|
||||||
}
|
|
||||||
|
|
||||||
expectedFrames := int(math.Ceil(durationSec / float64(intervalSeconds)))
|
expectedFrames := int(math.Ceil(durationSec / float64(intervalSeconds)))
|
||||||
if expectedFrames < 1 {
|
if expectedFrames < 1 {
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -152,10 +151,7 @@ func generatePreviewSpriteJPG(
|
|||||||
)
|
)
|
||||||
|
|
||||||
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000, // CREATE_NO_WINDOW
|
|
||||||
}
|
|
||||||
|
|
||||||
var stderr bytes.Buffer
|
var stderr bytes.Buffer
|
||||||
cmd.Stderr = &stderr
|
cmd.Stderr = &stderr
|
||||||
|
|||||||
@ -1,8 +1,16 @@
|
|||||||
@echo off
|
@echo off
|
||||||
setlocal
|
setlocal
|
||||||
|
|
||||||
|
cd /d "%~dp0"
|
||||||
|
|
||||||
|
set "LOCAL_GOCACHE=%CD%\.gocache-build"
|
||||||
|
if exist "%LOCAL_GOCACHE%" rmdir /s /q "%LOCAL_GOCACHE%" >nul 2>nul
|
||||||
|
set "GOCACHE=%LOCAL_GOCACHE%"
|
||||||
|
|
||||||
echo Baue Windows x64...
|
echo Baue Windows x64...
|
||||||
|
|
||||||
|
if exist nsfwapp.exe del /q nsfwapp.exe >nul 2>nul
|
||||||
|
|
||||||
set GOOS=windows
|
set GOOS=windows
|
||||||
set GOARCH=amd64
|
set GOARCH=amd64
|
||||||
set CGO_ENABLED=1
|
set CGO_ENABLED=1
|
||||||
@ -13,10 +21,25 @@ if errorlevel 1 goto error
|
|||||||
echo.
|
echo.
|
||||||
echo Baue Debian/Linux x64 via WSL...
|
echo Baue Debian/Linux x64 via WSL...
|
||||||
|
|
||||||
for /f "delims=" %%i in ('wsl wslpath -a "%CD%"') do set "WSL_CWD=%%i"
|
if exist nsfwapp-linux-amd64 del /q nsfwapp-linux-amd64 >nul 2>nul
|
||||||
|
|
||||||
wsl --cd "%WSL_CWD%" bash -lc "GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o nsfwapp-linux-amd64"
|
where wsl >nul 2>nul
|
||||||
|
if errorlevel 1 goto wsl_missing
|
||||||
|
|
||||||
|
set "WSL_CWD="
|
||||||
|
for /f "delims=" %%i in ('wsl wslpath -a "%CD%" 2^>nul') do set "WSL_CWD=%%i"
|
||||||
|
if "%WSL_CWD%"=="" goto wsl_path_error
|
||||||
|
if not "%WSL_CWD:~0,1%"=="/" goto wsl_missing
|
||||||
|
|
||||||
|
wsl bash -lc "command -v go >/dev/null 2>&1"
|
||||||
|
if errorlevel 1 goto wsl_go_missing
|
||||||
|
|
||||||
|
wsl bash -lc "command -v gcc >/dev/null 2>&1 && command -v pkg-config >/dev/null 2>&1"
|
||||||
|
if errorlevel 1 goto wsl_build_deps_missing
|
||||||
|
|
||||||
|
wsl bash -lc "cd ""%WSL_CWD%"" && mkdir -p .gocache-linux && GOOS=linux GOARCH=amd64 CGO_ENABLED=1 GOCACHE=""$PWD/.gocache-linux"" go build -o nsfwapp-linux-amd64"
|
||||||
if errorlevel 1 goto error
|
if errorlevel 1 goto error
|
||||||
|
if not exist nsfwapp-linux-amd64 goto linux_output_missing
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo Build erfolgreich.
|
echo Build erfolgreich.
|
||||||
@ -27,8 +50,72 @@ goto end
|
|||||||
:error
|
:error
|
||||||
echo.
|
echo.
|
||||||
echo Build fehlgeschlagen.
|
echo Build fehlgeschlagen.
|
||||||
|
call :cleanup_cache
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:wsl_missing
|
||||||
|
echo.
|
||||||
|
echo Debian/Linux-Build braucht eine installierte WSL-Linux-Distribution.
|
||||||
|
echo Aktuell kann WSL nicht gestartet werden.
|
||||||
|
echo.
|
||||||
|
echo Einmalig installieren, z.B.:
|
||||||
|
echo wsl --install -d Debian
|
||||||
|
echo.
|
||||||
|
echo In Debian danach die Build-Abhaengigkeiten installieren:
|
||||||
|
echo sudo apt update
|
||||||
|
echo sudo apt install -y build-essential pkg-config libgtk-3-dev libayatana-appindicator3-dev
|
||||||
|
echo.
|
||||||
|
call :cleanup_cache
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:wsl_go_missing
|
||||||
|
echo.
|
||||||
|
echo In WSL ist Go nicht installiert oder nicht im PATH.
|
||||||
|
echo.
|
||||||
|
echo In Debian installieren:
|
||||||
|
echo sudo apt update
|
||||||
|
echo sudo apt install -y golang-go
|
||||||
|
echo.
|
||||||
|
echo Falls Debian eine zu alte Go-Version installiert, installiere Go passend zu go.mod von go.dev
|
||||||
|
echo und setze PATH in ~/.profile oder ~/.bashrc, z.B.:
|
||||||
|
echo export PATH=/usr/local/go/bin:$PATH
|
||||||
|
echo.
|
||||||
|
call :cleanup_cache
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:wsl_build_deps_missing
|
||||||
|
echo.
|
||||||
|
echo In WSL fehlen Build-Abhaengigkeiten fuer den Linux-Build.
|
||||||
|
echo.
|
||||||
|
echo In Debian installieren:
|
||||||
|
echo sudo apt update
|
||||||
|
echo sudo apt install -y build-essential pkg-config libgtk-3-dev libayatana-appindicator3-dev
|
||||||
|
echo.
|
||||||
|
call :cleanup_cache
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:wsl_path_error
|
||||||
|
echo.
|
||||||
|
echo WSL-Pfad konnte nicht aus dem Windows-Pfad erzeugt werden:
|
||||||
|
echo %CD%
|
||||||
|
call :cleanup_cache
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:linux_output_missing
|
||||||
|
echo.
|
||||||
|
echo Debian/Linux-Build wurde nicht erzeugt:
|
||||||
|
echo nsfwapp-linux-amd64
|
||||||
|
echo.
|
||||||
|
echo Pruefe, ob in WSL eine Debian/Ubuntu-Distribution mit Go und den Build-Abhaengigkeiten installiert ist.
|
||||||
|
call :cleanup_cache
|
||||||
exit /b 1
|
exit /b 1
|
||||||
|
|
||||||
:end
|
:end
|
||||||
|
call :cleanup_cache
|
||||||
endlocal
|
endlocal
|
||||||
pause
|
exit /b 0
|
||||||
|
|
||||||
|
:cleanup_cache
|
||||||
|
if defined LOCAL_GOCACHE if exist "%LOCAL_GOCACHE%" rmdir /s /q "%LOCAL_GOCACHE%" >nul 2>nul
|
||||||
|
if exist "%CD%\.gocache-linux" rmdir /s /q "%CD%\.gocache-linux" >nul 2>nul
|
||||||
|
exit /b 0
|
||||||
|
|||||||
9
backend/exec_hidden_other.go
Normal file
9
backend/exec_hidden_other.go
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
//go:build !windows
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import "os/exec"
|
||||||
|
|
||||||
|
func hideCommandWindow(cmd *exec.Cmd) {
|
||||||
|
_ = cmd
|
||||||
|
}
|
||||||
19
backend/exec_hidden_windows.go
Normal file
19
backend/exec_hidden_windows.go
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
//go:build windows
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os/exec"
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
func hideCommandWindow(cmd *exec.Cmd) {
|
||||||
|
if cmd == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd.SysProcAttr = &syscall.SysProcAttr{
|
||||||
|
HideWindow: true,
|
||||||
|
CreationFlags: 0x08000000, // CREATE_NO_WINDOW
|
||||||
|
}
|
||||||
|
}
|
||||||
46
backend/file_ops_other.go
Normal file
46
backend/file_ops_other.go
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
//go:build !windows
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
func moveFile(src, dst string) error {
|
||||||
|
if err := os.Rename(src, dst); err == nil {
|
||||||
|
return nil
|
||||||
|
} else {
|
||||||
|
in, err2 := os.Open(src)
|
||||||
|
if err2 != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer in.Close()
|
||||||
|
|
||||||
|
out, err2 := os.Create(dst)
|
||||||
|
if err2 != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if _, err2 := io.Copy(out, in); err2 != nil {
|
||||||
|
_ = out.Close()
|
||||||
|
return err2
|
||||||
|
}
|
||||||
|
if err2 := out.Close(); err2 != nil {
|
||||||
|
return err2
|
||||||
|
}
|
||||||
|
return os.Remove(src)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func isSharingViolation(err error) bool {
|
||||||
|
_ = err
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func removeWithRetry(path string) error {
|
||||||
|
return os.Remove(path)
|
||||||
|
}
|
||||||
|
|
||||||
|
func renameWithRetry(oldPath, newPath string) error {
|
||||||
|
return os.Rename(oldPath, newPath)
|
||||||
|
}
|
||||||
@ -17,7 +17,6 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -571,10 +570,7 @@ func startPreviewHLS(ctx context.Context, job *RecordJob, m3u8URL, previewDir, h
|
|||||||
)
|
)
|
||||||
|
|
||||||
cmd := exec.CommandContext(ctx, ffmpegPath, hqArgs...)
|
cmd := exec.CommandContext(ctx, ffmpegPath, hqArgs...)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000, // CREATE_NO_WINDOW
|
|
||||||
}
|
|
||||||
|
|
||||||
var stderr bytes.Buffer
|
var stderr bytes.Buffer
|
||||||
cmd.Stderr = &stderr
|
cmd.Stderr = &stderr
|
||||||
@ -868,10 +864,7 @@ func recordPreviewLiveFMP4(w http.ResponseWriter, r *http.Request) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000, // CREATE_NO_WINDOW
|
|
||||||
}
|
|
||||||
|
|
||||||
stdout, err := cmd.StdoutPipe()
|
stdout, err := cmd.StdoutPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -21,7 +21,6 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/grafov/m3u8"
|
"github.com/grafov/m3u8"
|
||||||
@ -319,10 +318,7 @@ func probeVideoProps(ctx context.Context, filePath string) (w int, h int, fps fl
|
|||||||
"-of", "json",
|
"-of", "json",
|
||||||
filePath,
|
filePath,
|
||||||
)
|
)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000, // CREATE_NO_WINDOW
|
|
||||||
}
|
|
||||||
|
|
||||||
out, err := cmd.Output()
|
out, err := cmd.Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -543,10 +539,7 @@ func durationSecondsCached(ctx context.Context, path string) (float64, error) {
|
|||||||
"-of", "default=noprint_wrappers=1:nokey=1",
|
"-of", "default=noprint_wrappers=1:nokey=1",
|
||||||
path,
|
path,
|
||||||
)
|
)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000, // CREATE_NO_WINDOW
|
|
||||||
}
|
|
||||||
|
|
||||||
out, err := cmd.Output()
|
out, err := cmd.Output()
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@ -562,10 +555,7 @@ func durationSecondsCached(ctx context.Context, path string) (float64, error) {
|
|||||||
|
|
||||||
// 2) Fallback: ffmpeg -i "Duration: HH:MM:SS.xx" parsen
|
// 2) Fallback: ffmpeg -i "Duration: HH:MM:SS.xx" parsen
|
||||||
cmd2 := exec.CommandContext(ctx, ffmpegPath, "-i", path)
|
cmd2 := exec.CommandContext(ctx, ffmpegPath, "-i", path)
|
||||||
cmd2.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd2)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000, // CREATE_NO_WINDOW
|
|
||||||
}
|
|
||||||
b, _ := cmd2.CombinedOutput() // ffmpeg liefert hier oft ExitCode!=0, Output ist trotzdem da
|
b, _ := cmd2.CombinedOutput() // ffmpeg liefert hier oft ExitCode!=0, Output ist trotzdem da
|
||||||
text := string(b)
|
text := string(b)
|
||||||
|
|
||||||
@ -1040,10 +1030,7 @@ func runRemuxTSToMP4AttemptWithProgress(
|
|||||||
)
|
)
|
||||||
|
|
||||||
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000, // CREATE_NO_WINDOW
|
|
||||||
}
|
|
||||||
|
|
||||||
stdout, err := cmd.StdoutPipe()
|
stdout, err := cmd.StdoutPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -1257,10 +1244,7 @@ func ensureFastStartMP4(path string) error {
|
|||||||
"-movflags", "+faststart",
|
"-movflags", "+faststart",
|
||||||
tmp,
|
tmp,
|
||||||
)
|
)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000, // CREATE_NO_WINDOW
|
|
||||||
}
|
|
||||||
|
|
||||||
var stderr bytes.Buffer
|
var stderr bytes.Buffer
|
||||||
cmd.Stderr = &stderr
|
cmd.Stderr = &stderr
|
||||||
@ -1877,10 +1861,7 @@ func reencodeTSToMP4(ctx context.Context, tsPath, mp4Path string) error {
|
|||||||
)
|
)
|
||||||
|
|
||||||
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000,
|
|
||||||
}
|
|
||||||
|
|
||||||
var stderr bytes.Buffer
|
var stderr bytes.Buffer
|
||||||
cmd.Stdout = io.Discard
|
cmd.Stdout = io.Discard
|
||||||
|
|||||||
BIN
backend/nsfwapp-linux-amd64
Normal file
BIN
backend/nsfwapp-linux-amd64
Normal file
Binary file not shown.
@ -30,7 +30,6 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"golang.org/x/image/font"
|
"golang.org/x/image/font"
|
||||||
@ -1256,10 +1255,7 @@ func extractLastFrameJPG(path string) ([]byte, error) {
|
|||||||
"-f", "image2pipe",
|
"-f", "image2pipe",
|
||||||
"pipe:1",
|
"pipe:1",
|
||||||
)
|
)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000, // CREATE_NO_WINDOW
|
|
||||||
}
|
|
||||||
|
|
||||||
var out bytes.Buffer
|
var out bytes.Buffer
|
||||||
var stderr bytes.Buffer
|
var stderr bytes.Buffer
|
||||||
@ -1298,10 +1294,7 @@ func extractFrameAtTimeJPG(path string, seconds float64) ([]byte, error) {
|
|||||||
"-f", "image2pipe",
|
"-f", "image2pipe",
|
||||||
"pipe:1",
|
"pipe:1",
|
||||||
)
|
)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000, // CREATE_NO_WINDOW
|
|
||||||
}
|
|
||||||
|
|
||||||
var out bytes.Buffer
|
var out bytes.Buffer
|
||||||
var stderr bytes.Buffer
|
var stderr bytes.Buffer
|
||||||
@ -1345,10 +1338,7 @@ func extractLastFrameJPGScaled(path string, width int, quality int) ([]byte, err
|
|||||||
"-f", "image2pipe",
|
"-f", "image2pipe",
|
||||||
"pipe:1",
|
"pipe:1",
|
||||||
)
|
)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000, // CREATE_NO_WINDOW
|
|
||||||
}
|
|
||||||
|
|
||||||
var out bytes.Buffer
|
var out bytes.Buffer
|
||||||
var stderr bytes.Buffer
|
var stderr bytes.Buffer
|
||||||
@ -1386,10 +1376,7 @@ func extractFirstFrameJPGScaled(path string, width int, quality int) ([]byte, er
|
|||||||
"-f", "image2pipe",
|
"-f", "image2pipe",
|
||||||
"pipe:1",
|
"pipe:1",
|
||||||
)
|
)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000, // CREATE_NO_WINDOW
|
|
||||||
}
|
|
||||||
|
|
||||||
var out bytes.Buffer
|
var out bytes.Buffer
|
||||||
var stderr bytes.Buffer
|
var stderr bytes.Buffer
|
||||||
@ -1441,10 +1428,7 @@ func extractLiveFrameFromM3U8ThumbJPG(ctx context.Context, m3u8URL, cookie, user
|
|||||||
)
|
)
|
||||||
|
|
||||||
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000, // CREATE_NO_WINDOW
|
|
||||||
}
|
|
||||||
|
|
||||||
var out bytes.Buffer
|
var out bytes.Buffer
|
||||||
var stderr bytes.Buffer
|
var stderr bytes.Buffer
|
||||||
|
|||||||
@ -15,7 +15,6 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/grafov/m3u8"
|
"github.com/grafov/m3u8"
|
||||||
@ -1030,10 +1029,7 @@ func muxAudioVideoSegmentFiles(
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000,
|
|
||||||
}
|
|
||||||
|
|
||||||
var stderr bytes.Buffer
|
var stderr bytes.Buffer
|
||||||
cmd.Stdout = io.Discard
|
cmd.Stdout = io.Discard
|
||||||
@ -1578,10 +1574,7 @@ func handleM3U8Mode(
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000,
|
|
||||||
}
|
|
||||||
|
|
||||||
var stderr bytes.Buffer
|
var stderr bytes.Buffer
|
||||||
cmd.Stdout = io.Discard
|
cmd.Stdout = io.Discard
|
||||||
|
|||||||
@ -71,10 +71,7 @@ func showAppNotification(title, message string) error {
|
|||||||
"-Command", ps,
|
"-Command", ps,
|
||||||
)
|
)
|
||||||
|
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000, // CREATE_NO_WINDOW
|
|
||||||
}
|
|
||||||
|
|
||||||
return cmd.Run()
|
return cmd.Run()
|
||||||
|
|
||||||
@ -577,10 +574,7 @@ func startAIServer(ctx context.Context) (*aiServerProcess, error) {
|
|||||||
cmd.Stderr = logWriter
|
cmd.Stderr = logWriter
|
||||||
|
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000, // CREATE_NO_WINDOW
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cmd.Start(); err != nil {
|
if err := cmd.Start(); err != nil {
|
||||||
|
|||||||
@ -15,7 +15,6 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -603,10 +602,7 @@ func splitSingleSegment(
|
|||||||
}
|
}
|
||||||
|
|
||||||
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000,
|
|
||||||
}
|
|
||||||
|
|
||||||
stdout, err := cmd.StdoutPipe()
|
stdout, err := cmd.StdoutPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -14,7 +14,6 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -123,10 +122,7 @@ func videoHasAudioStream(ctx context.Context, srcPath string) bool {
|
|||||||
"-of", "csv=p=0",
|
"-of", "csv=p=0",
|
||||||
srcPath,
|
srcPath,
|
||||||
)
|
)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000,
|
|
||||||
}
|
|
||||||
|
|
||||||
out, err := cmd.Output()
|
out, err := cmd.Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -238,10 +234,7 @@ func generateTeaserChunkMP4(
|
|||||||
args = append(args, "-movflags", "+faststart", tmp)
|
args = append(args, "-movflags", "+faststart", tmp)
|
||||||
|
|
||||||
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000,
|
|
||||||
}
|
|
||||||
|
|
||||||
var stderr bytes.Buffer
|
var stderr bytes.Buffer
|
||||||
cmd.Stderr = &stderr
|
cmd.Stderr = &stderr
|
||||||
@ -409,10 +402,7 @@ func generateTeaserPreviewMP4WithProgress(
|
|||||||
args = append(args, "-movflags", "+faststart", tmp)
|
args = append(args, "-movflags", "+faststart", tmp)
|
||||||
|
|
||||||
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000, // CREATE_NO_WINDOW
|
|
||||||
}
|
|
||||||
|
|
||||||
stdout, err := cmd.StdoutPipe()
|
stdout, err := cmd.StdoutPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -571,10 +561,7 @@ func generateTeaserMP4(ctx context.Context, srcPath, outPath string, startSec, d
|
|||||||
)
|
)
|
||||||
|
|
||||||
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
cmd := exec.CommandContext(ctx, ffmpegPath, args...)
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000,
|
|
||||||
}
|
|
||||||
|
|
||||||
if out, err := cmd.CombinedOutput(); err != nil {
|
if out, err := cmd.CombinedOutput(); err != nil {
|
||||||
_ = os.Remove(tmp)
|
_ = os.Remove(tmp)
|
||||||
|
|||||||
@ -22,7 +22,6 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"syscall"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -966,10 +965,7 @@ func trainingRunCommandStreaming(
|
|||||||
cmdArgs := append([]string{script}, args...)
|
cmdArgs := append([]string{script}, args...)
|
||||||
cmd := exec.CommandContext(ctx, python, cmdArgs...)
|
cmd := exec.CommandContext(ctx, python, cmdArgs...)
|
||||||
|
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000,
|
|
||||||
}
|
|
||||||
|
|
||||||
stdout, err := cmd.StdoutPipe()
|
stdout, err := cmd.StdoutPipe()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -1150,10 +1146,7 @@ func trainingRunCommand(python string, script string, args ...string) (string, e
|
|||||||
cmdArgs := append([]string{script}, args...)
|
cmdArgs := append([]string{script}, args...)
|
||||||
cmd := exec.Command(python, cmdArgs...)
|
cmd := exec.Command(python, cmdArgs...)
|
||||||
|
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000,
|
|
||||||
}
|
|
||||||
|
|
||||||
out, err := cmd.CombinedOutput()
|
out, err := cmd.CombinedOutput()
|
||||||
return strings.TrimSpace(string(out)), err
|
return strings.TrimSpace(string(out)), err
|
||||||
@ -4583,10 +4576,7 @@ func trainingExtractFrame(videoPath string, framePath string, second float64) er
|
|||||||
framePath,
|
framePath,
|
||||||
)
|
)
|
||||||
|
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000,
|
|
||||||
}
|
|
||||||
|
|
||||||
out, err := cmd.CombinedOutput()
|
out, err := cmd.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -4766,10 +4756,7 @@ func trainingPredictDetector(root string, framePath string) TrainingDetectorPred
|
|||||||
"--imgsz", "640",
|
"--imgsz", "640",
|
||||||
)
|
)
|
||||||
|
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000,
|
|
||||||
}
|
|
||||||
|
|
||||||
var stdout strings.Builder
|
var stdout strings.Builder
|
||||||
var stderr strings.Builder
|
var stderr strings.Builder
|
||||||
@ -4942,10 +4929,7 @@ func trainingPredictPose(root string, framePath string) TrainingPosePrediction {
|
|||||||
"--imgsz", "640",
|
"--imgsz", "640",
|
||||||
)
|
)
|
||||||
|
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000,
|
|
||||||
}
|
|
||||||
|
|
||||||
var stdout strings.Builder
|
var stdout strings.Builder
|
||||||
var stderr strings.Builder
|
var stderr strings.Builder
|
||||||
@ -6771,10 +6755,7 @@ func trainingProbeDurationSeconds(videoPath string) float64 {
|
|||||||
videoPath,
|
videoPath,
|
||||||
)
|
)
|
||||||
|
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000,
|
|
||||||
}
|
|
||||||
|
|
||||||
out, err := cmd.Output()
|
out, err := cmd.Output()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@ -13,7 +13,6 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -377,10 +376,7 @@ func trainingExtractVideoMAEClipFrames(
|
|||||||
filepath.Join(clipDir, "frame_%03d.jpg"),
|
filepath.Join(clipDir, "frame_%03d.jpg"),
|
||||||
)
|
)
|
||||||
|
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
hideCommandWindow(cmd)
|
||||||
HideWindow: true,
|
|
||||||
CreationFlags: 0x08000000,
|
|
||||||
}
|
|
||||||
|
|
||||||
out, err := cmd.CombinedOutput()
|
out, err := cmd.CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user