bare-ffmpeg 1.0.0-31 → 1.0.0-33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CMakeLists.txt +31 -9
- package/README.md +65 -1771
- package/binding.cc +735 -1
- package/cmake/ports/ffmpeg/port.cmake +8 -9
- package/cmake/ports/libdrm/port.cmake +32 -0
- package/cmake/ports/libva/port.cmake +53 -0
- package/cmake/ports/x264/port.cmake +7 -2
- package/index.js +7 -4
- package/lib/codec-context.js +16 -33
- package/lib/codec-parameters.js +38 -23
- package/lib/codec.js +1 -0
- package/lib/constants.js +122 -8
- package/lib/errors.js +3 -15
- package/lib/filter-graph.js +1 -6
- package/lib/filter-inout.js +1 -4
- package/lib/format-context.js +4 -15
- package/lib/frame.js +20 -4
- package/lib/hw-device-context.js +31 -0
- package/lib/hw-frames-constraints.js +54 -0
- package/lib/hw-frames-context.js +92 -0
- package/lib/image.js +1 -3
- package/lib/packet.js +1 -6
- package/lib/rational.js +1 -4
- package/lib/resampler.js +1 -5
- package/lib/samples.js +2 -13
- package/lib/scaler.js +1 -7
- package/lib/stream.js +2 -8
- package/package.json +2 -2
- package/prebuilds/android-arm/bare-ffmpeg.bare +0 -0
- package/prebuilds/android-arm64/bare-ffmpeg.bare +0 -0
- package/prebuilds/android-ia32/bare-ffmpeg.bare +0 -0
- package/prebuilds/android-x64/bare-ffmpeg.bare +0 -0
- package/prebuilds/darwin-arm64/bare-ffmpeg.bare +0 -0
- package/prebuilds/darwin-x64/bare-ffmpeg.bare +0 -0
- package/prebuilds/ios-arm64/bare-ffmpeg.bare +0 -0
- package/prebuilds/ios-arm64-simulator/bare-ffmpeg.bare +0 -0
- package/prebuilds/ios-x64-simulator/bare-ffmpeg.bare +0 -0
- package/prebuilds/linux-arm64/bare-ffmpeg/libva-drm.so.2 +0 -0
- package/prebuilds/linux-arm64/bare-ffmpeg/libva.so.2 +0 -0
- package/prebuilds/linux-arm64/bare-ffmpeg.bare +0 -0
- package/prebuilds/linux-x64/bare-ffmpeg/libva-drm.so.2 +0 -0
- package/prebuilds/linux-x64/bare-ffmpeg/libva.so.2 +0 -0
- package/prebuilds/linux-x64/bare-ffmpeg.bare +0 -0
- package/prebuilds/win32-arm64/bare-ffmpeg.bare +0 -0
- package/prebuilds/win32-x64/bare-ffmpeg.bare +0 -0
|
@@ -226,15 +226,6 @@ set(pkg_config_path)
|
|
|
226
226
|
|
|
227
227
|
if("gpl" IN_LIST features)
|
|
228
228
|
list(APPEND args --enable-gpl)
|
|
229
|
-
|
|
230
|
-
add_library(postproc STATIC IMPORTED GLOBAL)
|
|
231
|
-
|
|
232
|
-
list(APPEND libraries postproc)
|
|
233
|
-
list(APPEND byproducts lib/libpostproc.a)
|
|
234
|
-
|
|
235
|
-
target_link_libraries(postproc INTERFACE avutil)
|
|
236
|
-
target_link_libraries(avdevice INTERFACE postproc)
|
|
237
|
-
target_link_libraries(avfilter INTERFACE postproc)
|
|
238
229
|
endif()
|
|
239
230
|
|
|
240
231
|
if("zlib" IN_LIST features)
|
|
@@ -281,6 +272,14 @@ if("opus" IN_LIST features)
|
|
|
281
272
|
target_link_libraries(avcodec INTERFACE opus)
|
|
282
273
|
endif()
|
|
283
274
|
|
|
275
|
+
if(LINUX)
|
|
276
|
+
find_port(libva)
|
|
277
|
+
|
|
278
|
+
list(APPEND args --enable-vaapi)
|
|
279
|
+
list(APPEND pkg_config_path "${libva_PREFIX}/lib/pkgconfig")
|
|
280
|
+
list(APPEND pkg_config_path "${libdrm_PREFIX}/lib/pkgconfig")
|
|
281
|
+
endif()
|
|
282
|
+
|
|
284
283
|
if(CMAKE_HOST_WIN32)
|
|
285
284
|
find_path(
|
|
286
285
|
msys2
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
include_guard(GLOBAL)
|
|
2
|
+
|
|
3
|
+
declare_port(
|
|
4
|
+
"git:gitlab.freedesktop.org/mesa/drm#libdrm-2.4.128"
|
|
5
|
+
libdrm
|
|
6
|
+
MESON
|
|
7
|
+
BYPRODUCTS
|
|
8
|
+
lib/libdrm.a
|
|
9
|
+
ARGS
|
|
10
|
+
-Dcairo-tests=disabled
|
|
11
|
+
-Dman-pages=disabled
|
|
12
|
+
-Dvalgrind=disabled
|
|
13
|
+
-Dinstall-test-programs=false
|
|
14
|
+
-Dudev=true
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
add_library(drm STATIC IMPORTED GLOBAL)
|
|
18
|
+
|
|
19
|
+
add_dependencies(drm ${libdrm})
|
|
20
|
+
|
|
21
|
+
set_target_properties(
|
|
22
|
+
drm
|
|
23
|
+
PROPERTIES
|
|
24
|
+
IMPORTED_LOCATION "${libdrm_PREFIX}/lib/libdrm.a"
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
file(MAKE_DIRECTORY "${libdrm_PREFIX}/include")
|
|
28
|
+
|
|
29
|
+
target_include_directories(
|
|
30
|
+
drm
|
|
31
|
+
INTERFACE "${libdrm_PREFIX}/include"
|
|
32
|
+
)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
include_guard(GLOBAL)
|
|
2
|
+
|
|
3
|
+
find_port(libdrm)
|
|
4
|
+
|
|
5
|
+
declare_port(
|
|
6
|
+
"github:intel/libva#2.22.0"
|
|
7
|
+
libva
|
|
8
|
+
MESON
|
|
9
|
+
DEPENDS drm
|
|
10
|
+
BYPRODUCTS
|
|
11
|
+
lib/libva.so.2.2200.0
|
|
12
|
+
lib/libva-drm.so.2.2200.0
|
|
13
|
+
ARGS
|
|
14
|
+
-Denable_docs=false
|
|
15
|
+
-Ddisable_drm=false
|
|
16
|
+
ENV
|
|
17
|
+
"PKG_CONFIG_PATH=${libdrm_PREFIX}/lib/pkgconfig"
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
add_library(va SHARED IMPORTED GLOBAL)
|
|
21
|
+
add_library(va-drm SHARED IMPORTED GLOBAL)
|
|
22
|
+
|
|
23
|
+
add_dependencies(va ${libva})
|
|
24
|
+
add_dependencies(va-drm ${libva})
|
|
25
|
+
|
|
26
|
+
set_target_properties(
|
|
27
|
+
va
|
|
28
|
+
PROPERTIES
|
|
29
|
+
IMPORTED_LOCATION "${libva_PREFIX}/lib/libva.so.2.2200.0"
|
|
30
|
+
IMPORTED_SONAME libva.so.2
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
set_target_properties(
|
|
34
|
+
va-drm
|
|
35
|
+
PROPERTIES
|
|
36
|
+
IMPORTED_LOCATION "${libva_PREFIX}/lib/libva-drm.so.2.2200.0"
|
|
37
|
+
IMPORTED_SONAME libva-drm.so.2
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
file(MAKE_DIRECTORY "${libva_PREFIX}/include")
|
|
41
|
+
|
|
42
|
+
target_include_directories(
|
|
43
|
+
va
|
|
44
|
+
INTERFACE "${libva_PREFIX}/include"
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
target_include_directories(
|
|
48
|
+
va-drm
|
|
49
|
+
INTERFACE "${libva_PREFIX}/include"
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
target_link_libraries(va INTERFACE drm)
|
|
53
|
+
target_link_libraries(va-drm INTERFACE drm va)
|
|
@@ -128,6 +128,12 @@ if(CMAKE_AR)
|
|
|
128
128
|
list(APPEND env --modify "PATH=path_list_prepend:${AR_path}")
|
|
129
129
|
endif()
|
|
130
130
|
|
|
131
|
+
set(patches)
|
|
132
|
+
|
|
133
|
+
if(WIN32)
|
|
134
|
+
list(APPEND patches patches/01-windows-clang.patch)
|
|
135
|
+
endif()
|
|
136
|
+
|
|
131
137
|
declare_port(
|
|
132
138
|
"git:code.videolan.org/videolan/x264#stable"
|
|
133
139
|
x264
|
|
@@ -135,8 +141,7 @@ declare_port(
|
|
|
135
141
|
BYPRODUCTS lib/${lib}
|
|
136
142
|
ARGS ${args}
|
|
137
143
|
ENV ${env}
|
|
138
|
-
PATCHES
|
|
139
|
-
patches/01-windows-clang.patch
|
|
144
|
+
PATCHES ${patches}
|
|
140
145
|
)
|
|
141
146
|
|
|
142
147
|
add_library(x264 STATIC IMPORTED GLOBAL)
|
package/index.js
CHANGED
|
@@ -6,15 +6,15 @@ const CodecParameters = require('./lib/codec-parameters')
|
|
|
6
6
|
const Decoder = require('./lib/decoder')
|
|
7
7
|
const Dictionary = require('./lib/dictionary')
|
|
8
8
|
const Encoder = require('./lib/encoder')
|
|
9
|
-
const {
|
|
10
|
-
InputFormatContext,
|
|
11
|
-
OutputFormatContext
|
|
12
|
-
} = require('./lib/format-context')
|
|
9
|
+
const { InputFormatContext, OutputFormatContext } = require('./lib/format-context')
|
|
13
10
|
const Filter = require('./lib/filter')
|
|
14
11
|
const FilterContext = require('./lib/filter-context')
|
|
15
12
|
const FilterGraph = require('./lib/filter-graph')
|
|
16
13
|
const FilterInOut = require('./lib/filter-inout')
|
|
17
14
|
const Frame = require('./lib/frame')
|
|
15
|
+
const HWDeviceContext = require('./lib/hw-device-context')
|
|
16
|
+
const HWFramesContext = require('./lib/hw-frames-context')
|
|
17
|
+
const HWFramesConstraints = require('./lib/hw-frames-constraints')
|
|
18
18
|
const IOContext = require('./lib/io-context')
|
|
19
19
|
const Image = require('./lib/image')
|
|
20
20
|
const InputFormat = require('./lib/input-format')
|
|
@@ -40,6 +40,9 @@ exports.FilterContext = FilterContext
|
|
|
40
40
|
exports.FilterGraph = FilterGraph
|
|
41
41
|
exports.FilterInOut = FilterInOut
|
|
42
42
|
exports.Frame = Frame
|
|
43
|
+
exports.HWDeviceContext = HWDeviceContext
|
|
44
|
+
exports.HWFramesContext = HWFramesContext
|
|
45
|
+
exports.HWFramesConstraints = HWFramesConstraints
|
|
43
46
|
exports.IOContext = IOContext
|
|
44
47
|
exports.Image = Image
|
|
45
48
|
exports.InputFormat = InputFormat
|
package/lib/codec-context.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const binding = require('../binding')
|
|
2
2
|
const Rational = require('./rational')
|
|
3
3
|
const ChannelLayout = require('./channel-layout')
|
|
4
|
+
const HWDeviceContext = require('./hw-device-context')
|
|
4
5
|
const { codecConfig, optionFlags } = require('./constants')
|
|
5
6
|
|
|
6
7
|
module.exports = class FFmpegCodecContext {
|
|
@@ -61,11 +62,7 @@ module.exports = class FFmpegCodecContext {
|
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
set timeBase(value) {
|
|
64
|
-
binding.setCodecContextTimeBase(
|
|
65
|
-
this._handle,
|
|
66
|
-
value.numerator,
|
|
67
|
-
value.denominator
|
|
68
|
-
)
|
|
65
|
+
binding.setCodecContextTimeBase(this._handle, value.numerator, value.denominator)
|
|
69
66
|
}
|
|
70
67
|
|
|
71
68
|
get frameRate() {
|
|
@@ -74,11 +71,7 @@ module.exports = class FFmpegCodecContext {
|
|
|
74
71
|
}
|
|
75
72
|
|
|
76
73
|
set frameRate(value) {
|
|
77
|
-
binding.setCodecContextFramerate(
|
|
78
|
-
this._handle,
|
|
79
|
-
value.numerator,
|
|
80
|
-
value.denominator
|
|
81
|
-
)
|
|
74
|
+
binding.setCodecContextFramerate(this._handle, value.numerator, value.denominator)
|
|
82
75
|
}
|
|
83
76
|
|
|
84
77
|
get channelLayout() {
|
|
@@ -86,10 +79,7 @@ module.exports = class FFmpegCodecContext {
|
|
|
86
79
|
}
|
|
87
80
|
|
|
88
81
|
set channelLayout(value) {
|
|
89
|
-
binding.setCodecContextChannelLayout(
|
|
90
|
-
this._handle,
|
|
91
|
-
ChannelLayout.from(value)._handle
|
|
92
|
-
)
|
|
82
|
+
binding.setCodecContextChannelLayout(this._handle, ChannelLayout.from(value)._handle)
|
|
93
83
|
}
|
|
94
84
|
|
|
95
85
|
get gopSize() {
|
|
@@ -113,12 +103,7 @@ module.exports = class FFmpegCodecContext {
|
|
|
113
103
|
}
|
|
114
104
|
|
|
115
105
|
set extraData(value) {
|
|
116
|
-
binding.setCodecContextExtraData(
|
|
117
|
-
this._handle,
|
|
118
|
-
value.buffer,
|
|
119
|
-
value.byteOffset,
|
|
120
|
-
value.byteLength
|
|
121
|
-
)
|
|
106
|
+
binding.setCodecContextExtraData(this._handle, value.buffer, value.byteOffset, value.byteLength)
|
|
122
107
|
}
|
|
123
108
|
|
|
124
109
|
get frameSize() {
|
|
@@ -137,6 +122,14 @@ module.exports = class FFmpegCodecContext {
|
|
|
137
122
|
binding.setCodecContextRequestSampleFormat(this._handle, sampleFormat)
|
|
138
123
|
}
|
|
139
124
|
|
|
125
|
+
get hwDeviceCtx() {
|
|
126
|
+
return HWDeviceContext.from(binding.getCodecContextHWDeviceCtx(this._handle))
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
set hwDeviceCtx(hwDeviceContext) {
|
|
130
|
+
binding.setCodecContextHWDeviceCtx(this._handle, hwDeviceContext._handle)
|
|
131
|
+
}
|
|
132
|
+
|
|
140
133
|
set getFormat(callback) {
|
|
141
134
|
const wrap = (pixelFormats) => {
|
|
142
135
|
return callback(this, pixelFormats)
|
|
@@ -176,10 +169,7 @@ module.exports = class FFmpegCodecContext {
|
|
|
176
169
|
|
|
177
170
|
getSupportedConfig(config) {
|
|
178
171
|
if (config === codecConfig.FRAME_RATE) {
|
|
179
|
-
const data = binding.getSupportedFrameRates(
|
|
180
|
-
this._handle,
|
|
181
|
-
this._codec._handle
|
|
182
|
-
)
|
|
172
|
+
const data = binding.getSupportedFrameRates(this._handle, this._codec._handle)
|
|
183
173
|
if (!data || data.length === 0) return null
|
|
184
174
|
|
|
185
175
|
const view = new Int32Array(data)
|
|
@@ -191,20 +181,13 @@ module.exports = class FFmpegCodecContext {
|
|
|
191
181
|
}
|
|
192
182
|
|
|
193
183
|
if (config === codecConfig.CHANNEL_LAYOUT) {
|
|
194
|
-
const handles = binding.getSupportedChannelLayouts(
|
|
195
|
-
this._handle,
|
|
196
|
-
this._codec._handle
|
|
197
|
-
)
|
|
184
|
+
const handles = binding.getSupportedChannelLayouts(this._handle, this._codec._handle)
|
|
198
185
|
if (!handles || handles.length === 0) return null
|
|
199
186
|
|
|
200
187
|
return handles.map((handle) => new ChannelLayout(handle))
|
|
201
188
|
}
|
|
202
189
|
|
|
203
|
-
const data = binding.getSupportedConfig(
|
|
204
|
-
this._handle,
|
|
205
|
-
this._codec._handle,
|
|
206
|
-
config
|
|
207
|
-
)
|
|
190
|
+
const data = binding.getSupportedConfig(this._handle, this._codec._handle, config)
|
|
208
191
|
|
|
209
192
|
if (config === codecConfig.SAMPLE_RATE && !data) {
|
|
210
193
|
return null
|
package/lib/codec-parameters.js
CHANGED
|
@@ -43,33 +43,21 @@ module.exports = class FFmpegCodecParameters {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
get sampleAspectRatio() {
|
|
46
|
-
const view = new Int32Array(
|
|
47
|
-
binding.getCodecParametersSampleAspectRatio(this._handle)
|
|
48
|
-
)
|
|
46
|
+
const view = new Int32Array(binding.getCodecParametersSampleAspectRatio(this._handle))
|
|
49
47
|
return new Rational(view[0], view[1])
|
|
50
48
|
}
|
|
51
49
|
|
|
52
50
|
set sampleAspectRatio(ratio) {
|
|
53
|
-
binding.setCodecParametersSampleAspectRatio(
|
|
54
|
-
this._handle,
|
|
55
|
-
ratio.numerator,
|
|
56
|
-
ratio.denominator
|
|
57
|
-
)
|
|
51
|
+
binding.setCodecParametersSampleAspectRatio(this._handle, ratio.numerator, ratio.denominator)
|
|
58
52
|
}
|
|
59
53
|
|
|
60
54
|
get frameRate() {
|
|
61
|
-
const view = new Int32Array(
|
|
62
|
-
binding.getCodecParametersFramerate(this._handle)
|
|
63
|
-
)
|
|
55
|
+
const view = new Int32Array(binding.getCodecParametersFramerate(this._handle))
|
|
64
56
|
return new Rational(view[0], view[1])
|
|
65
57
|
}
|
|
66
58
|
|
|
67
59
|
set frameRate(rate) {
|
|
68
|
-
binding.setCodecParametersFramerate(
|
|
69
|
-
this._handle,
|
|
70
|
-
rate.numerator,
|
|
71
|
-
rate.denominator
|
|
72
|
-
)
|
|
60
|
+
binding.setCodecParametersFramerate(this._handle, rate.numerator, rate.denominator)
|
|
73
61
|
}
|
|
74
62
|
|
|
75
63
|
get frameSize() {
|
|
@@ -145,16 +133,11 @@ module.exports = class FFmpegCodecParameters {
|
|
|
145
133
|
}
|
|
146
134
|
|
|
147
135
|
get channelLayout() {
|
|
148
|
-
return new ChannelLayout(
|
|
149
|
-
binding.getCodecParametersChannelLayout(this._handle)
|
|
150
|
-
)
|
|
136
|
+
return new ChannelLayout(binding.getCodecParametersChannelLayout(this._handle))
|
|
151
137
|
}
|
|
152
138
|
|
|
153
139
|
set channelLayout(value) {
|
|
154
|
-
binding.setCodecParametersChannelLayout(
|
|
155
|
-
this._handle,
|
|
156
|
-
ChannelLayout.from(value)._handle
|
|
157
|
-
)
|
|
140
|
+
binding.setCodecParametersChannelLayout(this._handle, ChannelLayout.from(value)._handle)
|
|
158
141
|
}
|
|
159
142
|
|
|
160
143
|
get width() {
|
|
@@ -218,6 +201,38 @@ module.exports = class FFmpegCodecParameters {
|
|
|
218
201
|
binding.setCodecParametersSeekPreroll(this._handle, value)
|
|
219
202
|
}
|
|
220
203
|
|
|
204
|
+
get colorSpace() {
|
|
205
|
+
return binding.getCodecParametersColorSpace(this._handle)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
set colorSpace(value) {
|
|
209
|
+
binding.setCodecParametersColorSpace(this._handle, value)
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
get colorPrimaries() {
|
|
213
|
+
return binding.getCodecParametersColorPrimaries(this._handle)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
set colorPrimaries(value) {
|
|
217
|
+
binding.setCodecParametersColorPrimaries(this._handle, value)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
get colorTRC() {
|
|
221
|
+
return binding.getCodecParametersColorTRC(this._handle)
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
set colorTRC(value) {
|
|
225
|
+
binding.setCodecParametersColorTRC(this._handle, value)
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
get colorRange() {
|
|
229
|
+
return binding.getCodecParametersColorRange(this._handle)
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
set colorRange(value) {
|
|
233
|
+
binding.setCodecParametersColorRange(this._handle, value)
|
|
234
|
+
}
|
|
235
|
+
|
|
221
236
|
// Methods
|
|
222
237
|
|
|
223
238
|
fromContext(context) {
|
package/lib/codec.js
CHANGED
|
@@ -51,6 +51,7 @@ module.exports = class FFmpegCodec {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
static MJPEG = this.for(constants.codecs.MJPEG)
|
|
54
|
+
static H264 = this.for(constants.codecs.H264)
|
|
54
55
|
static AAC = this.for(constants.codecs.AAC)
|
|
55
56
|
static OPUS = this.for(constants.codecs.OPUS)
|
|
56
57
|
static AV1 = this.for(constants.codecs.AV1)
|
package/lib/constants.js
CHANGED
|
@@ -3,25 +3,35 @@ const errors = require('./errors')
|
|
|
3
3
|
|
|
4
4
|
function makeTag(a, b, c, d) {
|
|
5
5
|
return (
|
|
6
|
-
a.charCodeAt(0) |
|
|
7
|
-
(b.charCodeAt(0) << 8) |
|
|
8
|
-
(c.charCodeAt(0) << 16) |
|
|
9
|
-
(d.charCodeAt(0) << 24)
|
|
6
|
+
a.charCodeAt(0) | (b.charCodeAt(0) << 8) | (c.charCodeAt(0) << 16) | (d.charCodeAt(0) << 24)
|
|
10
7
|
)
|
|
11
8
|
}
|
|
12
9
|
|
|
13
10
|
module.exports = exports = {
|
|
14
11
|
codecs: {
|
|
15
12
|
MJPEG: binding.AV_CODEC_ID_MJPEG,
|
|
13
|
+
H264: binding.AV_CODEC_ID_H264,
|
|
14
|
+
AVC: binding.AV_CODEC_ID_H264, // Alias for H264
|
|
16
15
|
AAC: binding.AV_CODEC_ID_AAC,
|
|
17
16
|
OPUS: binding.AV_CODEC_ID_OPUS,
|
|
18
17
|
AV1: binding.AV_CODEC_ID_AV1,
|
|
19
18
|
FLAC: binding.AV_CODEC_ID_FLAC,
|
|
20
|
-
MP3: binding.AV_CODEC_ID_MP3
|
|
19
|
+
MP3: binding.AV_CODEC_ID_MP3,
|
|
20
|
+
H265: binding.AV_CODEC_ID_HEVC,
|
|
21
|
+
HEVC: binding.AV_CODEC_ID_HEVC,
|
|
22
|
+
VP8: binding.AV_CODEC_ID_VP8,
|
|
23
|
+
VP9: binding.AV_CODEC_ID_VP9,
|
|
24
|
+
VORBIS: binding.AV_CODEC_ID_VORBIS,
|
|
25
|
+
PCM_S16LE: binding.AV_CODEC_ID_PCM_S16LE,
|
|
26
|
+
PCM_S16BE: binding.AV_CODEC_ID_PCM_S16BE,
|
|
27
|
+
PCM_U8: binding.AV_CODEC_ID_PCM_U8,
|
|
28
|
+
PCM_ALAW: binding.AV_CODEC_ID_PCM_ALAW,
|
|
29
|
+
PCM_MULAW: binding.AV_CODEC_ID_PCM_MULAW
|
|
21
30
|
},
|
|
22
31
|
tags: {
|
|
23
32
|
MJPEG: makeTag('M', 'J', 'P', 'G'),
|
|
24
33
|
AV1: makeTag('A', 'V', '0', '1'),
|
|
34
|
+
H264: makeTag('H', '2', '6', '4'),
|
|
25
35
|
AAC: 0x00ff,
|
|
26
36
|
FLAC: 0xf1ac,
|
|
27
37
|
MP3: 0x0055
|
|
@@ -41,7 +51,8 @@ module.exports = exports = {
|
|
|
41
51
|
YUV420P: binding.AV_PIX_FMT_YUV420P,
|
|
42
52
|
NV12: binding.AV_PIX_FMT_NV12,
|
|
43
53
|
NV21: binding.AV_PIX_FMT_NV21,
|
|
44
|
-
NV24: binding.AV_PIX_FMT_NV24
|
|
54
|
+
NV24: binding.AV_PIX_FMT_NV24,
|
|
55
|
+
VIDEOTOOLBOX: binding.AV_PIX_FMT_VIDEOTOOLBOX
|
|
45
56
|
},
|
|
46
57
|
mediaTypes: {
|
|
47
58
|
UNKNOWN: binding.AVMEDIA_TYPE_UNKNOWN,
|
|
@@ -181,8 +192,7 @@ module.exports = exports = {
|
|
|
181
192
|
IAMF_MIX_GAIN_PARAM: binding.AV_PKT_DATA_IAMF_MIX_GAIN_PARAM,
|
|
182
193
|
IAMF_DEMIXING_INFO_PARAM: binding.AV_PKT_DATA_IAMF_DEMIXING_INFO_PARAM,
|
|
183
194
|
IAMF_RECON_GAIN_INFO_PARAM: binding.AV_PKT_DATA_IAMF_RECON_GAIN_INFO_PARAM,
|
|
184
|
-
AMBIENT_VIEWING_ENVIRONMENT:
|
|
185
|
-
binding.AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT,
|
|
195
|
+
AMBIENT_VIEWING_ENVIRONMENT: binding.AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT,
|
|
186
196
|
FRAME_CROPPING: binding.AV_PKT_DATA_FRAME_CROPPING,
|
|
187
197
|
LCEVC: binding.AV_PKT_DATA_LCEVC,
|
|
188
198
|
'3D_REFERENCE_DISPLAYS': binding.AV_PKT_DATA_3D_REFERENCE_DISPLAYS,
|
|
@@ -212,6 +222,86 @@ module.exports = exports = {
|
|
|
212
222
|
ALLOW_NULL: binding.AV_OPT_ALLOW_NULL,
|
|
213
223
|
ARRAY_REPLACE: binding.AV_OPT_ARRAY_REPLACE,
|
|
214
224
|
MULTI_COMPONENT_RANGE: binding.AV_OPT_MULTI_COMPONENT_RANGE
|
|
225
|
+
},
|
|
226
|
+
hwDeviceTypes: {
|
|
227
|
+
VIDEOTOOLBOX: binding.AV_HWDEVICE_TYPE_VIDEOTOOLBOX,
|
|
228
|
+
CUDA: binding.AV_HWDEVICE_TYPE_CUDA,
|
|
229
|
+
VAAPI: binding.AV_HWDEVICE_TYPE_VAAPI,
|
|
230
|
+
DXVA2: binding.AV_HWDEVICE_TYPE_DXVA2,
|
|
231
|
+
QSV: binding.AV_HWDEVICE_TYPE_QSV,
|
|
232
|
+
D3D11VA: binding.AV_HWDEVICE_TYPE_D3D11VA
|
|
233
|
+
},
|
|
234
|
+
hwFrameMapFlags: {
|
|
235
|
+
NONE: 0,
|
|
236
|
+
READ: binding.AV_HWFRAME_MAP_READ,
|
|
237
|
+
WRITE: binding.AV_HWFRAME_MAP_WRITE,
|
|
238
|
+
OVERWRITE: binding.AV_HWFRAME_MAP_OVERWRITE,
|
|
239
|
+
DIRECT: binding.AV_HWFRAME_MAP_DIRECT
|
|
240
|
+
},
|
|
241
|
+
colorSpace: {
|
|
242
|
+
RGB: binding.AVCOL_SPC_RGB,
|
|
243
|
+
BT709: binding.AVCOL_SPC_BT709,
|
|
244
|
+
UNSPECIFIED: binding.AVCOL_SPC_UNSPECIFIED,
|
|
245
|
+
RESERVED: binding.AVCOL_SPC_RESERVED,
|
|
246
|
+
FCC: binding.AVCOL_SPC_FCC,
|
|
247
|
+
BT470BG: binding.AVCOL_SPC_BT470BG,
|
|
248
|
+
SMPTE170M: binding.AVCOL_SPC_SMPTE170M,
|
|
249
|
+
SMPTE240M: binding.AVCOL_SPC_SMPTE240M,
|
|
250
|
+
YCGCO: binding.AVCOL_SPC_YCGCO,
|
|
251
|
+
YCOCG: binding.AVCOL_SPC_YCOCG,
|
|
252
|
+
BT2020_NCL: binding.AVCOL_SPC_BT2020_NCL,
|
|
253
|
+
BT2020_CL: binding.AVCOL_SPC_BT2020_CL,
|
|
254
|
+
SMPTE2085: binding.AVCOL_SPC_SMPTE2085,
|
|
255
|
+
CHROMA_DERIVED_NCL: binding.AVCOL_SPC_CHROMA_DERIVED_NCL,
|
|
256
|
+
CHROMA_DERIVED_CL: binding.AVCOL_SPC_CHROMA_DERIVED_CL,
|
|
257
|
+
ICTCP: binding.AVCOL_SPC_ICTCP,
|
|
258
|
+
IPT_C2: binding.AVCOL_SPC_IPT_C2,
|
|
259
|
+
YCGCO_RE: binding.AVCOL_SPC_YCGCO_RE,
|
|
260
|
+
YCGCO_RO: binding.AVCOL_SPC_YCGCO_RO
|
|
261
|
+
},
|
|
262
|
+
colorRange: {
|
|
263
|
+
UNSPECIFIED: binding.AVCOL_RANGE_UNSPECIFIED,
|
|
264
|
+
MPEG: binding.AVCOL_RANGE_MPEG,
|
|
265
|
+
JPEG: binding.AVCOL_RANGE_JPEG
|
|
266
|
+
},
|
|
267
|
+
colorPrimaries: {
|
|
268
|
+
BT709: binding.AVCOL_PRI_BT709,
|
|
269
|
+
UNSPECIFIED: binding.AVCOL_PRI_UNSPECIFIED,
|
|
270
|
+
RESERVED: binding.AVCOL_PRI_RESERVED,
|
|
271
|
+
BT470M: binding.AVCOL_PRI_BT470M,
|
|
272
|
+
BT470BG: binding.AVCOL_PRI_BT470BG,
|
|
273
|
+
SMPTE170M: binding.AVCOL_PRI_SMPTE170M,
|
|
274
|
+
SMPTE240M: binding.AVCOL_PRI_SMPTE240M,
|
|
275
|
+
FILM: binding.AVCOL_PRI_FILM,
|
|
276
|
+
BT2020: binding.AVCOL_PRI_BT2020,
|
|
277
|
+
SMPTE428: binding.AVCOL_PRI_SMPTE428,
|
|
278
|
+
SMPTEST428_1: binding.AVCOL_PRI_SMPTEST428_1,
|
|
279
|
+
SMPTE431: binding.AVCOL_PRI_SMPTE431,
|
|
280
|
+
SMPTE432: binding.AVCOL_PRI_SMPTE432,
|
|
281
|
+
EBU3213: binding.AVCOL_PRI_EBU3213,
|
|
282
|
+
JEDEC_P22: binding.AVCOL_PRI_JEDEC_P22
|
|
283
|
+
},
|
|
284
|
+
colorTRC: {
|
|
285
|
+
BT709: binding.AVCOL_TRC_BT709,
|
|
286
|
+
UNSPECIFIED: binding.AVCOL_TRC_UNSPECIFIED,
|
|
287
|
+
RESERVED: binding.AVCOL_TRC_RESERVED,
|
|
288
|
+
GAMMA22: binding.AVCOL_TRC_GAMMA22,
|
|
289
|
+
GAMMA28: binding.AVCOL_TRC_GAMMA28,
|
|
290
|
+
SMPTE170M: binding.AVCOL_TRC_SMPTE170M,
|
|
291
|
+
SMPTE240M: binding.AVCOL_TRC_SMPTE240M,
|
|
292
|
+
LINEAR: binding.AVCOL_TRC_LINEAR,
|
|
293
|
+
LOG: binding.AVCOL_TRC_LOG,
|
|
294
|
+
LOG_SQRT: binding.AVCOL_TRC_LOG_SQRT,
|
|
295
|
+
IEC61966_2_4: binding.AVCOL_TRC_IEC61966_2_4,
|
|
296
|
+
BT1361_ECG: binding.AVCOL_TRC_BT1361_ECG,
|
|
297
|
+
IEC61966_2_1: binding.AVCOL_TRC_IEC61966_2_1,
|
|
298
|
+
BT2020_10: binding.AVCOL_TRC_BT2020_10,
|
|
299
|
+
BT2020_12: binding.AVCOL_TRC_BT2020_12,
|
|
300
|
+
SMPTE2084: binding.AVCOL_TRC_SMPTE2084,
|
|
301
|
+
SMPTEST2084: binding.AVCOL_TRC_SMPTEST2084,
|
|
302
|
+
SMPTE428: binding.AVCOL_TRC_SMPTE428,
|
|
303
|
+
SMPTEST428_1: binding.AVCOL_TRC_SMPTEST428_1,
|
|
304
|
+
ARIB_STD_B67: binding.AVCOL_TRC_ARIB_STD_B67
|
|
215
305
|
}
|
|
216
306
|
}
|
|
217
307
|
|
|
@@ -270,3 +360,27 @@ exports.getSampleFormatName = function (sampleFormat) {
|
|
|
270
360
|
exports.getPixelFormatName = function (pixelFormat) {
|
|
271
361
|
return binding.getPixelFormatNameByID(pixelFormat)
|
|
272
362
|
}
|
|
363
|
+
|
|
364
|
+
exports.getColorSpaceName = function (colorSpace) {
|
|
365
|
+
return binding.getColorSpaceNameByID(colorSpace)
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
exports.toColorSpace = function (name) {
|
|
369
|
+
return binding.getColorSpaceFromName(name)
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
exports.getColorPrimariesName = function (colorPrimaries) {
|
|
373
|
+
return binding.getColorPrimariesNameByID(colorPrimaries)
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
exports.toColorPrimaries = function (name) {
|
|
377
|
+
return binding.getColorPrimariesFromName(name)
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
exports.getColorTransferName = function (colorTransfer) {
|
|
381
|
+
return binding.getColorTransferNameByID(colorTransfer)
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
exports.toColorTransfer = function (name) {
|
|
385
|
+
return binding.getColorTransferFromName(name)
|
|
386
|
+
}
|
package/lib/errors.js
CHANGED
|
@@ -13,26 +13,14 @@ module.exports = class FFmpegError extends Error {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
static UNKNOWN_PIXEL_FORMAT(msg) {
|
|
16
|
-
return new FFmpegError(
|
|
17
|
-
msg,
|
|
18
|
-
'UNKNOWN_PIXEL_FORMAT',
|
|
19
|
-
FFmpegError.UNKNOWN_PIXEL_FORMAT
|
|
20
|
-
)
|
|
16
|
+
return new FFmpegError(msg, 'UNKNOWN_PIXEL_FORMAT', FFmpegError.UNKNOWN_PIXEL_FORMAT)
|
|
21
17
|
}
|
|
22
18
|
|
|
23
19
|
static UNKNOWN_SAMPLE_FORMAT(msg) {
|
|
24
|
-
return new FFmpegError(
|
|
25
|
-
msg,
|
|
26
|
-
'UNKNOWN_SAMPLE_FORMAT',
|
|
27
|
-
FFmpegError.UNKNOWN_SAMPLE_FORMAT
|
|
28
|
-
)
|
|
20
|
+
return new FFmpegError(msg, 'UNKNOWN_SAMPLE_FORMAT', FFmpegError.UNKNOWN_SAMPLE_FORMAT)
|
|
29
21
|
}
|
|
30
22
|
|
|
31
23
|
static UNKNOWN_CHANNEL_LAYOUT(msg) {
|
|
32
|
-
return new FFmpegError(
|
|
33
|
-
msg,
|
|
34
|
-
'UNKNOWN_CHANNEL_LAYOUT',
|
|
35
|
-
FFmpegError.UNKNOWN_CHANNEL_LAYOUT
|
|
36
|
-
)
|
|
24
|
+
return new FFmpegError(msg, 'UNKNOWN_CHANNEL_LAYOUT', FFmpegError.UNKNOWN_CHANNEL_LAYOUT)
|
|
37
25
|
}
|
|
38
26
|
}
|
package/lib/filter-graph.js
CHANGED
|
@@ -21,12 +21,7 @@ module.exports = class FilterGraph {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
parse(filterDescription, inputs, outputs) {
|
|
24
|
-
binding.parseFilterGraph(
|
|
25
|
-
this._handle,
|
|
26
|
-
inputs._handle,
|
|
27
|
-
outputs._handle,
|
|
28
|
-
filterDescription
|
|
29
|
-
)
|
|
24
|
+
binding.parseFilterGraph(this._handle, inputs._handle, outputs._handle, filterDescription)
|
|
30
25
|
}
|
|
31
26
|
|
|
32
27
|
configure() {
|
package/lib/filter-inout.js
CHANGED
|
@@ -26,10 +26,7 @@ module.exports = class FilterInOut {
|
|
|
26
26
|
|
|
27
27
|
set filterContext(value) {
|
|
28
28
|
this._filterContext = value
|
|
29
|
-
return binding.setFilterInOutFilterContext(
|
|
30
|
-
this._handle,
|
|
31
|
-
this._filterContext._handle
|
|
32
|
-
)
|
|
29
|
+
return binding.setFilterInOutFilterContext(this._handle, this._filterContext._handle)
|
|
33
30
|
}
|
|
34
31
|
|
|
35
32
|
get padIdx() {
|
package/lib/format-context.js
CHANGED
|
@@ -49,10 +49,7 @@ class FFmpegFormatContext {
|
|
|
49
49
|
return null
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
const bestIndex = binding.getFormatContextBestStreamIndex(
|
|
53
|
-
this._handle,
|
|
54
|
-
type
|
|
55
|
-
)
|
|
52
|
+
const bestIndex = binding.getFormatContextBestStreamIndex(this._handle, type)
|
|
56
53
|
|
|
57
54
|
if (bestIndex < 0 || bestIndex >= this._streams.length) {
|
|
58
55
|
return null
|
|
@@ -84,9 +81,7 @@ switch (Bare.platform) {
|
|
|
84
81
|
break
|
|
85
82
|
}
|
|
86
83
|
|
|
87
|
-
exports.InputFormatContext = class FFmpegInputFormatContext extends
|
|
88
|
-
FFmpegFormatContext
|
|
89
|
-
) {
|
|
84
|
+
exports.InputFormatContext = class FFmpegInputFormatContext extends FFmpegFormatContext {
|
|
90
85
|
constructor(io, options, url = defaultURL) {
|
|
91
86
|
if (io instanceof IOContext) {
|
|
92
87
|
super(io)
|
|
@@ -97,11 +92,7 @@ exports.InputFormatContext = class FFmpegInputFormatContext extends (
|
|
|
97
92
|
|
|
98
93
|
options = options || new Dictionary()
|
|
99
94
|
|
|
100
|
-
this._handle = binding.openInputFormatContextWithFormat(
|
|
101
|
-
io._handle,
|
|
102
|
-
options._handle,
|
|
103
|
-
url
|
|
104
|
-
)
|
|
95
|
+
this._handle = binding.openInputFormatContextWithFormat(io._handle, options._handle, url)
|
|
105
96
|
|
|
106
97
|
options.destroy()
|
|
107
98
|
}
|
|
@@ -128,9 +119,7 @@ exports.InputFormatContext = class FFmpegInputFormatContext extends (
|
|
|
128
119
|
}
|
|
129
120
|
}
|
|
130
121
|
|
|
131
|
-
exports.OutputFormatContext = class FFmpegOutputFormatContext extends
|
|
132
|
-
FFmpegFormatContext
|
|
133
|
-
) {
|
|
122
|
+
exports.OutputFormatContext = class FFmpegOutputFormatContext extends FFmpegFormatContext {
|
|
134
123
|
constructor(format, io) {
|
|
135
124
|
super(io)
|
|
136
125
|
|