feat(*): Add Windows ffmpeg support

This is only for people wanting to run this as a console application on windows, it's completely unnecessary for running this in a docker container.
This commit is contained in:
Josh Creek
2021-08-29 15:46:47 +01:00
parent 05768afcee
commit 9e46c26728
3 changed files with 39 additions and 0 deletions
@@ -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."
@@ -16,4 +16,16 @@
<PackageReference Include="YoutubeExplode" Version="6.0.5" />
<PackageReference Include="YoutubeExplode.Converter" Version="2.1.0" />
</ItemGroup>
<!-- This downloads FFmpeg and copies it to output directory-->
<!-- <Target Name="Download FFmpeg before build" BeforeTargets="PreBuildEvent">
<Exec Command="powershell -ExecutionPolicy Bypass -File &quot;$(ProjectDir)/DownloadFfmpeg.ps1&quot;" />
<Copy SourceFiles="$(ProjectDir)/ffmpeg.exe" DestinationFiles="$(OutDir)/ffmpeg.exe" />
</Target>
<Target Name="Download FFmpeg before publish" BeforeTargets="PrepareForPublish">
<Exec Command="powershell -ExecutionPolicy Bypass -File &quot;$(ProjectDir)/DownloadFfmpeg.ps1&quot;" />
<Copy SourceFiles="$(ProjectDir)/ffmpeg.exe" DestinationFiles="$(PublishDir)/ffmpeg.exe" />
</Target> -->
</Project>
Binary file not shown.