Skip to content

Commit d305886

Browse files
Merge remote-tracking branch 'upstream/master' into sk/merge-upstream
# Conflicts: # binding.gyp # package-lock.json # package.json
2 parents 06b843d + 2bd1fe2 commit d305886

19 files changed

+1863
-4113
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
1010
UV_THREADPOOL_SIZE: 16
1111
docker:
12-
- image: streampunkmedia/testbeam:16-4.4
12+
- image: streampunkmedia/testbeam:16-5.0
1313
steps:
1414
- checkout
1515
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS

.circleci/test_image/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
FROM cimg/node:16.13
1+
FROM cimg/node:16.14
22

33
# install FFmpeg
44
RUN sudo apt-get update \
55
&& sudo apt-get install software-properties-common \
66
&& sudo add-apt-repository ppa:savoury1/ffmpeg4 \
7+
&& sudo add-apt-repository ppa:savoury1/ffmpeg5 \
78
&& sudo apt-get update \
89
&& sudo apt-get upgrade && sudo apt-get dist-upgrade \
910
&& sudo apt-get install libavcodec-dev libavformat-dev libavdevice-dev libavfilter-dev libavutil-dev libpostproc-dev libswresample-dev libswscale-dev

.vscode/c_cpp_properties.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
"C:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt",
99
"C:/Program Files (x86)/Windows Kits/8.1/Include/shared",
1010
"C:/Program Files (x86)/Windows Kits/8.1/Include/winrt",
11-
"${workspaceFolder}/**",
12-
"${workspaceFolder}/ffmpeg/ffmpeg-4.x-win64-shared/include/**",
13-
"${env:USERPROFILE}/AppData/Local/node-gyp/Cache/12.21.0/include/node"
11+
"${workspaceFolder}/ffmpeg/ffmpeg-5.x-win64-shared/include/**",
12+
"${env:USERPROFILE}/AppData/Local/node-gyp/Cache/16.14.0/include/node"
1413
],
1514
"defines": [
1615
"_DEBUG",

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ If you are looking to write your own frame-by-frame transcoder, media mangler or
5555

5656
Does beam coder support X, Y or Z protocol / format / codec / file type / stream type / hardware etc.? If FFmpeg supports it, its possible and likely. Beam coder is self-describing at runtime, allowing exploration of what should be possible. However, you have to start somewhere, and the developers have been testing with the codecs and formats they are familiar with. Issues are expected so please raise any problems or requests for additional features as git hub issues. Even better, raise a pull request to fix a problem or add in missing features. Automated testing will be extended in due course, memory management improved, more examples added and hardware accelerated codecs added.
5757

58-
Beam coder will be a cross-platform module for Windows, Mac and Linux. The release version of FFmpeg that beam coder links with is currently 4.1.
58+
Beam coder will be a cross-platform module for Windows, Mac and Linux. The release version of FFmpeg that beam coder links with is currently 5.0.
5959

6060
Typescript bindings are available
6161

@@ -69,9 +69,9 @@ Beam coder is the first release of Streampunk Media's [_Aerostat_](https://en.wi
6969

7070
### Pre-requisites
7171

72-
Native packages require a build stage that needs some setup. This includes Python 2.7 (not 3) and build tools.
72+
Native packages require a build stage that needs some setup. This includes Python 3 and build tools.
7373

74-
1. Install the LTS version of [Node.js](https://nodejs.org/en/) for your platform, currently the latest v10.
74+
1. Install the LTS version of [Node.js](https://nodejs.org/en/) for your platform, currently the latest v16.
7575
2. Enable [node-gyp - the Node.js native addon build tool](https://github.com/nodejs/node-gyp) for your platform by following the [installation instructions](https://github.com/nodejs/node-gyp#installation).
7676

7777
Note: For MacOSX _Mojave_, install the following package after `xcode-select --install`:
@@ -92,7 +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.x-win64-shared
95+
./node_modules/beamcoder/ffmpeg/ffmpeg-5.x-win64-shared
9696

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

@@ -103,6 +103,7 @@ To ensure that sufficient threads are available to process several requests in p
103103
On Linux, use the appropriate package manager to install the FFmpeg 4.1 development dependencies first. An error will be printed if these cannot be found at expected locations. For example, on Ubuntu:
104104

105105
sudo add-apt-repository ppa:jonathonf/ffmpeg-4
106+
sudo add-apt-repository ppa:savoury1/ffmpeg5
106107
sudo apt-get update
107108
sudo apt-get install libavcodec-dev libavformat-dev libavdevice-dev libavfilter-dev libavutil-dev libpostproc-dev libswresample-dev libswscale-dev libzimg-dev
108109

@@ -280,6 +281,11 @@ To control the level of logging from FFmpeg you can use the `beamcoder.logging()
280281
* `debug` - stuff which is only useful for libav* developers
281282
* `trace` - extremely verbose debugging for libav* developers
282283

284+
To bypass the default ffmpeg logger you can use `beamcoder.setLoggingCallback()`. For example, to log all the messages using `console.log` :
285+
```javascript
286+
beamcoder.setLoggingCallback(msg => console.log(msg))
287+
```
288+
283289
### Demuxing
284290

285291
The process of demuxing (de-multiplexing) extracts time-labelled packets of data contained in a media stream or file. FFmpeg provides a diverse range of demuxing capability with support for a wide range of input formats and protocols (`beamcoder.protocols()`).

binding.gyp

Lines changed: 42 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@
22
"targets": [{
33
"target_name" : "beamcoder",
44
"sources" : [ "src/beamcoder.cc", "src/beamcoder_util.cc",
5+
"src/log.cc" ,
56
"src/governor.cc", "src/demux.cc",
67
"src/decode.cc", "src/filter.cc",
78
"src/encode.cc", "src/mux.cc",
89
"src/packet.cc", "src/frame.cc",
910
"src/codec_par.cc", "src/format.cc",
1011
"src/codec.cc", "src/hwcontext.cc" ],
11-
"defines": [
12-
"NAPI_VERSION=<(napi_build_version)"
13-
],
1412
"conditions": [
1513
['OS=="linux"', {
1614
"defines": [
@@ -23,7 +21,9 @@
2321
"cflags_cc": [
2422
"-std=c++11",
2523
"-fexceptions"
26-
],
24+
]
25+
}],
26+
['OS!="win" and OS!="linux"', {
2727
"link_settings": {
2828
"libraries": [
2929
"-lavcodec",
@@ -108,36 +108,55 @@
108108
}
109109
},
110110
"include_dirs" : [
111-
"ffmpeg/ffmpeg-4.x-win64-shared/include"
111+
"ffmpeg/ffmpeg-5.x-win64-shared/include"
112112
],
113113
"libraries": [
114-
"-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/avcodec",
115-
"-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/avdevice",
116-
"-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/avfilter",
117-
"-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/avformat",
118-
"-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/avutil",
119-
"-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/postproc",
120-
"-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/swresample",
121-
"-l../ffmpeg/ffmpeg-4.x-win64-shared/lib/swscale"
114+
"-l../ffmpeg/ffmpeg-5.x-win64-shared/lib/avcodec",
115+
"-l../ffmpeg/ffmpeg-5.x-win64-shared/lib/avdevice",
116+
"-l../ffmpeg/ffmpeg-5.x-win64-shared/lib/avfilter",
117+
"-l../ffmpeg/ffmpeg-5.x-win64-shared/lib/avformat",
118+
"-l../ffmpeg/ffmpeg-5.x-win64-shared/lib/avutil",
119+
"-l../ffmpeg/ffmpeg-5.x-win64-shared/lib/postproc",
120+
"-l../ffmpeg/ffmpeg-5.x-win64-shared/lib/swresample",
121+
"-l../ffmpeg/ffmpeg-5.x-win64-shared/lib/swscale"
122122
],
123123
"copies": [
124124
{
125125
"destination": "<(PRODUCT_DIR)",
126126
"files": [
127-
"ffmpeg/ffmpeg-4.x-win64-shared/bin/avcodec-58.dll",
128-
"ffmpeg/ffmpeg-4.x-win64-shared/bin/avdevice-58.dll",
129-
"ffmpeg/ffmpeg-4.x-win64-shared/bin/avfilter-7.dll",
130-
"ffmpeg/ffmpeg-4.x-win64-shared/bin/avformat-58.dll",
131-
"ffmpeg/ffmpeg-4.x-win64-shared/bin/avutil-56.dll",
132-
"ffmpeg/ffmpeg-4.x-win64-shared/bin/postproc-55.dll",
133-
"ffmpeg/ffmpeg-4.x-win64-shared/bin/swresample-3.dll",
134-
"ffmpeg/ffmpeg-4.x-win64-shared/bin/swscale-5.dll",
127+
"ffmpeg/ffmpeg-5.x-win64-shared/bin/avcodec-59.dll",
128+
"ffmpeg/ffmpeg-5.x-win64-shared/bin/avdevice-59.dll",
129+
"ffmpeg/ffmpeg-5.x-win64-shared/bin/avfilter-8.dll",
130+
"ffmpeg/ffmpeg-5.x-win64-shared/bin/avformat-59.dll",
131+
"ffmpeg/ffmpeg-5.x-win64-shared/bin/avutil-57.dll",
132+
"ffmpeg/ffmpeg-5.x-win64-shared/bin/postproc-56.dll",
133+
"ffmpeg/ffmpeg-5.x-win64-shared/bin/swresample-4.dll",
134+
"ffmpeg/ffmpeg-5.x-win64-shared/bin/swscale-6.dll",
135135
"node_modules/ffmpeg-ffprobe-static/ffmpeg.exe",
136136
"node_modules/ffmpeg-ffprobe-static/ffprobe.exe"
137-
]
138137
}
139138
]
140-
}]
139+
}],
140+
['OS=="linux"', {
141+
"libraries": [
142+
"<!(pkg-config --libs libavcodec)",
143+
"<!(pkg-config --libs libavdevice)",
144+
"<!(pkg-config --libs libavfilter)",
145+
"<!(pkg-config --libs libavformat)",
146+
"<!(pkg-config --libs libavutil)",
147+
"<!(pkg-config --libs libpostproc)",
148+
"<!(pkg-config --libs libswresample)",
149+
"<!(pkg-config --libs libswscale)"
150+
]
151+
}],
152+
['OS=="mac"', {
153+
"include_dirs" : [
154+
"/opt/homebrew/Cellar/ffmpeg/5.0/include"
155+
],
156+
"library_dirs": [
157+
"/opt/homebrew/Cellar/ffmpeg/5.0/lib",
158+
]
159+
}],
141160
]
142161
}]
143162
}

install_ffmpeg.js

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,14 @@ async function win32() {
101101
else throw e;
102102
});
103103

104-
const ffmpegFilename = 'ffmpeg-4.x-win64-shared';
104+
const ffmpegFilename = 'ffmpeg-5.x-win64-shared';
105105
await access(`ffmpeg/${ffmpegFilename}`, fs.constants.R_OK).catch(async () => {
106106
const html = await getHTML('https://github.com/BtbN/FFmpeg-Builds/wiki/Latest', 'latest autobuilds');
107107
const htmlStr = html.toString('utf-8');
108108
const autoPos = htmlStr.indexOf('<p><a href=');
109109
const endPos = htmlStr.indexOf('</div>', autoPos);
110110
const autoStr = htmlStr.substring(autoPos, endPos);
111-
const sharedEndPos = autoStr.lastIndexOf('">win64-gpl-shared-4.');
111+
const sharedEndPos = autoStr.lastIndexOf('">win64-gpl-shared-5.');
112112
if (sharedEndPos === -1)
113113
throw new Error('Failed to find latest v4.x autobuild from "https://github.com/BtbN/FFmpeg-Builds/wiki/Latest"');
114114
const startStr = '<p><a href="';
@@ -135,36 +135,36 @@ async function linux() {
135135
const { stdout } = await execFile('ldconfig', ['-p']).catch(console.error);
136136
let result = 0;
137137

138-
if (stdout.indexOf('libavcodec.so.58') < 0) {
139-
console.error('libavcodec.so.58 is not installed.');
138+
if (stdout.indexOf('libavcodec.so.59') < 0) {
139+
console.error('libavcodec.so.59 is not installed.');
140140
result = 1;
141141
}
142-
if (stdout.indexOf('libavformat.so.58') < 0) {
143-
console.error('libavformat.so.58 is not installed.');
142+
if (stdout.indexOf('libavformat.so.59') < 0) {
143+
console.error('libavformat.so.59 is not installed.');
144144
result = 1;
145145
}
146-
if (stdout.indexOf('libavdevice.so.58') < 0) {
147-
console.error('libavdevice.so.58 is not installed.');
146+
if (stdout.indexOf('libavdevice.so.59') < 0) {
147+
console.error('libavdevice.so.59 is not installed.');
148148
result = 1;
149149
}
150-
if (stdout.indexOf('libavfilter.so.7') < 0) {
151-
console.error('libavfilter.so.7 is not installed.');
150+
if (stdout.indexOf('libavfilter.so.8') < 0) {
151+
console.error('libavfilter.so.8 is not installed.');
152152
result = 1;
153153
}
154-
if (stdout.indexOf('libavutil.so.56') < 0) {
155-
console.error('libavutil.so.56 is not installed.');
154+
if (stdout.indexOf('libavutil.so.57') < 0) {
155+
console.error('libavutil.so.57 is not installed.');
156156
result = 1;
157157
}
158-
if (stdout.indexOf('libpostproc.so.55') < 0) {
159-
console.error('libpostproc.so.55 is not installed.');
158+
if (stdout.indexOf('libpostproc.so.56') < 0) {
159+
console.error('libpostproc.so.56 is not installed.');
160160
result = 1;
161161
}
162-
if (stdout.indexOf('libswresample.so.3') < 0) {
163-
console.error('libswresample.so.3 is not installed.');
162+
if (stdout.indexOf('libswresample.so.4') < 0) {
163+
console.error('libswresample.so.4 is not installed.');
164164
result = 1;
165165
}
166-
if (stdout.indexOf('libswscale.so.5') < 0) {
167-
console.error('libswscale.so.5 is not installed.');
166+
if (stdout.indexOf('libswscale.so.6') < 0) {
167+
console.error('libswscale.so.6 is not installed.');
168168
result = 1;
169169
}
170170
if (stdout.indexOf('libzimg.so.2') < 0) {

0 commit comments

Comments
 (0)