Skip to content

Commit e9fea00

Browse files
committed
Improved handling of FFmpeg minor version changes
1 parent 1ea5dca commit e9fea00

7 files changed

+474
-459
lines changed

.vscode/c_cpp_properties.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"C:/Program Files (x86)/Windows Kits/8.1/Include/shared",
1010
"C:/Program Files (x86)/Windows Kits/8.1/Include/winrt",
1111
"${workspaceFolder}/**",
12-
"${workspaceFolder}/ffmpeg/ffmpeg-4.3.1-win64-shared/include/**",
13-
"${env:USERPROFILE}/AppData/Local/node-gyp/Cache/12.18.2/include/node"
12+
"${workspaceFolder}/ffmpeg/ffmpeg-4.x-win64-shared/include/**",
13+
"${env:USERPROFILE}/AppData/Local/node-gyp/Cache/12.21.0/include/node"
1414
],
1515
"defines": [
1616
"_DEBUG",

README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,7 @@ This will install all necessary dependencies, download the FFmpeg shared and dev
9292

9393
Note that if you want to use a local version of FFmpeg then, before the install, symbolic link or copy appropriate folders to:
9494

95-
./node_modules/beamcoder/ffmpeg/ffmpeg-4.1-win64-shared
96-
./node_modules/beamcoder/ffmpeg/ffmpeg-4.1-win64-dev
95+
./node_modules/beamcoder/ffmpeg/ffmpeg-4.x-win64-shared
9796

9897
To ensure that sufficient threads are available to process several requests in parallel, set the `UV_THREADPOOL_SIZE` environment variable, e.g.:
9998

binding.gyp

+17-17
Original file line numberDiff line numberDiff line change
@@ -45,30 +45,30 @@
4545
}
4646
},
4747
"include_dirs" : [
48-
"ffmpeg/ffmpeg-4.4-win64-shared/include"
48+
"ffmpeg/ffmpeg-4.x-win64-shared/include"
4949
],
5050
"libraries": [
51-
"-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/avcodec",
52-
"-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/avdevice",
53-
"-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/avfilter",
54-
"-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/avformat",
55-
"-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/avutil",
56-
"-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/postproc",
57-
"-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/swresample",
58-
"-l../ffmpeg/ffmpeg-4.4-win64-shared/lib/swscale"
51+
"-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/avcodec",
52+
"-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/avdevice",
53+
"-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/avfilter",
54+
"-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/avformat",
55+
"-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/avutil",
56+
"-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/postproc",
57+
"-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/swresample",
58+
"-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/swscale"
5959
],
6060
"copies": [
6161
{
6262
"destination": "build/Release/",
6363
"files": [
64-
"ffmpeg/ffmpeg-4.4-win64-shared/bin/avcodec-58.dll",
65-
"ffmpeg/ffmpeg-4.4-win64-shared/bin/avdevice-58.dll",
66-
"ffmpeg/ffmpeg-4.4-win64-shared/bin/avfilter-7.dll",
67-
"ffmpeg/ffmpeg-4.4-win64-shared/bin/avformat-58.dll",
68-
"ffmpeg/ffmpeg-4.4-win64-shared/bin/avutil-56.dll",
69-
"ffmpeg/ffmpeg-4.4-win64-shared/bin/postproc-55.dll",
70-
"ffmpeg/ffmpeg-4.4-win64-shared/bin/swresample-3.dll",
71-
"ffmpeg/ffmpeg-4.4-win64-shared/bin/swscale-5.dll"
64+
"ffmpeg/ffmpeg-4.x-win64-shared/bin/avcodec-58.dll",
65+
"ffmpeg/ffmpeg-4.x-win64-shared/bin/avdevice-58.dll",
66+
"ffmpeg/ffmpeg-4.x-win64-shared/bin/avfilter-7.dll",
67+
"ffmpeg/ffmpeg-4.x-win64-shared/bin/avformat-58.dll",
68+
"ffmpeg/ffmpeg-4.x-win64-shared/bin/avutil-56.dll",
69+
"ffmpeg/ffmpeg-4.x-win64-shared/bin/postproc-55.dll",
70+
"ffmpeg/ffmpeg-4.x-win64-shared/bin/swresample-3.dll",
71+
"ffmpeg/ffmpeg-4.x-win64-shared/bin/swscale-5.dll"
7272
]
7373
}
7474
]

install_ffmpeg.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,16 @@ async function win32() {
100100
else throw e;
101101
});
102102

103-
const ffmpegFilename = 'ffmpeg-4.4-win64-shared';
103+
const ffmpegFilename = 'ffmpeg-4.x-win64-shared';
104104
await access(`ffmpeg/${ffmpegFilename}`, fs.constants.R_OK).catch(async () => {
105105
const html = await getHTML('https://github.com/BtbN/FFmpeg-Builds/wiki/Latest', 'latest autobuilds');
106106
const htmlStr = html.toString('utf-8');
107107
const autoPos = htmlStr.indexOf('<p><a href=');
108108
const endPos = htmlStr.indexOf('</div>', autoPos);
109109
const autoStr = htmlStr.substring(autoPos, endPos);
110-
const sharedEndPos = autoStr.lastIndexOf('">win64-gpl-shared-4.4');
110+
const sharedEndPos = autoStr.lastIndexOf('">win64-gpl-shared-4.');
111+
if (sharedEndPos === -1)
112+
throw new Error('Failed to find latest v4.x autobuild from "https://github.com/BtbN/FFmpeg-Builds/wiki/Latest"');
111113
const startStr = '<p><a href="';
112114
const sharedStartPos = autoStr.lastIndexOf(startStr, sharedEndPos) + startStr.length;
113115
const downloadSource = autoStr.substring(sharedStartPos, sharedEndPos);
@@ -212,7 +214,7 @@ case 'win32':
212214
console.error('Only 64-bit platforms are supported.');
213215
process.exit(1);
214216
} else {
215-
win32();
217+
win32().catch(console.error);
216218
}
217219
break;
218220
case 'linux':

0 commit comments

Comments
 (0)