<# : @echo off setlocal chcp 65001 >nul title mpv.net 원클릭 설정 도우미 (GPU 자동 감지) echo ======================================================== echo mpv.net 4K 최적화 및 원클릭 연동 설정을 시작합니다... echo ======================================================== powershell -NoProfile -ExecutionPolicy Bypass -Command "$content = [System.IO.File]::ReadAllText('%~f0', [System.Text.Encoding]::UTF8); Invoke-Expression $content" echo. echo 작업이 완료되었습니다. 창을 닫으셔도 됩니다. timeout /t 3 >nul exit /b #> Add-Type -AssemblyName System.Windows.Forms [System.Console]::OutputEncoding = [System.Text.Encoding]::UTF8 Write-Host "`n[1/5] mpv.net 설치 여부를 확인하는 중..." -ForegroundColor Cyan # 1. mpv.net 실행 파일 탐색 $candidates = @( "$env:ProgramFiles\mpv.net\mpvnet.exe", "${env:ProgramFiles(x86)}\mpv.net\mpvnet.exe", "$env:LOCALAPPDATA\Programs\mpv.net\mpvnet.exe", "C:\mpv.net\mpvnet.exe", "D:\mpv.net\mpvnet.exe" ) $mpvExe = $candidates | Where-Object { Test-Path $_ } | Select-Object -First 1 if (-not $mpvExe) { Write-Host "[!] mpv.net을 찾을 수 없습니다." -ForegroundColor Yellow $ans = [System.Windows.Forms.MessageBox]::Show( "컴퓨터에 mpv.net이 설치되어 있지 않거나 기본 경로에 없습니다.`n`nmpv.net 다운로드 페이지(GitHub)를 여시겠습니까?", "mpv.net 미설치 감지", [System.Windows.Forms.MessageBoxButtons]::YesNo, [System.Windows.Forms.MessageBoxIcon]::Question ) if ($ans -eq [System.Windows.Forms.DialogResult]::Yes) { Start-Process "https://github.com/mpvnet-player/mpv.net/releases" } return } Write-Host " -> 발견된 경로: $mpvExe" -ForegroundColor Green # 2. GPU 감지 Write-Host "`n[2/5] 그래픽카드(GPU)를 감지하는 중..." -ForegroundColor Cyan $gpus = (Get-CimInstance Win32_VideoController).Name $gpuString = ($gpus -join ", ") Write-Host " -> 감지된 GPU: $gpuString" -ForegroundColor Green $profileDesc = "기본 / Intel 통합 그래픽 가속 (d3d11va)" $hwdecSetting = "hwdec=d3d11va`nvo=gpu-next`ngpu-api=d3d11" $scaleSetting = "scale=spline36`ncscale=spline36`ndscale=mitchell" if ($gpuString -match "NVIDIA|GeForce|RTX|GTX") { $profileDesc = "NVIDIA GeForce / RTX 초고화질 가속 (nvdec + High-Q Scaler)" $hwdecSetting = "hwdec=auto-safe`nvo=gpu-next`ngpu-api=d3d11" $scaleSetting = "scale=ewa_lanczos`ncscale=spline36`ndscale=mitchell" } elseif ($gpuString -match "AMD|Radeon") { $profileDesc = "AMD Radeon RDNA/GCN 하드웨어 가속 (d3d11va + Spline36)" $hwdecSetting = "hwdec=d3d11va`nvo=gpu-next`ngpu-api=d3d11" $scaleSetting = "scale=spline36`ncscale=spline36`ndscale=mitchell" } Write-Host " -> 최적 프로필 선정: $profileDesc" -ForegroundColor Yellow # 3. mpv.conf 생성 Write-Host "`n[3/5] 4K 스트리밍 및 고화질 자막 최적화 설정(mpv.conf) 생성 중..." -ForegroundColor Cyan $mpvDir = "$env:APPDATA\mpv.net" if (-not (Test-Path $mpvDir)) { New-Item -Path $mpvDir -ItemType Directory -Force | Out-Null } $mpvConfContent = @" # ============================================ # GPU 최적화 ($profileDesc) # ============================================ $hwdecSetting $scaleSetting d3d11-exclusive-fs=no correct-downscaling=yes linear-downscaling=yes # ============================================ # PikPak 스트리밍 버퍼링 최적화 # ============================================ cache=yes demuxer-max-bytes=200M demuxer-max-back-bytes=50M stream-buffer-size=4M # ============================================ # 선명한 한글 자막 가독성 설정 # ============================================ sub-auto=fuzzy sub-font="맑은 고딕" sub-font-size=46 sub-border-size=2.8 sub-border-color="#000000" sub-color="#FFFFFF" sub-shadow-offset=1.5 sub-shadow-color="#33000000" sub-pos=95 slang=ko,kor,en # ============================================ # 편의 기능 # ============================================ keep-open=yes save-position-on-quit=yes autofit-larger=100%x100% volume-max=150 "@ [System.IO.File]::WriteAllText("$mpvDir\mpv.conf", $mpvConfContent, [System.Text.Encoding]::UTF8) # 4. input.conf 생성 (21:9 & 16:9 맞춤 단축키) Write-Host "`n[4/5] 21:9 울트라와이드 모니터 맞춤 단축키(input.conf) 생성 중..." -ForegroundColor Cyan $inputConfContent = @" # ============================================ # 21:9 울트라와이드 모니터 화면 맞춤 단축키 # ============================================ # z키: 원터치로 21:9 꽉 채우기 토글 (상하 블랙바 즉시 제거) z cycle-values panscan 1.0 0.0 ; show-text "화면 맞춤 토글: `${panscan}" # e키: 화면 확대 (상하 여백 제거) e add panscan +0.1 ; show-text "화면 확대: `${panscan}" # w키: 화면 축소 w add panscan -0.1 ; show-text "화면 축소: `${panscan}" # r키: 초기화 (리셋) r set panscan 0; set video-zoom 0; show-text "화면 비율 초기화" # a키: 종횡비 강제 순환 (2.35:1 -> 16:9 -> 4:3 -> 원본) a cycle-values video-aspect-override "2.35:1" "16:9" "4:3" "-1" # 비디오 줌 단축키 Ctrl++ add video-zoom 0.1 Ctrl+- add video-zoom -0.1 Ctrl+0 set video-zoom 0; set panscan 0; show-text "줌 리셋" "@ [System.IO.File]::WriteAllText("$mpvDir\input.conf", $inputConfContent, [System.Text.Encoding]::UTF8) # 5. 순수 윈도우 파이썬-프리 런처(mpv_launcher.ps1) 생성 및 레지스트리 프로토콜 등록 Write-Host "`n[5/5] 웹 브라우저 연동 프로토콜(mpv://) 등록 중..." -ForegroundColor Cyan $launcherPath = "$mpvDir\mpv_launcher.ps1" $launcherScript = @" param([string]`$rawUri) try { if (-not `$rawUri) { exit 0 } `$raw = `$rawUri.Trim() if (`$raw.StartsWith("mpv://")) { `$raw = `$raw.Substring(6) } `$streamUrl = `$null `$subUrl = `$null if (`$raw.Contains("?")) { `$parts = `$raw.Split("?", 2) `$qs = `$parts[1] # 쿼리 파라미터 파싱 foreach (`$pair in `$qs.Split("&")) { `$kv = `$pair.Split("=", 2) if (`$kv.Length -eq 2) { `$key = [System.Uri]::UnescapeDataString(`$kv[0]) `$val = [System.Uri]::UnescapeDataString(`$kv[1]) if (`$key -eq "url") { `$streamUrl = `$val } if (`$key -eq "sub") { `$subUrl = `$val } } } } else { `$streamUrl = `$raw } if (-not `$streamUrl) { exit 0 } `$mpvExe = '$mpvExe' `$argList = @() if (`$subUrl) { try { `$tempDir = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), "pikpak_subtitles") if (-not (Test-Path `$tempDir)) { New-Item -Path `$tempDir -ItemType Directory -Force | Out-Null } `$subPath = [System.IO.Path]::Combine(`$tempDir, "subtitle.srt") `$wc = New-Object System.Net.WebClient `$wc.Headers.Add("User-Agent", "Mozilla/5.0") `$wc.DownloadFile(`$subUrl, `$subPath) `$argList += "--sub-file=`$subPath" } catch { `$argList += "--sub-file=`$subUrl" } } `$argList += `$streamUrl `$workDir = [System.IO.Path]::GetDirectoryName(`$mpvExe) Start-Process -FilePath `$mpvExe -WorkingDirectory `$workDir -ArgumentList `$argList } catch { # 오류 시 조용히 종료 } "@ [System.IO.File]::WriteAllText($launcherPath, $launcherScript, [System.Text.Encoding]::UTF8) # 레지스트리 등록 (HKCU\Software\Classes\mpv) $regPath = "HKCU:\Software\Classes\mpv" if (-not (Test-Path $regPath)) { New-Item -Path $regPath -Force | Out-Null } Set-ItemProperty -Path $regPath -Name "(Default)" -Value "URL:mpv Protocol" Set-ItemProperty -Path $regPath -Name "URL Protocol" -Value "" $cmdKey = "HKCU:\Software\Classes\mpv\shell\open\command" if (-not (Test-Path $cmdKey)) { New-Item -Path $cmdKey -Force | Out-Null } $commandStr = "powershell.exe -WindowStyle Hidden -NoProfile -ExecutionPolicy Bypass -File `"$launcherPath`" `"%1`"" Set-ItemProperty -Path $cmdKey -Name "(Default)" -Value $commandStr Write-Host "`n========================================================" -ForegroundColor Green Write-Host " 🎉 mpv.net 원클릭 연동 및 최적화가 완료되었습니다!" -ForegroundColor Green Write-Host "========================================================" -ForegroundColor Green [System.Windows.Forms.MessageBox]::Show( "🎉 mpv.net 원클릭 최적화 및 연동이 완료되었습니다!`n`n" + "• 감지된 GPU: $gpuString`n" + "• 적용된 프로필: $profileDesc`n" + "• 21:9 화면 꽉 채우기: 영상 재생 중 [Z] 키`n`n" + "이제 웹 사이트에서 [🎬 mpv.net] 버튼을 누르시면 즉시 고화질로 재생됩니다!", "PikPak mpv.net 설정 완료", [System.Windows.Forms.MessageBoxButtons]::OK, [System.Windows.Forms.MessageBoxIcon]::Information ) | Out-Null