Created
May 15, 2013 22:02
-
-
Save AndyA/5587779 to your computer and use it in GitHub Desktop.
AAC streaming via Icecast
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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