Date: Sat, 1 Jan 2000 11:13:02 -0800 From: Tim Pozar <pozar@lns.com> To: freebsd-multimedia@FreeBSD.ORG Subject: mixice.pl Message-ID: <20000101111302.D82634@lns.com> In-Reply-To: <20000101190507.91CDA150AC@hub.freebsd.org>; from Majordomo@FreeBSD.ORG on Sat, Jan 01, 2000 at 11:05:07AM -0800 References: <20000101190507.91CDA150AC@hub.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Again... this may be a dupe... Woops and the previous message shoul have a subject line that covers Libretto sound configs. Sheesh. Too much grape juice. --- Perhaps it should be called esdice.pl... I wrote a quick and dirty perl script that will do live Icecast streaming as liveice just doesn't cut it on my FreeBSD box. This script is currently in use for KFCF-FM in Fresno and you can check out the stream at http://www.wps.com:8000 . The script requires the Enlightenment Sound package. I am only using esdrec and not esd. I needed something to set the bit rate of /dev/dsp and stream the PCM to stdout where LAME will process it. Please note the "-x" arg for LAME. It really needs the bytes swapped or you will just hear noise. The script is doing the shoutcast compatible ICY login and not the "new" ICECAST "x-audiocast" login. One other requirement is the Net::Telenet module from CPAN. Yes, I could have used a lower layer of Net:: but this was a quick and dirty hack and it works. Suggestions welcomed, flames devnulled. Tim --- mixice.pl --- #!/usr/bin/perl ##################################################################### # mixice.pl # # Copyright 1999 Timothy Pozar # # You can use this script for anything you wish in any manner. # ##################################################################### use Net::Telnet (); ##################################################################### # Server to send to... $hostname = "foo.com"; $port = 8001; $password = "changeme"; ##################################################################### # Description of stream... $name = "A live audio stream"; $genre = "various"; $url = "http://www.icecast.org"; ##################################################################### # Audio... $ksamplerate = 22.05; # Sample rate in KHz; $samplerate = $ksamplerate * 1000; # Sample rate in Hz; $bitrate = 32; # Bit rate in Kb/s; # Open the connection... $relay = new Net::Telnet( -host => $hostname, -port => $port, -output_record_separator => '', -binmode => 1, -telnetmode => 0); # Send a line... $relay->print("$password\r\n"); # See if there is an OK... $line = $relay->getline; print "1: $line"; die $line unless $line =~ /^OK/; $relay->print("icy-name:$name\r\n"); $relay->print("icy-br:$bitrate\r\n"); $relay->print("icy-genre:$genre\r\n"); $relay->print("icy-url:$url\r\n"); $relay->print("icy-pub:1\r\n"); # 1 = public $relay->print("\r\n"); # Start the stream here... open(STREAM, "esdrec -r $samplerate -m | lame -s $ksamplerate -p -S -m m -b $bitrate -x -r - |"); while(1){ if(read(STREAM, $buffer, 512) > 0){ $relay->print("$buffer"); } else { print "End of MPG stream.\n"; exit; } } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-multimedia" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000101111302.D82634>
