Skip to content

Add Transcoder #1

Open
Open
@twlite

Description

@twlite

Since this library was created for discord-player, the API should be similar to its current transcoder, which is a node.js stream. It works by taking raw stream, piping it to transcoder and receive the desired output.

My current idea is to implement something similar to the following:

import { probeStream, CodecType, Transcoder } from 'mediaplex'

const stream = getInputStream();
const probeResult = await probeStream(stream);

if (!probeResult.result) return; // unsupported stream

const transcoder = new Transcoder({
    format: CodecType.OPUS, // the output format
    sampleRate: 48000, // output sample rate
    channels: 2, // the number of channels
    ... // other options
}); // Transcoder extends Transform stream

const output = stream.pipe(transcoder); // output shall be Opus stream, as specified in format

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions