From 1d18f630fddc332349f1754607d31f9bdcb64334 Mon Sep 17 00:00:00 2001 From: Daniel Chalmers Date: Sat, 27 Dec 2025 12:06:49 -0600 Subject: [PATCH 1/2] Switch FFMPEG repo & Add support for ARM64 Closes #10 --- SentryReplay/PackageManager.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/SentryReplay/PackageManager.cs b/SentryReplay/PackageManager.cs index dfb8fd8..59c5b30 100644 --- a/SentryReplay/PackageManager.cs +++ b/SentryReplay/PackageManager.cs @@ -1,6 +1,7 @@ using System.IO; using System.IO.Compression; using System.Net.Http; +using System.Runtime.InteropServices; using Serilog; namespace SentryReplay; @@ -8,7 +9,6 @@ namespace SentryReplay; public static class PackageManager { private const string FFmpegVersion = "7.1"; - private static readonly string FFmpegArchiveRoot = $"ffmpeg-{FFmpegVersion}-full_build-shared"; private static readonly string FFmpegBinFolderName = $"ffmpeg-{FFmpegVersion}-bin"; private static async Task DownloadFile(string url, string savePath) @@ -22,7 +22,7 @@ private static async Task DownloadFile(string url, string savePath) } } - private static void ExtractFFmpegBin(string zipFilePath, string destinationBinPath) + private static void ExtractFFmpegBin(string zipFilePath, string destinationBinPath, string archiveRoot) { if (Directory.Exists(destinationBinPath)) { @@ -31,7 +31,7 @@ private static void ExtractFFmpegBin(string zipFilePath, string destinationBinPa Directory.CreateDirectory(destinationBinPath); - var binPrefix = $"{FFmpegArchiveRoot}/bin/"; + var binPrefix = $"{archiveRoot}/bin/"; using var archive = ZipFile.OpenRead(zipFilePath); foreach (var entry in archive.Entries) { @@ -61,14 +61,20 @@ public static async Task DownloadAndExtractFFmpeg() { var outputFolder = Path.GetFullPath("."); var destinationBinPath = Path.Combine(outputFolder, FFmpegBinFolderName); - var url = $"https://github.com/GyanD/codexffmpeg/releases/download/{FFmpegVersion}/ffmpeg-{FFmpegVersion}-full_build-shared.zip"; // TODO: ARM64 builds? + var url = RuntimeInformation.ProcessArchitecture switch + { + Architecture.X64 => $"https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n{FFmpegVersion}-latest-win64-gpl-shared-{FFmpegVersion}.zip", + Architecture.Arm64 => $"https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n{FFmpegVersion}-latest-winarm64-gpl-{FFmpegVersion}.zip", + _ => throw new NotSupportedException($"FFmpeg download is not supported for {RuntimeInformation.ProcessArchitecture}."), + }; var tempPath = Path.GetTempFileName(); + var archiveRoot = Path.GetFileNameWithoutExtension(new Uri(url).AbsolutePath); Log.Information($"Downloading ffmpeg to {tempPath} from {url}"); await DownloadFile(url, tempPath); Log.Information($"Extracting ffmpeg bin to {destinationBinPath}"); - ExtractFFmpegBin(tempPath, destinationBinPath); + ExtractFFmpegBin(tempPath, destinationBinPath, archiveRoot); File.Delete(tempPath); } From 2f15c428307c0d912c43e7830b49ff46a3012e44 Mon Sep 17 00:00:00 2001 From: Daniel Chalmers Date: Sat, 27 Dec 2025 12:16:47 -0600 Subject: [PATCH 2/2] shared --- SentryReplay/PackageManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SentryReplay/PackageManager.cs b/SentryReplay/PackageManager.cs index 59c5b30..f2f2324 100644 --- a/SentryReplay/PackageManager.cs +++ b/SentryReplay/PackageManager.cs @@ -64,7 +64,7 @@ public static async Task DownloadAndExtractFFmpeg() var url = RuntimeInformation.ProcessArchitecture switch { Architecture.X64 => $"https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n{FFmpegVersion}-latest-win64-gpl-shared-{FFmpegVersion}.zip", - Architecture.Arm64 => $"https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n{FFmpegVersion}-latest-winarm64-gpl-{FFmpegVersion}.zip", + Architecture.Arm64 => $"https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-n{FFmpegVersion}-latest-winarm64-gpl-shared-{FFmpegVersion}.zip", _ => throw new NotSupportedException($"FFmpeg download is not supported for {RuntimeInformation.ProcessArchitecture}."), }; var tempPath = Path.GetTempFileName();