Skip to content

Commit d27191d

Browse files
Merge pull request #13 from descriptinc/sk/merge-upstream
Sk/merge upstream
2 parents 06b843d + 13a7f14 commit d27191d

23 files changed

+6519
-1719
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

.github/workflows/prebuild.yml

Lines changed: 64 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,49 @@
11
name: prebuild
22
on: [push]
33

4+
permissions:
5+
contents: write
6+
47
jobs:
5-
package:
6-
runs-on: ${{ matrix.os }}
7-
strategy:
8-
fail-fast: false
9-
matrix:
10-
os:
11-
- ubuntu-20.04
12-
- macos-latest
13-
- windows-latest
8+
linux-package:
9+
permissions:
10+
contents: write
11+
runs-on: ubuntu-24.04
12+
container:
13+
image: node:18.20.4-bookworm
1414
steps:
15+
- name: check Linux dependencies
16+
shell: bash
17+
run: |
18+
apt update
19+
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends --no-install-suggests -y \
20+
git git-lfs libxcb1 unzip curl python3-setuptools build-essential libxcb1-dev \
21+
libavcodec-dev libavformat-dev libavdevice-dev libavfilter-dev libavutil-dev \
22+
libpostproc-dev libswresample-dev libswscale-dev libzimg-dev
23+
1524
- uses: actions/checkout@v2
1625
with:
1726
lfs: true
1827

28+
- name: npm install
29+
run: npm install
30+
env:
31+
PREBUILD: true
32+
33+
- name: check Linux dependencies
34+
run: node ./install_ffmpeg.js
35+
36+
- name: prebuild for Linux (x64)
37+
run: npx prebuild --runtime napi --arch x64 --include-regex '(\.node|\.dylib|ffmpeg|ffprobe)$' --upload ${{ secrets.GITHUB_TOKEN }}
38+
39+
windows-package:
40+
permissions:
41+
contents: write
42+
runs-on: windows-latest
43+
steps:
44+
- uses: actions/checkout@v2
45+
with:
46+
lfs: true
1947
- name: Use nodejs
2048
uses: actions/setup-node@v1
2149
with:
@@ -26,58 +54,47 @@ jobs:
2654
env:
2755
PREBUILD: true
2856

29-
- name: install Linux dependencies
30-
run: |
31-
sudo add-apt-repository ppa:savoury1/ffmpeg4
32-
sudo apt-get update
33-
sudo apt-get install libavcodec-dev libavformat-dev libavdevice-dev libavfilter-dev libavutil-dev libpostproc-dev libswresample-dev libswscale-dev libzimg-dev
34-
if: ${{ runner.os == 'Linux' }}
35-
36-
- name: check Linux dependencies
57+
- name: install Windows dependencies
3758
run: node ./install_ffmpeg.js
38-
if: ${{ runner.os == 'Linux'}}
59+
60+
- name: prebuild for Windows
61+
run: npx prebuild --runtime napi --include-regex '.node|.dll|.exe' --verbose --upload ${{ secrets.GITHUB_TOKEN }}
62+
shell: bash
63+
64+
macos-package:
65+
permissions:
66+
contents: write
67+
runs-on: macos-latest
68+
steps:
69+
- uses: actions/checkout@v2
70+
with:
71+
lfs: true
72+
73+
- name: Use nodejs
74+
uses: actions/setup-node@v1
75+
with:
76+
node-version: 16.13.0
3977

4078
- name: install Mac build dependencies (brew)
41-
run: brew install nasm pkg-config
42-
if: ${{ runner.os == 'macOS'}}
79+
run: |
80+
brew install nasm pkg-config python-packaging python-setuptools
81+
82+
- name: npm install
83+
run: npm install
84+
env:
85+
PREBUILD: true
4386

4487
- name: install Mac dependencies (shared release x64)
4588
run: node ./install_ffmpeg.js --arch x64
46-
if: ${{ runner.os == 'macOS'}}
4789

4890
- name: install Mac dependencies (shared release arm64)
4991
run: node ./install_ffmpeg.js --arch arm64
50-
if: ${{ runner.os == 'macOS'}}
51-
52-
- name: install Windows dependencies
53-
run: node ./install_ffmpeg.js
54-
if: ${{ runner.os == 'Windows'}}
5592

