@lumen5/beamcoder 0.0.1
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/.circleci/config.yml +41 -0
- package/.circleci/images/testbeam10-4.1/Dockerfile +12 -0
- package/.circleci/test_image/Dockerfile +14 -0
- package/.circleci/test_image/build.md +13 -0
- package/.eslintrc.js +27 -0
- package/.github/workflows/publish-npm.yml +33 -0
- package/LICENSE +674 -0
- package/README.md +1221 -0
- package/beamstreams.js +692 -0
- package/binding.gyp +103 -0
- package/examples/encode_h264.js +92 -0
- package/examples/jpeg_app.js +55 -0
- package/examples/jpeg_filter_app.js +101 -0
- package/examples/make_mp4.js +123 -0
- package/images/beamcoder_small.jpg +0 -0
- package/index.d.ts +83 -0
- package/index.js +44 -0
- package/install_ffmpeg.js +240 -0
- package/package.json +45 -0
- package/scratch/decode_aac.js +38 -0
- package/scratch/decode_avci.js +50 -0
- package/scratch/decode_hevc.js +38 -0
- package/scratch/decode_pcm.js +39 -0
- package/scratch/make_a_mux.js +68 -0
- package/scratch/muxer.js +74 -0
- package/scratch/read_wav.js +35 -0
- package/scratch/simple_mux.js +39 -0
- package/scratch/stream_avci.js +127 -0
- package/scratch/stream_mp4.js +78 -0
- package/scratch/stream_mux.js +47 -0
- package/scratch/stream_pcm.js +82 -0
- package/scratch/stream_wav.js +62 -0
- package/scripts/install_beamcoder_dependencies.sh +25 -0
- package/src/adaptor.h +202 -0
- package/src/beamcoder.cc +937 -0
- package/src/beamcoder_util.cc +1129 -0
- package/src/beamcoder_util.h +206 -0
- package/src/codec.cc +7386 -0
- package/src/codec.h +44 -0
- package/src/codec_par.cc +1818 -0
- package/src/codec_par.h +40 -0
- package/src/decode.cc +569 -0
- package/src/decode.h +75 -0
- package/src/demux.cc +584 -0
- package/src/demux.h +88 -0
- package/src/encode.cc +496 -0
- package/src/encode.h +72 -0
- package/src/filter.cc +1888 -0
- package/src/filter.h +30 -0
- package/src/format.cc +5287 -0
- package/src/format.h +77 -0
- package/src/frame.cc +2681 -0
- package/src/frame.h +52 -0
- package/src/governor.cc +286 -0
- package/src/governor.h +30 -0
- package/src/hwcontext.cc +378 -0
- package/src/hwcontext.h +35 -0
- package/src/log.cc +186 -0
- package/src/log.h +20 -0
- package/src/mux.cc +834 -0
- package/src/mux.h +106 -0
- package/src/packet.cc +762 -0
- package/src/packet.h +49 -0
- package/test/codecParamsSpec.js +148 -0
- package/test/decoderSpec.js +56 -0
- package/test/demuxerSpec.js +41 -0
- package/test/encoderSpec.js +69 -0
- package/test/filtererSpec.js +47 -0
- package/test/formatSpec.js +343 -0
- package/test/frameSpec.js +145 -0
- package/test/introspectionSpec.js +73 -0
- package/test/muxerSpec.js +34 -0
- package/test/packetSpec.js +122 -0
- package/types/Beamstreams.d.ts +98 -0
- package/types/Codec.d.ts +123 -0
- package/types/CodecContext.d.ts +555 -0
- package/types/CodecPar.d.ts +108 -0
- package/types/Decoder.d.ts +137 -0
- package/types/Demuxer.d.ts +113 -0
- package/types/Encoder.d.ts +94 -0
- package/types/Filter.d.ts +324 -0
- package/types/FormatContext.d.ts +380 -0
- package/types/Frame.d.ts +295 -0
- package/types/HWContext.d.ts +62 -0
- package/types/Muxer.d.ts +121 -0
- package/types/Packet.d.ts +82 -0
- package/types/PrivClass.d.ts +25 -0
- package/types/Stream.d.ts +165 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export type HWDeviceType = 'none' | 'vdpau' | 'cuda' | 'vaapi' | 'dxva2' | 'qsv' | 'videotoolbox' |
|
|
2
|
+
'd3d11va' | 'drm' | 'opencl' | 'mediacodec' | 'vulkan'
|
|
3
|
+
|
|
4
|
+
export interface HWDeviceContext {
|
|
5
|
+
/** Object name. */
|
|
6
|
+
readonly type: 'HWDeviceContext'
|
|
7
|
+
/**
|
|
8
|
+
* This field identifies the underlying API used for hardware access.
|
|
9
|
+
* This field is set when the context is allocated and never changed afterwards.
|
|
10
|
+
*/
|
|
11
|
+
readonly device_type: HWDeviceType
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface HWFramesContext {
|
|
15
|
+
/** Object name. */
|
|
16
|
+
readonly type: 'HWFramesContext'
|
|
17
|
+
/**
|
|
18
|
+
* A reference to the parent HWDeviceContext. This reference is owned and
|
|
19
|
+
* managed by the enclosing HWFramesContext, but the caller may derive
|
|
20
|
+
* additional references from it.
|
|
21
|
+
*/
|
|
22
|
+
readonly device_context: HWDeviceContext
|
|
23
|
+
/**
|
|
24
|
+
* Initial size of the frame pool. If a device type does not support
|
|
25
|
+
* dynamically resizing the pool, then this is also the maximum pool size.
|
|
26
|
+
*
|
|
27
|
+
* May be set by the caller before calling av_hwframe_ctx_init(). Must be
|
|
28
|
+
* set if pool is NULL and the device type does not support dynamic pools.
|
|
29
|
+
*/
|
|
30
|
+
readonly initial_pool_size: number
|
|
31
|
+
/**
|
|
32
|
+
* The pixel format identifying the underlying HW surface type.
|
|
33
|
+
*
|
|
34
|
+
* Must be a hwaccel format, i.e. the corresponding descriptor must have the
|
|
35
|
+
* AV_PIX_FMT_FLAG_HWACCEL flag set.
|
|
36
|
+
*
|
|
37
|
+
* Must be set by the user before calling av_hwframe_ctx_init().
|
|
38
|
+
*/
|
|
39
|
+
readonly pix_fmt: string
|
|
40
|
+
/**
|
|
41
|
+
* The pixel format identifying the actual data layout of the hardware
|
|
42
|
+
* frames.
|
|
43
|
+
*
|
|
44
|
+
* Must be set by the caller before calling av_hwframe_ctx_init().
|
|
45
|
+
*
|
|
46
|
+
* @note when the underlying API does not provide the exact data layout, but
|
|
47
|
+
* only the colorspace/bit depth, this field should be set to the fully
|
|
48
|
+
* planar version of that format (e.g. for 8-bit 420 YUV it should be
|
|
49
|
+
* AV_PIX_FMT_YUV420P, not AV_PIX_FMT_NV12 or anything else).
|
|
50
|
+
*/
|
|
51
|
+
readonly sw_pix_fmt: string
|
|
52
|
+
/**
|
|
53
|
+
* The allocated width of the frames in this pool.
|
|
54
|
+
* Must be set by the user before calling av_hwframe_ctx_init().
|
|
55
|
+
*/
|
|
56
|
+
readonly width: number
|
|
57
|
+
/**
|
|
58
|
+
* The allocated height of the frames in this pool.
|
|
59
|
+
* Must be set by the user before calling av_hwframe_ctx_init().
|
|
60
|
+
*/
|
|
61
|
+
readonly height: number
|
|
62
|
+
}
|
package/types/Muxer.d.ts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { Packet } from "./Packet"
|
|
2
|
+
import { Frame } from "./Frame"
|
|
3
|
+
import { OutputFormat, FormatContext } from "./FormatContext"
|
|
4
|
+
|
|
5
|
+
export interface Muxer extends Omit<FormatContext,
|
|
6
|
+
'iformat' | 'start_time' | 'probesize' | 'max_analyze_duration' | 'max_index_size' |
|
|
7
|
+
'fps_probe_size' | 'error_recognition' | 'max_ts_probe' | 'use_wallclock_as_timestamps' |
|
|
8
|
+
'avio_flags' | 'duration_estimation_method' | 'skip_initial_bytes' | 'correct_ts_overflow' |
|
|
9
|
+
'seek2any' | 'probe_score' | 'format_probesize' | 'codec_whitelist' | 'format_whitelist' |
|
|
10
|
+
'io_repositioned' | 'output_ts_offset' | 'protocol_whitelist' | 'protocol_blacklist' |
|
|
11
|
+
'max_streams' | 'skip_estimate_duration_from_pts'
|
|
12
|
+
> {
|
|
13
|
+
/** Object name. */
|
|
14
|
+
type: 'muxer'
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Open the output file or stream - requires that a filename or URL has been provided with the
|
|
18
|
+
* creation of the muxer using the filename property
|
|
19
|
+
* @returns Promise that resolves to _undefined_ on success
|
|
20
|
+
*/
|
|
21
|
+
openIO(): Promise<undefined>
|
|
22
|
+
/**
|
|
23
|
+
* Open the output file or stream by passing in an object containing the filename or url.
|
|
24
|
+
* @param openOptions An object containing the filename or url. The object can also contain an options
|
|
25
|
+
* object to further configure the protocol with private data and a flags parameter to configure bytestream AVIO flags.
|
|
26
|
+
* @returns Promise that resolves to _undefined_ on success or to an object with an unset property detailing
|
|
27
|
+
* which of the properties could not be set.
|
|
28
|
+
*/
|
|
29
|
+
openIO(openOptions: {
|
|
30
|
+
url?: string
|
|
31
|
+
filename?: string
|
|
32
|
+
options?: { [key: string]: any }
|
|
33
|
+
flags?: {
|
|
34
|
+
READ: boolean
|
|
35
|
+
WRITE: boolean
|
|
36
|
+
NONBLOCK: boolean
|
|
37
|
+
DIRECT: boolean
|
|
38
|
+
}
|
|
39
|
+
}): Promise<undefined | { unset: {[key: string]: any}}>
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* In some cases, it is necessary to initialize the structures of the muxer before writing the header.
|
|
43
|
+
* Allows passing in of private data to set private options of the muxer.
|
|
44
|
+
* @returns Promise that resolves to an object that indicates whether the stream parameters were
|
|
45
|
+
* intialised in writeHeader or initOutput, together with an unset property if any properties could not be set
|
|
46
|
+
*/
|
|
47
|
+
initOutput(options?: { [key:string]: any }) : Promise<{
|
|
48
|
+
INIT_IN: 'WRITE_HEADER' | 'INIT_OUTPUT'
|
|
49
|
+
unset?: {[key: string]: any}
|
|
50
|
+
}>
|
|
51
|
+
/**
|
|
52
|
+
* Write the header to the file, optionally passing in private data to set private options of the muxer.
|
|
53
|
+
* This must be done even for formats that don't have a header as part of the internal structure
|
|
54
|
+
* as this step also initializes the internal data structures for writing.
|
|
55
|
+
* @returns Promise that resolves to an object that indicates whether the stream parameters were
|
|
56
|
+
* intialised in writeHeader or initOutput, together with an unset property if any properties could not be set
|
|
57
|
+
*/
|
|
58
|
+
writeHeader(options?: { [key:string]: any }) : Promise<{
|
|
59
|
+
INIT_IN: 'WRITE_HEADER' | 'INIT_OUTPUT'
|
|
60
|
+
unset?: {[key: string]: any}
|
|
61
|
+
}>
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Write media data to the file by sending a packet containing data for a media stream.
|
|
65
|
+
* @param packet Packet of compressed data, must contain the stream index and timestamps measured in the
|
|
66
|
+
* `time_base` of the stream.
|
|
67
|
+
* @returns Promise that resolves to _undefined_ on success
|
|
68
|
+
*/
|
|
69
|
+
writeFrame(packet: Packet) : Promise<undefined>
|
|
70
|
+
/**
|
|
71
|
+
* Write media data to the file by sending a packet containing data for a media stream.
|
|
72
|
+
* @param options Object containing a packet property of a compressed data Packet, must contain the
|
|
73
|
+
* stream index and timestamps measured in the `time_base` of the stream.
|
|
74
|
+
* @returns Promise that resolves to _undefined_ on success
|
|
75
|
+
*/
|
|
76
|
+
writeFrame(options: { packet: Packet }) : Promise<undefined>
|
|
77
|
+
/**
|
|
78
|
+
* Write media data to the file by sending a packet containing data for a media stream.
|
|
79
|
+
* @param options Object containing a stream index property and a frame property of an
|
|
80
|
+
* uncompressed Frame, which must contain the timestamps measured in the `time_base` of the stream.
|
|
81
|
+
* @returns Promise that resolves to _undefined_ on success
|
|
82
|
+
*/
|
|
83
|
+
writeFrame(options: { frame: Frame, stream_index: number }) : Promise<undefined>
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Write the trailer at the end of the file or stream. It is written after the muxer has drained its
|
|
87
|
+
* buffers of all remaining packets and frames. Writing the trailer also closes the file or stream.
|
|
88
|
+
* @returns Promise that resolves to _undefined_ on success
|
|
89
|
+
*/
|
|
90
|
+
writeTrailer(): Promise<undefined>
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Abandon the muxing process and forcibly close the file or stream without completing it
|
|
94
|
+
*/
|
|
95
|
+
forceClose(): undefined
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Provides a list and details of all the available muxer output formats
|
|
100
|
+
* @returns an object with details of all the available muxer output formats
|
|
101
|
+
*/
|
|
102
|
+
export function muxers(): { [key: string]: OutputFormat }
|
|
103
|
+
|
|
104
|
+
/** Object to provide additional metadata on Muxer creation */
|
|
105
|
+
export interface MuxerCreateOptions {
|
|
106
|
+
/** The name of a chosen OutputFormat */
|
|
107
|
+
name?: string
|
|
108
|
+
format_name?: string
|
|
109
|
+
/** String describing the destinatione to be written to (may contain %d for a sequence of numbered files). */
|
|
110
|
+
filename?: string
|
|
111
|
+
/** Object that provides format details */
|
|
112
|
+
oformat?: OutputFormat
|
|
113
|
+
/** Object allowing additional information to be provided */
|
|
114
|
+
[key: string]: any
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Create a muxer to write to a URL or filename
|
|
118
|
+
* @param options a MuxerCreateOptions object
|
|
119
|
+
* @returns A Muxer object
|
|
120
|
+
*/
|
|
121
|
+
export function muxer(options: MuxerCreateOptions): Muxer
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This object stores compressed data. It is typically exported by demuxers
|
|
3
|
+
* and then passed as input to decoders, or received as output from encoders and
|
|
4
|
+
* then passed to muxers.
|
|
5
|
+
*
|
|
6
|
+
* For video, it should typically contain one compressed frame. For audio it may
|
|
7
|
+
* contain several compressed frames. Encoders are allowed to output empty
|
|
8
|
+
* packets, with no compressed data, containing only side data
|
|
9
|
+
* (e.g. to update some stream parameters at the end of encoding).
|
|
10
|
+
*/
|
|
11
|
+
export interface Packet {
|
|
12
|
+
/** Object name. */
|
|
13
|
+
readonly type: 'Packet'
|
|
14
|
+
/**
|
|
15
|
+
* Presentation timestamp in AVStream->time_base units the time at which
|
|
16
|
+
* the decompressed packet will be presented to the user.
|
|
17
|
+
* Can be AV_NOPTS_VALUE if it is not stored in the file.
|
|
18
|
+
* pts MUST be larger or equal to dts as presentation cannot happen before
|
|
19
|
+
* decompression, unless one wants to view hex dumps. Some formats misuse
|
|
20
|
+
* the terms dts and pts/cts to mean something different. Such timestamps
|
|
21
|
+
* must be converted to true pts/dts before they are stored in Packet.
|
|
22
|
+
*/
|
|
23
|
+
pts: number
|
|
24
|
+
/**
|
|
25
|
+
* Decompression timestamp in AVStream->time_base units the time at which
|
|
26
|
+
* the packet is decompressed.
|
|
27
|
+
* Can be AV_NOPTS_VALUE if it is not stored in the file.
|
|
28
|
+
*/
|
|
29
|
+
dts: number
|
|
30
|
+
/**
|
|
31
|
+
* The raw data of the packet
|
|
32
|
+
* Packet data buffers are shared between C and Javascript so can be written to and modified without having to write the buffer back into the packet
|
|
33
|
+
*/
|
|
34
|
+
data: Buffer
|
|
35
|
+
/** The size in bytes of the raw data */
|
|
36
|
+
size: number
|
|
37
|
+
/** The index in the format's stream array that this packet belongs to */
|
|
38
|
+
stream_index: number
|
|
39
|
+
/** A combination of AV_PKT_FLAG values */
|
|
40
|
+
flags: {
|
|
41
|
+
/** The packet contains a keyframe */
|
|
42
|
+
KEY: boolean
|
|
43
|
+
/** The packet content is corrupted */
|
|
44
|
+
CORRUPT: boolean
|
|
45
|
+
/**
|
|
46
|
+
* Flag is used to discard packets which are required to maintain valid
|
|
47
|
+
* decoder state but are not required for output and should be dropped
|
|
48
|
+
* after decoding.
|
|
49
|
+
**/
|
|
50
|
+
DISCARD: boolean
|
|
51
|
+
/**
|
|
52
|
+
* The packet comes from a trusted source.
|
|
53
|
+
*
|
|
54
|
+
* Otherwise-unsafe constructs such as arbitrary pointers to data
|
|
55
|
+
* outside the packet may be followed.
|
|
56
|
+
*/
|
|
57
|
+
TRUSTED: boolean
|
|
58
|
+
/**
|
|
59
|
+
* Flag is used to indicate packets that contain frames that can
|
|
60
|
+
* be discarded by the decoder. I.e. Non-reference frames.
|
|
61
|
+
*/
|
|
62
|
+
DISPOSABLE: boolean // Frames that can be discarded by the decoder
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Additional packet data that can be provided by the container.
|
|
66
|
+
* Packet can contain several types of side information.
|
|
67
|
+
*/
|
|
68
|
+
side_data: { type: string, [key: string]: Buffer | string } | null
|
|
69
|
+
/**
|
|
70
|
+
* Duration of this packet in AVStream->time_base units, 0 if unknown.
|
|
71
|
+
* Equals next_pts - this_pts in presentation order.
|
|
72
|
+
*/
|
|
73
|
+
duration: number
|
|
74
|
+
/** byte position in stream, -1 if unknown */
|
|
75
|
+
pos: number
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Packets for decoding can be created without reading them from a demuxer
|
|
80
|
+
* Set parameters as required from the Packet object, passing in a buffer and the required size in bytes
|
|
81
|
+
*/
|
|
82
|
+
export function packet(options: { [key: string]: any, data: Buffer, size: number }): Packet
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface PrivClass {
|
|
2
|
+
readonly type: 'Class'
|
|
3
|
+
readonly class_name: string
|
|
4
|
+
readonly options: {
|
|
5
|
+
[key: string]: {
|
|
6
|
+
name: string
|
|
7
|
+
help: string
|
|
8
|
+
option_type: string
|
|
9
|
+
flags: {
|
|
10
|
+
ENCODING_PARAM: boolean
|
|
11
|
+
DECODING_PARAM: boolean
|
|
12
|
+
AUDIO_PARAM: boolean
|
|
13
|
+
VIDEO_PARAM: boolean
|
|
14
|
+
SUBTITLE_PARAM: boolean
|
|
15
|
+
EXPORT: boolean
|
|
16
|
+
READONLY: boolean
|
|
17
|
+
BSF_PARAM: boolean
|
|
18
|
+
FILTERING_PARAM: boolean
|
|
19
|
+
DEPRECATED: boolean
|
|
20
|
+
}
|
|
21
|
+
unit?: string
|
|
22
|
+
const?: Array<string>
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { CodecPar } from "./CodecPar";
|
|
2
|
+
import { Packet } from "./Packet"
|
|
3
|
+
|
|
4
|
+
export interface Disposition {
|
|
5
|
+
DEFAULT?: boolean
|
|
6
|
+
DUB?: boolean
|
|
7
|
+
ORIGINAL?: boolean
|
|
8
|
+
COMMENT?: boolean
|
|
9
|
+
LYRICS?: boolean
|
|
10
|
+
KARAOKE?: boolean
|
|
11
|
+
/**
|
|
12
|
+
* Track should be used during playback by default.
|
|
13
|
+
* Useful for subtitle track that should be displayed
|
|
14
|
+
* even when user did not explicitly ask for subtitles.
|
|
15
|
+
*/
|
|
16
|
+
FORCED?: boolean
|
|
17
|
+
/** Stream for hearing impaired audiences */
|
|
18
|
+
HEARING_IMPAIRED?: boolean
|
|
19
|
+
/** Stream for visual impaired audiences */
|
|
20
|
+
VISUAL_IMPAIRED?: boolean
|
|
21
|
+
/** Stream without voice */
|
|
22
|
+
CLEAN_EFFECTS?: boolean
|
|
23
|
+
/**
|
|
24
|
+
* The stream is stored in the file as an attached picture/"cover art" (e.g.
|
|
25
|
+
* APIC frame in ID3v2). The first (usually only) packet associated with it
|
|
26
|
+
* will be returned among the first few packets read from the file unless
|
|
27
|
+
* seeking takes place. It can also be accessed at any time in
|
|
28
|
+
* Stream.attached_pic.
|
|
29
|
+
*/
|
|
30
|
+
ATTACHED_PIC?: boolean
|
|
31
|
+
/**
|
|
32
|
+
* The stream is sparse, and contains thumbnail images, often corresponding
|
|
33
|
+
* to chapter markers. Only ever used with Disposition ATTACHED_PIC.
|
|
34
|
+
*/
|
|
35
|
+
TIMED_THUMBNAILS?: boolean
|
|
36
|
+
/** To specify text track kind (different from subtitles default). */
|
|
37
|
+
CAPTIONS?: boolean
|
|
38
|
+
DESCRIPTIONS?: boolean
|
|
39
|
+
METADATA?: boolean
|
|
40
|
+
/** Dependent audio stream (mix_type=0 in mpegts) */
|
|
41
|
+
DEPENDENT?: boolean
|
|
42
|
+
/** Still images in video stream (still_picture_flag=1 in mpegts) */
|
|
43
|
+
STILL_IMAGE?: boolean
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface EventFlags {
|
|
47
|
+
METADATA_UPDATED?: boolean
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Stream describes the properties of a stream.
|
|
52
|
+
*/
|
|
53
|
+
export interface Stream {
|
|
54
|
+
/** Object name. */
|
|
55
|
+
readonly type: 'Stream'
|
|
56
|
+
/** The stream index in the container. */
|
|
57
|
+
readonly index: number
|
|
58
|
+
/**
|
|
59
|
+
* Format-specific stream ID.
|
|
60
|
+
* decoding: set by beamcoder
|
|
61
|
+
* encoding: set by the user, replaced by beamcoder if left unset
|
|
62
|
+
*/
|
|
63
|
+
id: number
|
|
64
|
+
/**
|
|
65
|
+
* This is the fundamental unit of time (in seconds) in terms
|
|
66
|
+
* of which frame timestamps are represented.
|
|
67
|
+
*
|
|
68
|
+
* decoding: set by beamcoder
|
|
69
|
+
* encoding: May be set by the caller before writeHeader() to
|
|
70
|
+
* provide a hint to the muxer about the desired timebase. In
|
|
71
|
+
* writeHeader(), the muxer will overwrite this field
|
|
72
|
+
* with the timebase that will actually be used for the timestamps
|
|
73
|
+
* written into the file (which may or may not be related to the
|
|
74
|
+
* user-provided one, depending on the format).
|
|
75
|
+
*/
|
|
76
|
+
time_base: Array<number>
|
|
77
|
+
/**
|
|
78
|
+
* Decoding: pts of the first frame of the stream in presentation order, in stream time base.
|
|
79
|
+
* Only set this if you are absolutely 100% sure that the value you set
|
|
80
|
+
* it to really is the pts of the first frame.
|
|
81
|
+
* This may be undefined (AV_NOPTS_VALUE).
|
|
82
|
+
* @note The ASF header does NOT contain a correct start_time the ASF
|
|
83
|
+
* demuxer must NOT set this.
|
|
84
|
+
*/
|
|
85
|
+
start_time: number | null
|
|
86
|
+
/**
|
|
87
|
+
* Decoding: duration of the stream, in stream time base.
|
|
88
|
+
* If a source file does not specify a duration, but does specify
|
|
89
|
+
* a bitrate, this value will be estimated from bitrate and file size.
|
|
90
|
+
*
|
|
91
|
+
* Encoding: May be set by the caller before writeHeader() to
|
|
92
|
+
* provide a hint to the muxer about the estimated duration.
|
|
93
|
+
*/
|
|
94
|
+
duration: number | null
|
|
95
|
+
/** Number of frames in this stream if known or 0 */
|
|
96
|
+
nb_frames: number
|
|
97
|
+
disposition: Disposition
|
|
98
|
+
/** Selects which packets can be discarded at will and do not need to be demuxed. */
|
|
99
|
+
discard: 'none' | 'default' | 'nonref' | 'bidir' | 'nonintra' | 'nonkey' | 'all'
|
|
100
|
+
/**
|
|
101
|
+
* sample aspect ratio (0 if unknown)
|
|
102
|
+
* - encoding: Set by user.
|
|
103
|
+
* - decoding: Set by beamcoder.
|
|
104
|
+
*/
|
|
105
|
+
sample_aspect_ratio: Array<number>
|
|
106
|
+
|
|
107
|
+
metadata: { [key: string]: string }
|
|
108
|
+
/**
|
|
109
|
+
* Average framerate
|
|
110
|
+
*
|
|
111
|
+
* - demuxing: May be set by beamcoder when creating the stream
|
|
112
|
+
* - muxing: May be set by the caller before writeHeader().
|
|
113
|
+
*/
|
|
114
|
+
avg_frame_rate: Array<number>
|
|
115
|
+
/**
|
|
116
|
+
* For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet
|
|
117
|
+
* will contain the attached picture.
|
|
118
|
+
*
|
|
119
|
+
* decoding: set by beamcoder, must not be modified by the caller.
|
|
120
|
+
* encoding: unused
|
|
121
|
+
*/
|
|
122
|
+
readonly attached_pic: Packet | null
|
|
123
|
+
/**
|
|
124
|
+
* An array of side data that applies to the whole stream (i.e. the
|
|
125
|
+
* container does not allow it to change between packets).
|
|
126
|
+
*
|
|
127
|
+
* There may be no overlap between the side data in this array and side data
|
|
128
|
+
* in the packets. I.e. a given side data is either exported by the muxer
|
|
129
|
+
* (demuxing) / set by the caller (muxing) in this array, then it never
|
|
130
|
+
* appears in the packets, or the side data is exported / sent through
|
|
131
|
+
* the packets (always in the first packet where the value becomes known or
|
|
132
|
+
* changes), then it does not appear in this array.
|
|
133
|
+
*
|
|
134
|
+
* - demuxing: Set by beamcoder when the stream is created.
|
|
135
|
+
* - muxing: May be set by the caller before writeHeader().
|
|
136
|
+
*/
|
|
137
|
+
side_data: {
|
|
138
|
+
type: 'PacketSideData'
|
|
139
|
+
[key: string]: Buffer | string
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Flags for the user to detect events happening on the stream. Flags must
|
|
143
|
+
* be cleared by the user once the event has been handled.
|
|
144
|
+
*/
|
|
145
|
+
event_flags: EventFlags
|
|
146
|
+
/**
|
|
147
|
+
* Real base framerate of the stream.
|
|
148
|
+
* This is the lowest framerate with which all timestamps can be
|
|
149
|
+
* represented accurately (it is the least common multiple of all
|
|
150
|
+
* framerates in the stream). Note, this value is just a guess!
|
|
151
|
+
* For example, if the time base is 1/90000 and all frames have either
|
|
152
|
+
* approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1.
|
|
153
|
+
*/
|
|
154
|
+
r_frame_rate: Array<number>
|
|
155
|
+
/**
|
|
156
|
+
* Codec parameters associated with this stream.
|
|
157
|
+
*
|
|
158
|
+
* - demuxing: filled by beamcoder on stream creation
|
|
159
|
+
* - muxing: filled by the caller before writeHeader()
|
|
160
|
+
*/
|
|
161
|
+
codecpar: CodecPar
|
|
162
|
+
|
|
163
|
+
/** Retun a JSON string containing the object properties. */
|
|
164
|
+
toJSON(): string
|
|
165
|
+
}
|