[Icecast] html5/js source client?

Romain Beauxis toots at rastageeks.org
Tue May 6 07:06:32 PDT 2014


Hi,

2014-05-05 18:01 GMT-05:00 Brad Isbell <brad at musatcha.com>:
> Thanks everyone!  I will answer your questions regarding the AudioPump Web
> Encoder (http://demo.audiopump.co:3000/):
>
>> Can you please explain the process exactly? what is the encoding server?
>
> There is a server built on Node.js that receives audio data, control data,
> and metadata from the client over a binary websocket.  All of these are
> multiplexed down the same connection.  When the server receives audio data,
> it will pass it off to an external encoder via STDIO.  For testing purposes,
> I am using FFmpeg, but you can use anything you want.  All that matters is
> that it accepts PCM and outputs something that I can send to the streaming
> server.
>
>> is your code production-ready?
>
> It is close.  The code works well for the users that are using it in
> production today, but I would certainly like to test with more users and
> browsers.  One challenge are browser bugs that I can't do much about.  For
> instance, the VU metering doesn't work in stereo on Firefox because the
> Firefox splitter node is broken.  Some folks have used this software to do
> live remotes on both mobile and desktop with success.  Most of the issues I
> have seen have been already patched in development versions of the browsers,
> so it is just a matter of time before they are handled in the releases.
>
>> can it work with Icecast?
>
> Yes, you can use SHOUTcast mode with Icecast currently.  Due to requests
> from the community, I will implement HTTP PUT support to add compatibility
> with Icecast 2.4.  This shouldn't be too hard to finish... it's a feature I
> had been planning for.  I will e-mail the list again when this functionality
> is enabled (or if that is considered spam, let me know and I will only
> e-mail those that replied to me).
>
>> Out of curiosity, what are you using as the intermediate codec?
>
> Only PCM is possible today, with the Web Audio API.  Even if the browser
> supports the codec, it is only accessible with WebRTC calls.  I originally
> went down the path of a server-side WebRTC client.  This proved to be a
> nightmare and not really feasible at the moment.  One guy seems to have
> gotten it working over a year ago by importing a huge chunk of Chromium
> (libjingle and all that), but that code doesn't seem to work anymore due to
> the internal structure of Chromium changing dramatically.  Running the
> binaries he built result in segfault.  If anyone knows of a way to record
> WebRTC server-side, please let me know.  I'm sure this will be possible in
> the near future, but for now it's too difficult (at least for me).  In the
> mean time, I am sticking with PCM.  I convert the 32-bit floating point
> samples from the Web Audio API into 16-bit or 8-bit samples, and then
> convert them back up server-side.  The intent is to adjust for bandwidth
> conditions on the fly, but for now I just let the user pick the desired bit
> depth.  Since the server converts it back up to 32-bit before sending to the
> encoder, you can change bit-depth on the fly mid-stream.  In the future, I
> hope to add some client-side codec (at least FLAC).  I also need to be
> cautious of licensing, if I am going to include a codec via JavaScript.  If
> there is a silver lining, it's that you only compress once with this method,
> giving you better quality audio than re-compressing something that was
> already encoded lossy.
>
>>  will it be open source or is this a commercial solution?
>
> Commercial.  I am developing software to help improve internet radio, and
> have just started AudioPump, Inc. to help with that goal.  If at some point
> I can make other products more profitable, I would love to open source some
> of my work.  But, that is not something I can do at the moment.  If you have
> interest in using this or part of it commercially, please contact me at
> brad at audiopump.co.  with information on your project and we can chat about
> it.
>
>> Wow! That screams for integration with Icecast2 web admin panel if
>> opensourced!!
>
> Thanks for the note, but even if open sourced, I don't think it would be a
> good candidate for integration due to its reliance on Node.js.  Icecast
> developers could certainly develop something similar, however.  If I were a
> C++ developer, I would definitely consider contributing.  If any Icecast
> developers have questions about the implementation, I am happy to help with
> any information I can provide.

Thanks for these information. For the webcast.js project, we chose to
implement a client-side mp3 encoding, using emscripten and the shine
mp3 encoder. This works fine on firefox where asm.js is supported but
is borderline real time on chrome.. See:
https://github.com/webcast/webcast.js/blob/master/API.md and
https://github.com/savonet/shine/tree/master/js

A convenient client-side native Javascript API for encoding audio
would be much desirable but, unfortunately, there was nothing mature
and/or usable last time I checked..

Romain


More information about the Icecast mailing list