mirror of
https://github.com/arcodange-org/mediabunny.git
synced 2026-09-27 19:03:46 +02:00
Add documentation on writing files
This commit is contained in:
+2
-2
@@ -20,8 +20,8 @@ export {
|
||||
WebMOutputFormatOptions,
|
||||
Mp3OutputFormat,
|
||||
Mp3OutputFormatOptions,
|
||||
WaveOutputFormat,
|
||||
WaveOutputFormatOptions,
|
||||
WavOutputFormat,
|
||||
WavOutputFormatOptions,
|
||||
OggOutputFormat,
|
||||
OggOutputFormatOptions,
|
||||
TrackCountLimits,
|
||||
|
||||
@@ -335,6 +335,8 @@ export class IsobmffMuxer extends Muxer {
|
||||
async addEncodedAudioPacket(track: OutputAudioTrack, packet: EncodedPacket, meta?: EncodedAudioChunkMetadata) {
|
||||
const release = await this.mutex.acquire();
|
||||
|
||||
console.log(meta);
|
||||
|
||||
try {
|
||||
const trackData = this.getAudioTrackData(track, meta);
|
||||
|
||||
|
||||
+10
-9
@@ -100,12 +100,13 @@ export type IsobmffOutputFormatOptions = {
|
||||
* finalized. This produces a high-quality and compact output at the cost of a more expensive finalization step and
|
||||
* higher memory requirements. Data will be written monotonically (in order) when this option is set.
|
||||
*
|
||||
* Use `'fragmented'` to place metadata at the start of the file by creating a fragmented file. In a
|
||||
* Use `'fragmented'` to place metadata at the start of the file by creating a fragmented file (fMP4). In a
|
||||
* fragmented file, chunks of media and their metadata are written to the file in "fragments", eliminating the need
|
||||
* to put all metadata in one place. Fragmented files are useful for streaming, as they allow for better random
|
||||
* access. Furthermore, they remain lightweight to create even for very large files, as they don't require all media
|
||||
* to be kept in memory. However, fragmented files are not as widely and wholly supported as regular MP4/MOV files.
|
||||
* Data will be written monotonically (in order) when this option is set.
|
||||
* to put all metadata in one place. Fragmented files are useful for streaming contexts, as each fragment can be
|
||||
* played individually without requiring knowledge of the other fragments. Furthermore, they remain lightweight to
|
||||
* create even for very large files, as they don't require all media to be kept in memory. However, fragmented files
|
||||
* are not as widely and wholly supported as regular MP4/MOV files. Data will be written monotonically (in order)
|
||||
* when this option is set.
|
||||
*
|
||||
* When this field is not defined, either `false` or `'in-memory'` will be used, automatically determined based on
|
||||
* the type of output target used.
|
||||
@@ -503,7 +504,7 @@ export class Mp3OutputFormat extends OutputFormat {
|
||||
* WAVE-specific output options.
|
||||
* @public
|
||||
*/
|
||||
export type WaveOutputFormatOptions = {
|
||||
export type WavOutputFormatOptions = {
|
||||
/**
|
||||
* Will be called once the file header is written. The header consists of the RIFF header, the format chunk, and the
|
||||
* start of the data chunk (with a placeholder size of 0).
|
||||
@@ -515,11 +516,11 @@ export type WaveOutputFormatOptions = {
|
||||
* WAVE file format, based on RIFF.
|
||||
* @public
|
||||
*/
|
||||
export class WaveOutputFormat extends OutputFormat {
|
||||
export class WavOutputFormat extends OutputFormat {
|
||||
/** @internal */
|
||||
_options: WaveOutputFormatOptions;
|
||||
_options: WavOutputFormatOptions;
|
||||
|
||||
constructor(options: WaveOutputFormatOptions = {}) {
|
||||
constructor(options: WavOutputFormatOptions = {}) {
|
||||
if (!options || typeof options !== 'object') {
|
||||
throw new TypeError('options must be an object.');
|
||||
}
|
||||
|
||||
@@ -5,16 +5,16 @@ import { WaveFormat } from './wave-demuxer';
|
||||
import { RiffWriter } from './riff-writer';
|
||||
import { Writer } from '../writer';
|
||||
import { EncodedPacket } from '../packet';
|
||||
import { WaveOutputFormat } from '../output-format';
|
||||
import { WavOutputFormat } from '../output-format';
|
||||
|
||||
export class WaveMuxer extends Muxer {
|
||||
private format: WaveOutputFormat;
|
||||
private format: WavOutputFormat;
|
||||
private writer: Writer;
|
||||
private riffWriter: RiffWriter;
|
||||
private headerWritten = false;
|
||||
private dataSize = 0;
|
||||
|
||||
constructor(output: Output, format: WaveOutputFormat) {
|
||||
constructor(output: Output, format: WavOutputFormat) {
|
||||
super(output);
|
||||
|
||||
this.format = format;
|
||||
|
||||
Reference in New Issue
Block a user