Help - Search - Members - Calendar
Full Version: Live stream AAC+ from soundcard to server
Hydrogenaudio Forums > Lossy Audio Compression > AAC > AAC - Tech
emit
Hi all,

I'm trying to live stream an AAC+ (HE-AAC) stream from audio-in, through a compression program, up to a server, and out to the world. To do this, I'm stringing together the following applications on a single Ubuntu system (when it's deployed, icecast will probably be on a different machine):
  • arecord (grabs WAV stream from audio in)
  • neroAacEnc (encodes said WAV stream to AAC+)
  • ezstream (sends it to streaming server)
  • icecast (sends it to the world)

Here's how it works on the command line:

CODE
arecord -d 0 -f cd -t wav |\
/home/ubuntu/Desktop/nero/linux/neroAacEnc -cbr 48 -ignorelength -if - -of /dev/stdout | \
ezstream -c ~/Documents/ezstream/ezstream_stdin_aacplus.xml



I'm not married to any of these programs, so right off the bat, if I'm doing something insane here, and this would all be solved with program X, I'm quite open to suggestions. Has anyone done something like this before?

What's happening is that whenever I connect to it with VLC, I get a 404 not found error on the stream. Icecast's built-in web server shows nothing under the mount points either. Looking at Icecast's log file, it seems to assume that it's an OGG stream, and that there's something wrong with it. It sets up the mountpoint, then immediately takes it down again:

CODE
[2008-04-04  13:05:05] DBUG stats/modify_node_event update node clients (1)
[2008-04-04  13:05:05] DBUG stats/modify_node_event update node connections (2)
[2008-04-04  13:05:05] INFO connection/_handle_source_request Source logging in at mountpoint "/stream.aacp"
[2008-04-04  13:05:05] DBUG connection/connection_complete_source sources count is 0
[2008-04-04  13:05:05] DBUG source/source_apply_mount Applying mount information for "/stream.aacp"
[2008-04-04  13:05:05] DBUG source/source_update_settings public set to 0
[2008-04-04  13:05:05] DBUG source/source_update_settings max listeners to -1
[2008-04-04  13:05:05] DBUG source/source_update_settings queue size to 524288
[2008-04-04  13:05:05] DBUG source/source_update_settings burst size to 65535
[2008-04-04  13:05:05] DBUG source/source_update_settings source timeout to 10
[2008-04-04  13:05:05] DBUG source/source_update_settings fallback_when_full to 0
[2008-04-04  13:05:05] DBUG connection/connection_complete_source source is ready to start
[2008-04-04  13:05:05] DBUG fserve/fserve_add_client_callback Adding client to file serving engine
[2008-04-04  13:05:05] DBUG source/source_init Source creation complete
[2008-04-04  13:05:05] DBUG stats/modify_node_event update node sources (1)
[2008-04-04  13:05:05] DBUG stats/process_source_event new source stat /stream.aacp
[2008-04-04  13:05:05] DBUG stats/process_source_event new node public (0)
[2008-04-04  13:05:05] DBUG stats/process_source_event new node server_name (My Stream)
[2008-04-04  13:05:05] DBUG stats/process_source_event new node server_description (This is a stream description)
[2008-04-04  13:05:05] DBUG stats/process_source_event new node server_url (http://jurgen.ca/)
[2008-04-04  13:05:05] DBUG stats/process_source_event new node genre (RockNRoll)
[2008-04-04  13:05:05] DBUG stats/process_source_event new node server_type (application/ogg)
[2008-04-04  13:05:05] DBUG stats/process_source_event new node max_listeners (unlimited)
[2008-04-04  13:05:05] DBUG stats/process_source_event new node source_ip (127.0.0.1)
[2008-04-04  13:05:05] DBUG stats/process_source_event new node user_agent (libshout/2.2.2)
[2008-04-04  13:05:05] DBUG stats/modify_node_event update node source_client_connections (2)
[2008-04-04  13:05:05] DBUG stats/process_source_event new node listeners (0)
[2008-04-04  13:05:05] DBUG stats/process_source_event new node bitrate (96)
[2008-04-04  13:05:05] DBUG stats/process_source_event new node channels (2)
[2008-04-04  13:05:05] DBUG stats/process_source_event new node samplerate (44100)
[2008-04-04  13:05:05] DBUG stats/process_source_event new node quality (2.0)
[2008-04-04  13:05:05] DBUG stats/process_source_event new node audio_info (bitrate=96;channels=2;samplerate=44100;quality=2%2e0)
[2008-04-04  13:05:05] DBUG stats/process_source_event new node listenurl (http://localhost:8000/stream.aacp)
[2008-04-04  13:05:05] DBUG stats/modify_node_event update node source_total_connections (2)
[2008-04-04  13:05:05] DBUG stats/process_source_event new node slow_listeners (0)
[2008-04-04  13:05:05] DBUG stats/modify_node_event update node listeners (0)
[2008-04-04  13:05:05] DBUG stats/process_source_event new node listener_peak (0)
[2008-04-04  13:05:05] DBUG stats/process_source_event new node stream_start (Fri, 04 Apr 2008 13:05:05 +1100)
[2008-04-04  13:05:05] DBUG stats/process_source_event new node total_bytes_read (0)
[2008-04-04  13:05:05] DBUG stats/process_source_event new node total_bytes_sent (0)
[2008-04-04  13:05:07] DBUG auth/add_client_to_source max on /stream.aacp is -1 (cur 0)
[2008-04-04  13:05:07] DBUG auth/add_client_to_source Added client to /stream.aacp
[2008-04-04  13:05:07] DBUG auth/add_authenticated_client client authenticated, passed to source
[2008-04-04  13:05:07] DBUG source/source_main Client added
[2008-04-04  13:05:07] INFO source/source_main listener count on /stream.aacp now 1
[2008-04-04  13:05:07] DBUG stats/modify_node_event update node clients (2)
[2008-04-04  13:05:07] DBUG stats/modify_node_event update node connections (3)
[2008-04-04  13:05:07] DBUG stats/modify_node_event update node client_connections (1)
[2008-04-04  13:05:07] DBUG stats/modify_node_event update node listener_connections (1)
[2008-04-04  13:05:07] DBUG stats/modify_node_event update node listener_peak (1)
[2008-04-04  13:05:07] DBUG stats/modify_node_event update node listeners (1)
[2008-04-04  13:05:07] DBUG format/format_check_http_buffer processing pending client headers
[2008-04-04  13:05:10] DBUG stats/modify_node_event update node total_bytes_read (0)
[2008-04-04  13:05:10] DBUG stats/modify_node_event update node total_bytes_sent (279)
[2008-04-04  13:05:15] DBUG stats/modify_node_event update node total_bytes_read (0)
[2008-04-04  13:05:15] DBUG stats/modify_node_event update node total_bytes_sent (279)
[2008-04-04  13:05:16] DBUG source/get_next_buffer last 1207274705, timeout 10, now 1207274716
[2008-04-04  13:05:16] WARN source/get_next_buffer Disconnecting source due to socket timeout
[2008-04-04  13:05:16] INFO source/source_shutdown Source "/stream.aacp" exiting
[2008-04-04  13:05:16] DBUG source/source_clear_source clearing source "/stream.aacp"
[2008-04-04  13:05:16] DBUG format-ogg/format_ogg_free_headers releasing header pages
[2008-04-04  13:05:16] DBUG format-ogg/free_ogg_codecs freeing codecs
[2008-04-04  13:05:16] DBUG source/source_free_source freeing source "/stream.aacp"
[2008-04-04  13:05:16] INFO fserve/fserve_client_create checking for file /stream.aacp (/usr/share/icecast2/web/stream.aacp)
[2008-04-04  13:05:16] WARN fserve/fserve_client_create req for file "/usr/share/icecast2/web/stream.aacp" No such file or directory
[2008-04-04  13:05:16] DBUG fserve/fserve_add_client Adding client to file serving engine
[2008-04-04  13:05:16] DBUG stats/process_source_event delete source node /stream.aacp
[2008-04-04  13:05:16] DBUG stats/modify_node_event update node clients (1)
[2008-04-04  13:05:16] DBUG stats/modify_node_event update node clients (0)
[2008-04-04  13:05:16] DBUG stats/modify_node_event update node sources (0)
[2008-04-04  13:05:16] DBUG stats/modify_node_event update node clients (1)
[2008-04-04  13:05:16] DBUG stats/modify_node_event update node connections (4)
[2008-04-04  13:05:16] DBUG stats/modify_node_event update node client_connections (2)
[2008-04-04  13:05:16] DBUG stats/modify_node_event update node clients (0)


Is this toolchain even compatible with HE-AAC streams? I know Nero is, which is why I'm using it, but I have my doubts about ezstream and icecast.

Can anyone help me shed some light on this please? I can post config files galore, but I don't want to make this post too big.

Many thanks.
[JAZ]
From your log:

[2008-04-04 13:05:05] DBUG stats/process_source_event new node server_type (application/ogg)

From the information here
http://www.icecast.org/docs/icecast-2.3.1/...onfig_file.html

it seems you have to modify the tag <type>application/ogg</type>
inside <mount>
pcmaniac
based on the writing at http://icecast.imux.net/viewtopic.php?p=12481
ezstream uses libshout to send the audio data to the server..
and libshout doesn't know how to time aac+ streams correctly, so it sends them to icecast as fast as it gets the compressed stream.. instead of real-time..

so we can only hope someone adds aac+ support to libshout
emit
QUOTE(pcmaniac @ Apr 6 2008, 03:53) *

based on the writing at http://icecast.imux.net/viewtopic.php?p=12481
ezstream uses libshout to send the audio data to the server..
and libshout doesn't know how to time aac+ streams correctly, so it sends them to icecast as fast as it gets the compressed stream.. instead of real-time..


But since it's a live stream, going through this chain in real-time, wouldn't it be real-time already anyway?

QUOTE
' date='Apr 5 2008, 04:01' post='557010']
From your log:
[2008-04-04 13:05:05] DBUG stats/process_source_event new node server_type (application/ogg)


Yeah I noticed that too, but had no idea how to tell it that it wasn't an ogg stream.


QUOTE
' date='Apr 5 2008, 04:01' post='557010']
it seems you have to modify the tag <type>application/ogg</type>
inside <mount>


I don't have a <mount> for this, it's an instant-on thing (I forget ice's terminology for that). I'll make a <mount> though, add that <type> and see how we go.
emit
QUOTE(emit @ Apr 6 2008, 09:33) *

I'll make a <mount> though, add that <type> and see how we go.


No luck. A different set of errors though, it looks like it's happy with the settings, at least for the first few seconds.

CODE

[2008-04-07  15:09:05] INFO connection/_handle_source_request Source logging in at mountpoint "/stream.aacp"
[2008-04-07  15:09:05] DBUG connection/connection_complete_source sources count is 0
[2008-04-07  15:09:05] DBUG source/source_apply_mount Applying mount information for "/stream.aacp"
[2008-04-07  15:09:05] DBUG source/source_update_settings public set to 0
[2008-04-07  15:09:05] DBUG source/source_update_settings max listeners to 99999
[2008-04-07  15:09:05] DBUG source/source_update_settings queue size to 524288
[2008-04-07  15:09:05] DBUG source/source_update_settings burst size to 65535
[2008-04-07  15:09:05] DBUG source/source_update_settings source timeout to 10
[2008-04-07  15:09:05] DBUG source/source_update_settings fallback_when_full to 0
[2008-04-07  15:09:05] DBUG connection/connection_complete_source source is ready to start
[2008-04-07  15:09:05] DBUG fserve/fserve_add_client_callback Adding client to file serving engine
[2008-04-07  15:09:05] DBUG source/source_init Source creation complete
[2008-04-07  15:09:06] DBUG stats/modify_node_event update node clients (1)
[2008-04-07  15:09:06] DBUG stats/modify_node_event update node connections (2)
[2008-04-07  15:09:06] DBUG stats/modify_node_event update node sources (1)
[2008-04-07  15:09:06] DBUG stats/process_source_event new source stat /stream.aacp
[2008-04-07  15:09:06] DBUG stats/process_source_event new node public (0)
[2008-04-07  15:09:06] DBUG stats/process_source_event new node server_name (My Stream)
[2008-04-07  15:09:06] DBUG stats/process_source_event new node server_description (This is a stream description)
[2008-04-07  15:09:06] DBUG stats/process_source_event new node server_url (http://jurgen.ca/)
[2008-04-07  15:09:06] DBUG stats/process_source_event new node genre (RockNRoll)
[2008-04-07  15:09:06] DBUG stats/process_source_event new node server_type (audio/aacp)
[2008-04-07  15:09:06] DBUG stats/process_source_event new node max_listeners (99999)
[2008-04-07  15:09:06] DBUG stats/process_source_event new node source_ip (127.0.0.1)
[2008-04-07  15:09:06] DBUG stats/process_source_event new node user_agent (libshout/2.2.2)
[2008-04-07  15:09:06] DBUG stats/modify_node_event update node source_client_connections (2)
[2008-04-07  15:09:06] DBUG stats/process_source_event new node listeners (0)
[2008-04-07  15:09:06] DBUG stats/process_source_event new node bitrate (96)
[2008-04-07  15:09:06] DBUG stats/process_source_event new node channels (2)
[2008-04-07  15:09:06] DBUG stats/process_source_event new node samplerate (44100)
[2008-04-07  15:09:06] DBUG stats/process_source_event new node quality (2.0)
[2008-04-07  15:09:06] DBUG stats/process_source_event new node audio_info (bitrate=96;channels=2;samplerate=44100;quality=2%2e0)
[2008-04-07  15:09:06] DBUG stats/process_source_event new node listenurl (http://localhost:8000/stream.aacp)
[2008-04-07  15:09:06] DBUG stats/modify_node_event update node source_total_connections (2)
[2008-04-07  15:09:06] DBUG stats/process_source_event new node slow_listeners (0)
[2008-04-07  15:09:06] DBUG stats/modify_node_event update node listeners (0)
[2008-04-07  15:09:06] DBUG stats/process_source_event new node listener_peak (0)
[2008-04-07  15:09:06] DBUG stats/process_source_event new node stream_start (Mon, 07 Apr 2008 15:09:05 +1000)
[2008-04-07  15:09:06] DBUG stats/process_source_event new node total_bytes_read (0)
[2008-04-07  15:09:06] DBUG stats/process_source_event new node total_bytes_sent (0)
[2008-04-07  15:09:10] DBUG stats/modify_node_event update node total_bytes_read (0)
[2008-04-07  15:09:10] DBUG stats/modify_node_event update node total_bytes_sent (0)
[2008-04-07  15:09:15] DBUG stats/modify_node_event update node total_bytes_read (0)
[2008-04-07  15:09:15] DBUG stats/modify_node_event update node total_bytes_sent (0)
[2008-04-07  15:09:16] DBUG source/get_next_buffer last 1207544945, timeout 10, now 1207544956
[2008-04-07  15:09:16] WARN source/get_next_buffer Disconnecting source due to socket timeout
[2008-04-07  15:09:16] INFO source/source_shutdown Source "/stream.aacp" exiting
[2008-04-07  15:09:16] DBUG source/source_clear_source clearing source "/stream.aacp"
[2008-04-07  15:09:16] DBUG format-ogg/format_ogg_free_headers releasing header pages
[2008-04-07  15:09:16] DBUG format-ogg/free_ogg_codecs freeing codecs
[2008-04-07  15:09:16] DBUG source/source_free_source freeing source "/stream.aacp"
[2008-04-07  15:09:16] DBUG stats/process_source_event delete source node /stream.aacp
[2008-04-07  15:09:16] DBUG stats/modify_node_event update node clients (0)
[2008-04-07  15:09:16] DBUG stats/modify_node_event update node sources (0)
[2008-04-07  15:10:27] DBUG slave/_slave_thread checking master stream list


Notice that there's a pause between :06 and :10. If I'm quick enough with VLC and connect during that time, I don't get a 404, rather it says it's pre-buffering ... then it gets disconnected. It auto-reconnects at that time, and ends up with a 404.
emit
(sigh)

For closure, I'll detail the less-than-ideal solution I've ended up with:

A Windows XP machine, running Winamp + Oddcast. Took all of 10 minutes to set up and get running through a brand-new, out-of-the-box icecast server. Five of those minutes was figuring out why my new icecast installation wouldn't start (permissions on /var/log/icecast/ weren't set correctly).

I'd much rather a Linux solution for this, but the current state of the tools don't seem to allow AAC+ live streaming on that platform. While I can string bits together, I'm no programmer, so I can't fix this.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.