Files
Recordly/scripts/launch-recordly-cuda-auto.ps1
wiiiii123 9ac4c55ccf feat(export): prepare native GPU beta candidate
Add validated native CUDA/D3D11 timeline retime, pause-aware capture timing, webcam source-time sampling, edited-track audio duration padding, packaged helper updates, and focused tests for PR #410 tester branch.
2026-05-06 01:50:12 +07:00

84 lines
2.9 KiB
PowerShell

param(
[string]$AppPath,
[string]$CudaScriptPath,
[switch]$CloseExisting,
[switch]$NoDiagnostics,
[switch]$AllowCudaAudio
)
$ErrorActionPreference = "Stop"
$repoRoot = Resolve-Path (Join-Path $PSScriptRoot "..")
if (-not $AppPath) {
$packagedAppPath = Join-Path $repoRoot "release\win-unpacked\Recordly.exe"
$installedAppPath = Join-Path $env:LOCALAPPDATA "Programs\recordly\Recordly.exe"
if (Test-Path $packagedAppPath) {
$AppPath = $packagedAppPath
} elseif (Test-Path $installedAppPath) {
$AppPath = $installedAppPath
} else {
throw "Recordly.exe was not found. Build the Windows package first or pass -AppPath."
}
}
if (-not $CudaScriptPath) {
$CudaScriptPath = Join-Path $repoRoot "electron\native\nvidia-cuda-compositor\run-mp4-pipeline.mjs"
}
if (-not (Test-Path $AppPath)) {
throw "Recordly app not found: $AppPath"
}
if (-not (Test-Path $CudaScriptPath)) {
throw "NVIDIA CUDA/NVENC wrapper script not found: $CudaScriptPath"
}
$existingRecordly = @(Get-Process -Name "Recordly" -ErrorAction SilentlyContinue)
if ($existingRecordly.Count -gt 0) {
if (-not $CloseExisting) {
Write-Host "Recordly is already running. Close it first, or rerun with -CloseExisting so the CUDA env is inherited by the new app process."
$existingRecordly | Select-Object Id, ProcessName, Path | Format-Table -AutoSize
exit 2
}
$existingRecordly | Stop-Process -Force
Start-Sleep -Milliseconds 500
}
$env:RECORDLY_EXPERIMENTAL_NVIDIA_CUDA_EXPORT = "1"
$env:RECORDLY_NVIDIA_CUDA_EXPORT_SCRIPT = (Resolve-Path $CudaScriptPath).Path
$env:RECORDLY_NVIDIA_CUDA_EXPORT_HIGH_PRIORITY = "1"
$env:RECORDLY_NVIDIA_CUDA_SAMPLE_GPU = "1"
if ($AllowCudaAudio) {
$env:RECORDLY_NVIDIA_CUDA_ALLOW_AUDIO_EXPORT = "1"
Remove-Item Env:\RECORDLY_NVIDIA_CUDA_FORCE_VIDEO_ONLY -ErrorAction SilentlyContinue
} else {
Remove-Item Env:\RECORDLY_NVIDIA_CUDA_ALLOW_AUDIO_EXPORT -ErrorAction SilentlyContinue
$env:RECORDLY_NVIDIA_CUDA_FORCE_VIDEO_ONLY = "1"
}
if ($NoDiagnostics) {
Remove-Item Env:\RECORDLY_NVIDIA_CUDA_EXPORT_DIAGNOSTICS -ErrorAction SilentlyContinue
} else {
$env:RECORDLY_NVIDIA_CUDA_EXPORT_DIAGNOSTICS = "1"
}
$resolvedAppPath = (Resolve-Path $AppPath).Path
$appDirectory = Split-Path $resolvedAppPath -Parent
if ($AllowCudaAudio) {
$cudaAudioMode = "inline CUDA audio candidate; app still requires timestamp-aligned CUDA output"
} else {
$cudaAudioMode = "CUDA video-only, then shared app audio mux"
}
Write-Host "Launching Recordly with guarded NVIDIA CUDA/NVENC auto export enabled:"
Write-Host " App: $resolvedAppPath"
Write-Host " CUDA wrapper: $env:RECORDLY_NVIDIA_CUDA_EXPORT_SCRIPT"
Write-Host " Force CUDA video-only: $($env:RECORDLY_NVIDIA_CUDA_FORCE_VIDEO_ONLY -eq '1')"
Write-Host " CUDA audio exports: $cudaAudioMode"
Write-Host " Diagnostics: $($env:RECORDLY_NVIDIA_CUDA_EXPORT_DIAGNOSTICS -eq '1')"
Start-Process -FilePath $resolvedAppPath -WorkingDirectory $appDirectory