yutotakano / discord-haskell-voice

A Haskell library to add voice support to discord-haskell.
https://hackage.haskell.org/package/discord-haskell-voice
MIT License
9 stars 3 forks source link

Explore direct OPUS streaming from youtube-dl #8

Open yutotakano opened 2 years ago

yutotakano commented 2 years ago

Many audio sources on YouTube are already in OPUS format. The current code decodes that to PCM regardless of the original format, then reencodes to OPUS.

Pros of current format;

Cons of current format:

Perhaps, in the non-processing variants, we should add another logic to check the original format and stream as-is if it's provided as OPUS. This might complicate the reuse of functions like it is now.

yutotakano commented 2 years ago

This is being done with V2.4.0, however the OPUS format that FFmpeg or youtube-dl gives is within an OGG container, and requires code to parse and unwrap, ala https://github.com/Rapptz/discord.py/blob/1be36c9c3ede72eaa2262dfa0e62cbd8b8929e66/discord/oggparse.py#L50