diff --git a/YouTubeChannelDownloader/DownloadFfmpeg.ps1 b/YouTubeChannelDownloader/DownloadFfmpeg.ps1 new file mode 100644 index 0000000..f25af61 --- /dev/null +++ b/YouTubeChannelDownloader/DownloadFfmpeg.ps1 @@ -0,0 +1,27 @@ +$ffmpegFilePath = "$PSScriptRoot\ffmpeg.exe" + +# Check if already exists +if (Test-Path $ffmpegFilePath) { + Write-Host "Skipped downloading ffmpeg, file already exists." + exit +} + +Write-Host "Downloading ffmpeg..." + +# Download the zip archive +$url = "https://github.com/vot/ffbinaries-prebuilt/releases/download/v4.1/ffmpeg-4.1-win-64.zip" +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$wc = New-Object System.Net.WebClient +$wc.DownloadFile($url, "$ffmpegFilePath.zip") +$wc.Dispose() + +# Extract ffmpeg.exe from the archive +Add-Type -Assembly System.IO.Compression.FileSystem +$zip = [IO.Compression.ZipFile]::OpenRead("$ffmpegFilePath.zip") +[IO.Compression.ZipFileExtensions]::ExtractToFile($zip.GetEntry("ffmpeg.exe"), $ffmpegFilePath) +$zip.Dispose() + +# Delete the archive +Remove-Item "$ffmpegFilePath.zip" -Force + +Write-Host "Done downloading ffmpeg." \ No newline at end of file diff --git a/YouTubeChannelDownloader/YouTubeChannelDownloader.csproj b/YouTubeChannelDownloader/YouTubeChannelDownloader.csproj index 5c45435..4c6dede 100644 --- a/YouTubeChannelDownloader/YouTubeChannelDownloader.csproj +++ b/YouTubeChannelDownloader/YouTubeChannelDownloader.csproj @@ -16,4 +16,16 @@ + + + + diff --git a/YouTubeChannelDownloader/ffmpeg.exe b/YouTubeChannelDownloader/ffmpeg.exe new file mode 100644 index 0000000..87eb089 Binary files /dev/null and b/YouTubeChannelDownloader/ffmpeg.exe differ