Skip to content

Instantly share code, notes, and snippets.

@AndyA
Created May 15, 2013 22:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndyA/5587779 to your computer and use it in GitHub Desktop.
Save AndyA/5587779 to your computer and use it in GitHub Desktop.
AAC streaming via Icecast
#!/usr/bin/env perl
use strict;
use warnings;
use Net::Icecast::Source;
my $source = Net::Icecast::Source->new(
username => 'source',
password => 'secret',
server => 'igloo.fenkle',
port => '8000',
mount_point => '/live.aac',
mime_type => 'audio/aac',
meta => {
name => 'Radio 5live Test',
description => '',
url => 'http://icecast.org',
},
);
# attempt to connect to the streaming server
$source->connect
or die "Unable to connect to server: $!\n";
# attempt to log in to the specified mountpoint
$source->login
or die "Incorrect username/password\n";
open my $sample, '-|', 'ffmpeg',
-f => 'alsa',
-i => 'hw:1,0',
-acodec => 'libfaac',
-f => 'adts',
'-'
or die "Can't run ffmpeg: $!\n";
$source->stream_fh($sample);
close $sample;
$source->disconnect
# vim:ts=2:sw=2:sts=2:et:ft=perl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment