Skip to content

Display and control your Android device

Upgrade FFmpeg (5.0) for Windows 64-bit

Romain Vimontb3ff1f6b3b66
diff --git a/app/meson.build b/app/meson.build
index 39334a3d..319dd0b6 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -121,11 +121,17 @@ else
prebuilt_ffmpeg = meson.get_cross_property('prebuilt_ffmpeg')
ffmpeg_bin_dir = meson.current_source_dir() + '/../prebuilt-deps/' + prebuilt_ffmpeg + '/bin'
ffmpeg_include_dir = '../prebuilt-deps/' + prebuilt_ffmpeg + '/include'
+
+ # ffmpeg versions are different for win32 and win64 builds
+ ffmpeg_avcodec = meson.get_cross_property('ffmpeg_avcodec')
+ ffmpeg_avformat = meson.get_cross_property('ffmpeg_avformat')
+ ffmpeg_avutil = meson.get_cross_property('ffmpeg_avutil')
+
ffmpeg = declare_dependency(
dependencies: [
- cc.find_library('avcodec-58', dirs: ffmpeg_bin_dir),
- cc.find_library('avformat-58', dirs: ffmpeg_bin_dir),
- cc.find_library('avutil-56', dirs: ffmpeg_bin_dir),
+ cc.find_library(ffmpeg_avcodec, dirs: ffmpeg_bin_dir),
+ cc.find_library(ffmpeg_avformat, dirs: ffmpeg_bin_dir),
+ cc.find_library(ffmpeg_avutil, dirs: ffmpeg_bin_dir),
],
include_directories: include_directories(ffmpeg_include_dir)
)
diff --git a/cross_win32.txt b/cross_win32.txt
index 045cb5c6..826c044f 100644
--- a/cross_win32.txt
+++ b/cross_win32.txt
@@ -16,5 +16,8 @@ cpu = 'i686'
endian = 'little'
[properties]
+ffmpeg_avcodec = 'avcodec-58'
+ffmpeg_avformat = 'avformat-58'
+ffmpeg_avutil = 'avutil-56'
prebuilt_ffmpeg = 'ffmpeg-4.3.1-win32-shared'
prebuilt_sdl2 = 'SDL2-2.0.18/i686-w64-mingw32'
diff --git a/cross_win64.txt b/cross_win64.txt
index d48c137a..2e049fdb 100644
--- a/cross_win64.txt
+++ b/cross_win64.txt
@@ -16,5 +16,8 @@ cpu = 'x86_64'
endian = 'little'
[properties]
-prebuilt_ffmpeg = 'ffmpeg-4.3.1-win64-shared'
+ffmpeg_avcodec = 'avcodec-59'
+ffmpeg_avformat = 'avformat-59'
+ffmpeg_avutil = 'avutil-57'
+prebuilt_ffmpeg = 'ffmpeg-5.0-full_build-shared'
prebuilt_sdl2 = 'SDL2-2.0.18/x86_64-w64-mingw32'
diff --git a/prebuilt-deps/Makefile b/prebuilt-deps/Makefile
index 41b7cf2a..93e8c48d 100644
--- a/prebuilt-deps/Makefile
+++ b/prebuilt-deps/Makefile
@@ -7,6 +7,7 @@
prepare-win32: prepare-sdl2 prepare-ffmpeg-win32 prepare-adb
prepare-win64: prepare-sdl2 prepare-ffmpeg-win64 prepare-adb
+# Use old FFmpeg version for win32, there are no new prebuilts
prepare-ffmpeg-win32:
@./prepare-dep https://github.com/Genymobile/scrcpy/releases/download/v1.16/ffmpeg-4.3.1-win32-shared.zip \
357af9901a456f4dcbacd107e83a934d344c9cb07ddad8aaf80612eeab7d26d2 \
@@ -17,13 +18,9 @@ prepare-ffmpeg-win32:
ln -sf ../ffmpeg-4.3.1-win32-dev/include ffmpeg-4.3.1-win32-shared/
prepare-ffmpeg-win64:
- @./prepare-dep https://github.com/Genymobile/scrcpy/releases/download/v1.16/ffmpeg-4.3.1-win64-shared.zip \
- dd29b7f92f48dead4dd940492c7509138c0f99db445076d0a597007298a79940 \
- ffmpeg-4.3.1-win64-shared
- @./prepare-dep https://github.com/Genymobile/scrcpy/releases/download/v1.16/ffmpeg-4.3.1-win64-dev.zip \
- 2e8038242cf8e1bd095c2978f196ff0462b122cc6ef7e74626a6af15459d8b81 \
- ffmpeg-4.3.1-win64-dev
- ln -sf ../ffmpeg-4.3.1-win64-dev/include ffmpeg-4.3.1-win64-shared/
+ @./prepare-dep https://github.com/GyanD/codexffmpeg/releases/download/5.0/ffmpeg-5.0-full_build-shared.7z \
+ e5900f6cecd4c438d398bd2fc308736c10b857cd8dd61c11bcfb05bff5d1211a \
+ ffmpeg-5.0-full_build-shared
prepare-sdl2:
@./prepare-dep https://libsdl.org/release/SDL2-devel-2.0.18-mingw.tar.gz \
diff --git a/prebuilt-deps/prepare-dep b/prebuilt-deps/prepare-dep
index f152e6cf..a95b9bb6 100755
--- a/prebuilt-deps/prepare-dep
+++ b/prebuilt-deps/prepare-dep
@@ -34,6 +34,9 @@ extract() {
elif [[ "$file" == *.tar.gz ]]
then
tar xf "$file"
+ elif [[ "$file" == *.7z ]]
+ then
+ 7z x "$file"
else
echo "Unsupported file: $file"
return 1
diff --git a/release.mk b/release.mk
index 6414f079..aa26f02d 100644
--- a/release.mk
+++ b/release.mk
@@ -110,11 +110,11 @@ dist-win64: build-server build-win64
cp data/scrcpy-console.bat "$(DIST)/$(WIN64_TARGET_DIR)"
cp data/scrcpy-noconsole.vbs "$(DIST)/$(WIN64_TARGET_DIR)"
cp data/icon.png "$(DIST)/$(WIN64_TARGET_DIR)"
- cp prebuilt-deps/ffmpeg-4.3.1-win64-shared/bin/avutil-56.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
- cp prebuilt-deps/ffmpeg-4.3.1-win64-shared/bin/avcodec-58.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
- cp prebuilt-deps/ffmpeg-4.3.1-win64-shared/bin/avformat-58.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
- cp prebuilt-deps/ffmpeg-4.3.1-win64-shared/bin/swresample-3.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
- cp prebuilt-deps/ffmpeg-4.3.1-win64-shared/bin/swscale-5.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
+ cp prebuilt-deps/ffmpeg-5.0-full_build-shared/bin/avutil-57.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
+ cp prebuilt-deps/ffmpeg-5.0-full_build-shared/bin/avcodec-59.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
+ cp prebuilt-deps/ffmpeg-5.0-full_build-shared/bin/avformat-59.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
+ cp prebuilt-deps/ffmpeg-5.0-full_build-shared/bin/swresample-4.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
+ cp prebuilt-deps/ffmpeg-5.0-full_build-shared/bin/swscale-6.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
cp prebuilt-deps/platform-tools/adb.exe "$(DIST)/$(WIN64_TARGET_DIR)/"
cp prebuilt-deps/platform-tools/AdbWinApi.dll "$(DIST)/$(WIN64_TARGET_DIR)/"
cp prebuilt-deps/platform-tools/AdbWinUsbApi.dll "$(DIST)/$(WIN64_TARGET_DIR)/"