5693
- name: prebuild Release for macOS (x64)
5794
run: npx prebuild --runtime napi --arch x64 --include-regex '(\.node|\.dylib|ffmpeg|ffprobe)$' --verbose --upload ${{ secrets.GITHUB_TOKEN }}
58-
if: ${{ runner.os == 'macOS'}}
59-
60-
# - name: prebuild Debug for macOS (x64)
61-
# run: npx prebuild --debug --runtime napi --arch x64 --include-regex '(\.node|\.dylib|ffmpeg|ffprobe)$' --upload ${{ secrets.GITHUB_TOKEN }}
62-
# if: ${{ runner.os == 'macOS'}}
6395

6496
- name: clean build directory for cross-compiling
65-
run: rm ./build/Release/*.dylib
66-
if: ${{ runner.os == 'macOS'}}
97+
run: rm ./build/Release/*.dylib || true
6798

6899
- name: prebuild Release for macOS (arm64)
69100
run: npx prebuild --runtime napi --arch arm64 --include-regex '(\.node|\.dylib|ffmpeg|ffprobe)$' --verbose --upload ${{ secrets.GITHUB_TOKEN }}
70-
if: ${{ runner.os == 'macOS'}}
71-
72-
- name: prebuild for Windows
73-
run: npx prebuild --runtime napi --include-regex '.node|.dll|.exe' --verbose --upload ${{ secrets.GITHUB_TOKEN }}
74-
shell: bash
75-
if: ${{ runner.os == 'Windows'}}
76-
77-
- name: prebuild for Linux (x64)
78-
run: npx prebuild --runtime napi --arch x64 --include-regex '(\.node|\.dylib|ffmpeg|ffprobe)$' --upload ${{ secrets.GITHUB_TOKEN }}
79-
if: ${{ runner.os == 'Linux'}}
80-
81-
- name: prebuild for Linux (arm64)
82-
run: npx prebuild --runtime napi --arch arm64 --include-regex '(\.node|\.dylib|ffmpeg|ffprobe)$' --upload ${{ secrets.GITHUB_TOKEN }}
83-
if: ${{ runner.os == 'Linux'}}

.node-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
17.0.1
1+
16.20.2

.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: 48 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
{
22
"targets": [{
33
"target_name" : "beamcoder",
4+
"defines": [
5+
"NAPI_VERSION=<(napi_build_version)"
6+
],
47
"sources" : [ "src/beamcoder.cc", "src/beamcoder_util.cc",
8+
"src/log.cc" ,
59
"src/governor.cc", "src/demux.cc",
610
"src/decode.cc", "src/filter.cc",
711
"src/encode.cc", "src/mux.cc",
812
"src/packet.cc", "src/frame.cc",
913
"src/codec_par.cc", "src/format.cc",
1014
"src/codec.cc", "src/hwcontext.cc" ],
11-
"defines": [
12-
"NAPI_VERSION=<(napi_build_version)"
13-
],
1415
"conditions": [
1516
['OS=="linux"', {
17+
"variables": {
18+
"ffmpeg_version": "1.49.rc.1",
19+
"target_arch_override": "<!(node -p \"'<(target_arch)' === 'x64' ? 'x86_64' : '<(target_arch)'\")",
20+
},
1621
"defines": [
1722
"__STDC_CONSTANT_MACROS"
1823
],
@@ -24,17 +29,26 @@
2429
"-std=c++11",
2530
"-fexceptions"
2631
],
32+
"include_dirs": [
33+
"<(module_root_dir)/ffmpeg/ffmpeg-ffprobe-shared-linux-<(target_arch_override).<(ffmpeg_version)/include/"
34+
],
35+
2736
"link_settings": {
37+
"ldflags": [
38+
"--verbose"
39+
],
2840
"libraries": [
29-
"-lavcodec",
30-
"-lavdevice",
31-
"-lavfilter",
32-
"-lavformat",
33-
"-lavutil",
34-
"-lpostproc",
35-
"-lswresample",
36-
"-lswscale",
37-
"-lzimg"
41+
"-Wl,-rpath,./build/Release/ "
42+
"-L<(module_root_dir)/ffmpeg/ffmpeg-ffprobe-shared-linux-<(target_arch_override).<(ffmpeg_version)/ "
43+
"-lavcodec",
44+
"-lavdevice",
45+
"-lavfilter",
46+
"-lavformat",
47+
"-lavutil",
48+
"-lpostproc",
49+
"-lswresample",
50+
"-lswscale",
51+
"-lzimg"
3852
]
3953
},
4054
"copies": [
@@ -49,20 +63,12 @@
4963
}],
5064
["OS=='mac'", {
5165
"variables": {
52-
"ffmpeg_version": "1.33rc3",
66+
"ffmpeg_version": "1.49.rc.1",
5367
"target_arch_override": "<!(node -p \"'<(target_arch)' === 'x64' ? 'x86_64' : '<(target_arch)'\")",
5468
},
5569
"defines": [
5670
"__STDC_CONSTANT_MACROS"
5771
],
58-
"cflags_cc!": [
59-
"-fno-rtti",
60-
"-fno-exceptions"
61-
],
62-
"cflags_cc": [
63-
"-std=c++11",
64-
"-fexceptions"
65-
],
6672
"include_dirs": [
6773
"<(module_root_dir)/ffmpeg/ffmpeg-ffprobe-shared-darwin-<(target_arch_override).<(ffmpeg_version)/include/"
6874
],
@@ -85,6 +91,8 @@
8591
},
8692
'xcode_settings': {
8793
'MACOSX_DEPLOYMENT_TARGET': '10.11',
94+
'OTHER_CFLAGS': ['-fno-rtti', '-fno-exceptions', '-arch <(target_arch_override)', '-v'],
95+
'OTHER_LDFLAGS': ['-arch <(target_arch_override)'],
8896
},
8997
"copies": [
9098
{
@@ -102,42 +110,42 @@
102110
"msvs_settings": {
103111
"VCCLCompilerTool": {
104112
"RuntimeTypeInfo": "true",
105-
"AdditionalOptions": ['/WX']
113+
"AdditionalOptions": []
106114
}
107115
}
108116
}
109117
},
110118
"include_dirs" : [
111-
"ffmpeg/ffmpeg-4.x-win64-shared/include"
119+
"ffmpeg/ffmpeg-5.x-win64-shared/include"
112120
],
113121
"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"
122+
"-l../ffmpeg/ffmpeg-5.x-win64-shared/lib/avcodec",
123+
"-l../ffmpeg/ffmpeg-5.x-win64-shared/lib/avdevice",
124+
"-l../ffmpeg/ffmpeg-5.x-win64-shared/lib/avfilter",
125+
"-l../ffmpeg/ffmpeg-5.x-win64-shared/lib/avformat",
126+
"-l../ffmpeg/ffmpeg-5.x-win64-shared/lib/avutil",
127+
"-l../ffmpeg/ffmpeg-5.x-win64-shared/lib/postproc",
128+
"-l../ffmpeg/ffmpeg-5.x-win64-shared/lib/swresample",
129+
"-l../ffmpeg/ffmpeg-5.x-win64-shared/lib/swscale"
122130
],
123131
"copies": [
124132
{
125133
"destination": "<(PRODUCT_DIR)",
126134
"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",
135+
"ffmpeg/ffmpeg-5.x-win64-shared/bin/avcodec-59.dll",
136+
"ffmpeg/ffmpeg-5.x-win64-shared/bin/avdevice-59.dll",
137+
"ffmpeg/ffmpeg-5.x-win64-shared/bin/avfilter-8.dll",
138+
"ffmpeg/ffmpeg-5.x-win64-shared/bin/avformat-59.dll",
139+
"ffmpeg/ffmpeg-5.x-win64-shared/bin/avutil-57.dll",
140+
"ffmpeg/ffmpeg-5.x-win64-shared/bin/postproc-56.dll",
141+
"ffmpeg/ffmpeg-5.x-win64-shared/bin/swresample-4.dll",
142+
"ffmpeg/ffmpeg-5.x-win64-shared/bin/swscale-6.dll",
135143
"node_modules/ffmpeg-ffprobe-static/ffmpeg.exe",
136144
"node_modules/ffmpeg-ffprobe-static/ffprobe.exe"
137145
]
138146
}
139147
]
140-
}]
148+
}],
141149
]
142150
}]
143151
}

install.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const {execSync} = require('child_process');
22

33
if (!process.env.PREBUILD) {
4-
execSync('npx prebuild-install --runtime napi');
4+
execSync('npx prebuild-install --target 4 --runtime napi');
55
}

0 commit comments

Comments
 (0)