mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2025-08-20 10:18:32 +08:00
Expose FFmpeg Errors, Copy Only Part of Visual C++ Runtime
This commit is contained in:
parent
d4e729fed2
commit
e30242977b
14
.github/build_windows_packages.ps1
vendored
14
.github/build_windows_packages.ps1
vendored
@ -52,20 +52,19 @@ $tar = Get-ChildItem "$tmpDir" -Filter "*.tar" | Select-Object -First 1
|
|||||||
& "C:\Program Files\7-Zip\7z.exe" x $tar.FullName -o"$tmpDir\extracted" -aoa
|
& "C:\Program Files\7-Zip\7z.exe" x $tar.FullName -o"$tmpDir\extracted" -aoa
|
||||||
Move-Item "$tmpDir\extracted\python\install" "$srcDir\runtime"
|
Move-Item "$tmpDir\extracted\python\install" "$srcDir\runtime"
|
||||||
|
|
||||||
|
Write-Host "[INFO] Copying Redistributing Visual C++ Runtime..."
|
||||||
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
$vswhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
|
||||||
$vsPath = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
|
$vsPath = & $vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
|
||||||
$redistRoot = Join-Path $vsPath "VC\Redist\MSVC"
|
$redistRoot = Join-Path $vsPath "VC\Redist\MSVC"
|
||||||
Get-ChildItem $redistRoot
|
|
||||||
$targetVer = Get-ChildItem -Path $redistRoot -Directory |
|
$targetVer = Get-ChildItem -Path $redistRoot -Directory |
|
||||||
Where-Object { $_.Name -match "^14\." } |
|
Where-Object { $_.Name -match "^14\." } |
|
||||||
Sort-Object Name -Descending |
|
Sort-Object Name -Descending |
|
||||||
Select-Object -First 1
|
Select-Object -First 1
|
||||||
$x64Path = Join-Path $targetVer.FullName "x64"
|
$x64Path = Join-Path $targetVer.FullName "x64"
|
||||||
Write-Host 111
|
Get-ChildItem -Path $x64Path -Directory | Where-Object {
|
||||||
Get-ChildItem $x64Path
|
$_.Name -match '^Microsoft\..*\.(CRT|OpenMP)$'
|
||||||
Get-ChildItem -Path $x64Path -Directory -Filter "Microsoft.*" | ForEach-Object {
|
} | ForEach-Object {
|
||||||
Get-ChildItem -Path $_.FullName -Filter "*.dll" | ForEach-Object {
|
Get-ChildItem -Path $_.FullName -Filter "*.dll" | ForEach-Object {
|
||||||
Write-Host "Copy $($_.FullName)"
|
|
||||||
Copy-Item -Path $_.FullName -Destination "$srcDir\runtime" -Force
|
Copy-Item -Path $_.FullName -Destination "$srcDir\runtime" -Force
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -82,7 +81,6 @@ function DownloadAndUnzip($url, $targetRelPath) {
|
|||||||
if (Test-Path $destPath) {
|
if (Test-Path $destPath) {
|
||||||
Remove-Item $destPath -Recurse -Force
|
Remove-Item $destPath -Recurse -Force
|
||||||
}
|
}
|
||||||
|
|
||||||
Move-Item $sourcePath $destRoot
|
Move-Item $sourcePath $destRoot
|
||||||
Remove-Item $tmpZip
|
Remove-Item $tmpZip
|
||||||
}
|
}
|
||||||
@ -109,8 +107,8 @@ $ffZip = "$tmpDir\ffmpeg.zip"
|
|||||||
Invoke-WebRequest -Uri $ffUrl -OutFile $ffZip
|
Invoke-WebRequest -Uri $ffUrl -OutFile $ffZip
|
||||||
Expand-Archive $ffZip -DestinationPath $tmpDir -Force
|
Expand-Archive $ffZip -DestinationPath $tmpDir -Force
|
||||||
$ffDir = Get-ChildItem -Directory "$tmpDir" | Where-Object { $_.Name -like "ffmpeg*" } | Select-Object -First 1
|
$ffDir = Get-ChildItem -Directory "$tmpDir" | Where-Object { $_.Name -like "ffmpeg*" } | Select-Object -First 1
|
||||||
Move-Item "$($ffDir.FullName)\bin\ffmpeg.exe" "$srcDir"
|
Move-Item "$($ffDir.FullName)\bin\ffmpeg.exe" "$srcDir\runtime"
|
||||||
Move-Item "$($ffDir.FullName)\bin\ffprobe.exe" "$srcDir"
|
Move-Item "$($ffDir.FullName)\bin\ffprobe.exe" "$srcDir\runtime"
|
||||||
Remove-Item $ffZip
|
Remove-Item $ffZip
|
||||||
Remove-Item $ffDir.FullName -Recurse -Force
|
Remove-Item $ffDir.FullName -Recurse -Force
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
import ctypes
|
import ctypes
|
||||||
import glob
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import ffmpeg
|
import ffmpeg
|
||||||
@ -21,7 +19,7 @@ def load_audio(file, sr):
|
|||||||
# This launches a subprocess to decode audio while down-mixing and resampling as necessary.
|
# This launches a subprocess to decode audio while down-mixing and resampling as necessary.
|
||||||
# Requires the ffmpeg CLI and `ffmpeg-python` package to be installed.
|
# Requires the ffmpeg CLI and `ffmpeg-python` package to be installed.
|
||||||
file = clean_path(file) # 防止小白拷路径头尾带了空格和"和回车
|
file = clean_path(file) # 防止小白拷路径头尾带了空格和"和回车
|
||||||
if os.path.exists(file) == False:
|
if os.path.exists(file) is False:
|
||||||
raise RuntimeError("You input a wrong audio path that does not exists, please fix it!")
|
raise RuntimeError("You input a wrong audio path that does not exists, please fix it!")
|
||||||
out, _ = (
|
out, _ = (
|
||||||
ffmpeg.input(file, threads=0)
|
ffmpeg.input(file, threads=0)
|
||||||
@ -29,7 +27,11 @@ def load_audio(file, sr):
|
|||||||
.run(cmd=["ffmpeg", "-nostdin"], capture_stdout=True, capture_stderr=True)
|
.run(cmd=["ffmpeg", "-nostdin"], capture_stdout=True, capture_stderr=True)
|
||||||
)
|
)
|
||||||
except Exception:
|
except Exception:
|
||||||
traceback.print_exc()
|
out, _ = (
|
||||||
|
ffmpeg.input(file, threads=0)
|
||||||
|
.output("-", format="f32le", acodec="pcm_f32le", ac=1, ar=sr)
|
||||||
|
.run(cmd=["ffmpeg", "-nostdin"], capture_stdout=True)
|
||||||
|
) # Expose the Error
|
||||||
raise RuntimeError(i18n("音频加载失败"))
|
raise RuntimeError(i18n("音频加载失败"))
|
||||||
|
|
||||||
return np.frombuffer(out, np.float32).flatten()
|
return np.frombuffer(out, np.float32).flatten()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user