From owner-freebsd-multimedia Sat Jan 1 11:12:30 2000 Delivered-To: freebsd-multimedia@freebsd.org Received: from kumr.lns.com (kumr.lns.com [140.174.7.1]) by hub.freebsd.org (Postfix) with ESMTP id D9FE014D52 for ; Sat, 1 Jan 2000 11:12:27 -0800 (PST) (envelope-from pozar@kumr.lns.com) Received: (from pozar@localhost) by kumr.lns.com (8.9.3/8.9.3) id LAA96979 for freebsd-multimedia@FreeBSD.ORG; Sat, 1 Jan 2000 11:13:02 -0800 (PST) (envelope-from pozar) Date: Sat, 1 Jan 2000 11:13:02 -0800 From: Tim Pozar To: freebsd-multimedia@FreeBSD.ORG Subject: mixice.pl Message-ID: <20000101111302.D82634@lns.com> References: <20000101190507.91CDA150AC@hub.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <20000101190507.91CDA150AC@hub.freebsd.org>; from Majordomo@FreeBSD.ORG on Sat, Jan 01, 2000 at 11:05:07AM -0800 Sender: owner-freebsd-multimedia@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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