add ability to encode and stream audio as like as video
Closed this issue · 5 comments
Is your feature request related to a problem? Please describe.
Currently, the project supports video encoding and streaming seamlessly, but it lacks the ability to handle audio in the same way. This creates a limitation for scenarios where both audio and video streaming are required or when audio-only streaming is needed. It feels inconsistent and limits use cases like podcast streaming, live audio feeds, or integrated A/V content delivery.
Describe the solution you'd like
I would like to see support added for audio encoding and streaming, similar to the current video streaming functionality. This feature could include:
- Support for common audio codecs (e.g., AAC, MP3, Opus).
- Seamless integration with the existing streaming pipeline.
- Support for standalone audio streaming.
Additional context
Adding audio streaming capability would make the project more versatile and applicable to a broader range of applications, such as live broadcasting, online education, and multimedia content platforms.
While I initially never thought about audio only input, the transcode job isn't too opinionated about which output stream types are mandatory. You may provide an mp3 file as source and it'll feed that to ffmpeg under the hood, just as if it was video. I gave this a quick test run. Let me know if my test below is representative for your use case.
{
"inputs": [
{
"type": "s3://input_audio.mp3",
"path": "audio",
"language": "eng"
}
],
"streams": [
{
"type": "audio",
"codec": "aac",
"language": "eng"
}
]
}
The API request above does not include any reference to a video file, that transcodes just fine. When I then ran a package job manually, it produced the following m3u8:
#EXTM3U
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-MEDIA:TYPE=AUDIO,URI="audio_eng_128000_aac/playlist.m3u8",GROUP-ID="audio_aac",LANGUAGE="en",NAME="eng_aac",DEFAULT=NO,AUTOSELECT=YES,CHANNELS="2"
#EXT-X-STREAM-INF:BANDWIDTH=136989,AVERAGE-BANDWIDTH=134681,CODECS="mp4a.40.2",AUDIO="audio_aac",CLOSED-CAPTIONS=NONE
audio_eng_128000_aac/playlist.m3u8
This'll work just fine, however there's no audio codec stream support for opus
but that shouldn't be too hard to add. Am I right in saying that when there is support for opus, it'll check all your requirements? Although I might need to fine-tune the packager to drop the separate EXT-X-MEDIA
tag as it's redundant.
I hope it's not too much to ask but if you're willing to contribute opus support in order to speed things up, I'd be happy to help where I can.
I just fix transcoder to accept all audio formats and create pull request
I'm not sure what you're trying to accomplish or what your PR would even do.
- Removing the output format can lead to non mp4 output depending on the input format (as that's what ffmpeg will use to derive the output from).
- Your defaults will never trigger, each ffmpeg job is given a Stream which contains either input, derived or default values already.
Mind elaborating a bit what you're trying to do? Superstreamer does support audio only input / output given the example I posted above.
yes you are right I test it again and Opus format was okey
I close pull request
Yay 🎉
Opus as input is there, opus as output isn't (as you can see here: https://github.com/superstreamerapp/superstreamer/blob/main/packages/bolt/src/types.ts#L1).
If you want to add support for Opus as output in a stream, let me know or provide a PR and I'd be happy to assist.