ogg vorbis streaming and WinAmp

General discussion about netjukebox
Superlexx
User
Posts: 45
Joined: Thu Feb 10, 2005 8:51 pm

ogg vorbis streaming and WinAmp

Post by Superlexx »

Hello,

I've transcoded parts of my music library to ogg vorbis at about 64kb/s,
but streaming those files with WinAmp (v5.08) fails, "error synching to mpeg". When adding a link to the .ogg directly (the .ogg files are publically accessible ATM), WinAmp plays it. Also foobar2000 plays the same playlist without a problem where WinAmp fails.

The settings in config.inc.php are:

Code: Select all

$cfg['stream_extension']            = 'ogg';
$cfg['stream_header']               = 'Content-Type: application/ogg';
$cfg['stream_encode']               = 'D:\oggenc.exe --raw --downmix --quality 0 - -';
$cfg['stream_transcode']            = 'D:\oggdec.exe --quiet %source --output - | D:\oggenc.exe --quality 0 --raw --title %title --artist %artist --album %album -';
$cfg['stream_transcode_treshold']   = 130000;
, so the .ogg files are not transcoded prior to serving.

mp3 streaming works without a problem. Any idea what's wrong with WinAmp?

HTTP headers:
direct link:

Code: Select all

GET /music/Anastacia/Anastacia/06%20-%20I%20Do.ogg HTTP/1.1
Host: myhostname
User-Agent:Winamp
Accept:*/*


HTTP/1.1 200 OK
Date: Wed, 16 Feb 2005 10:51:02 GMT
Server: Apache/2.0.52 (Win32) PHP/4.3.10
Last-Modified: Thu, 03 Feb 2005 16:02:48 GMT
ETag: "78c4-155217-7f52bb20"
Accept-Ranges: bytes
Content-Length: 1397271
Content-Type: application/ogg
streaming:

Code: Select all

GET /netjukebox3.66/stream.php?command=stream&track_id=bfuo3c44u5_470a353e&username=Lex&expire=1108554291&hash=1b47d335e8e93b7482d73a16c39a3d3b770be8eb HTTP/1.0
Host: myhostname
User-Agent: WinampMPEG/5.0
Accept: */*
Icy-MetaData:1
Connection: close


HTTP/1.1 200 OK
Date: Wed, 16 Feb 2005 11:32:52 GMT
Server: Apache/2.0.52 (Win32) PHP/4.3.10
X-Powered-By: PHP/4.3.10
icy-notice2: netjukebox (expires: Wed, 16 Feb 2005 12:44:51 +0100)<BR>
icy-name: I Do
Content-Disposition: inline; filename=Anastacia - I Do
Content-Length: 1397271
Accept-Ranges: bytes
Connection: close
Content-Type: application/ogg
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

I think the biggest problem with Winamp is, that it only relies on the file extension and doesn't use the header information.
For unknown extensions it uses the default Nullsoft MPEG decoder.
You get the "error synching to mpeg" error because Winamp tries to play ogg files with the default MPEG decoder.

Maybe it is possible to trick Winamp with something like this in the playlist:

Code: Select all

http://yourserver.com/netjukebox/stream.php?command=stream&….&extension=.ogg
Another thing you could try is to rename stream.php to stream.ogg and configure ogg as php on your webserver.

Good luck with it, and I'm very curious if one of my suggestions works :wink:
Superlexx
User
Posts: 45
Joined: Thu Feb 10, 2005 8:51 pm

Post by Superlexx »

lol

Code: Select all

stream.php?...&ext=.ogg
did the trick.
Winamp - it really whips the llamas ass :roll:
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

Thanks, I add this to the next version:

Code: Select all

....$hash . '&ext=.' . $cfg['stream_extension'] . "\r\n";
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

This is cool :) :)
OGG streaming below threshold works perfect.
The next step is to get stranscoding working.
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

This is working, but it sounded strange no constant speed.

Code: Select all

$cfg['stream_encode'] = 'D:\Console\Codec\oggenc.exe --quiet --quality 1 --title %title --artist %artist --album %album --output=- -';
Superlexx
User
Posts: 45
Joined: Thu Feb 10, 2005 8:51 pm

Post by Superlexx »

Maybe it's because our boxes lack CPU power, I have a 1.5GHz AthlonXP and oggenc is keeping it 100% busy.
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

Superlexx wrote:Maybe it's because our boxes lack CPU power, I have a 1.5GHz AthlonXP and oggenc is keeping it 100% busy.
Yes, that would be the problem, my server is just 900MHz Celron.
Maybe an optimized compile for your 1.5GHz AthlonXP could do the trick:
http://www.hydrogenaudio.org/forums/ind ... opic=15049
Superlexx
User
Posts: 45
Joined: Thu Feb 10, 2005 8:51 pm

Post by Superlexx »

Damn WinAmp, with foobar I get no sound problems while transcoding from mp3 to vorbis. I've done a test, the original transcoder gave me 2.66x speed and the optimized one did 5.25x (a 3:09 song was transcoded in 36 seconds), which should be enough for every PC > 500MHz.

I don't know if there is a setting somewhere in WinAmp that we have to change so it works with live transcoded streams. Maybe the fb2k dev shouldn't have left nullsoft :cry: .

EDIT: btw, a TODO: add more track info to the DB (channels, sample rate and bits per sample), because this info is needed for transcoding (I have some files that are not stereo+44100Hz+16bit and they aren't transcoded correctly).
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

Superlexx wrote:Damn WinAmp, with foobar I get no sound problems while transcoding from mp3 to vorbis. I've done a test, the original transcoder gave me 2.66x speed and the optimized one did 5.25x (a 3:09 song was transcoded in 36 seconds), which should be enough for every PC > 500MHz.

I don't know if there is a setting somewhere in WinAmp that we have to change so it works with live transcoded streams. Maybe the fb2k dev shouldn't have left nullsoft :cry: .
I have exactly the same problem.
- Transcoding to OGG works only good with Foobar.
- Without transcoding, Winamp & Foobar working without any problem.
Superlexx wrote:EDIT: btw, a TODO: add more track info to the DB (channels, sample rate and bits per sample), because this info is needed for transcoding (I have some files that are not stereo+44100Hz+16bit and they aren't transcoded correctly).
I will add channels, sample rate and bits per sample to the database in the next version.
I will also implement it to the "confg.inc.php" and "stream.php" file.
Than stream should also work from other bitrates.

I will also test if transcoding for example:

Code: Select all

lame.exe DECODE %source - | lame.exe ENCODE - -
Is any slower than:

Code: Select all

lame.exe TRANSCODE %source -
If it doesn't take any more processor utilization than transcoding can be removed from the "config.inc.php" and "stream.php" file.
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

wbartels wrote: I will also test if transcoding for example:

Code: Select all

lame.exe DECODE %source - | lame.exe ENCODE - -
Is any slower than:

Code: Select all

lame.exe TRANSCODE %source -
If it doesn't take any more processor utilization than transcoding can be removed from the "config.inc.php" and "stream.php" file.
Processor utilization is the same.
So I will simplify "config.inc.php" and "stream.php".
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

Superlexx wrote:EDIT: btw, a TODO: add more track info to the DB (channels, sample rate and bits per sample), because this info is needed for transcoding (I have some files that are not stereo+44100Hz+16bit and they aren't transcoded correctly).
This is working now :D
I also add this to download information.
Will be available on the next release.
Superlexx
User
Posts: 45
Joined: Thu Feb 10, 2005 8:51 pm

Post by Superlexx »

hm, I had to re-install windows, and now I am running IIS5.1 instead of Apache (had to use IIS anyway because of Phalanger), and both WinAmp and fb2k play the vorbis stream flawlessly. The drawback is that transcoding does not stop before the whole file is done, even if I press "stop" on the media player, any idea what might cause this?
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

Superlexx wrote:hm, I had to re-install windows, and now I am running IIS5.1 instead of Apache (had to use IIS anyway because of Phalanger), and both WinAmp and fb2k play the vorbis stream flawlessly. The drawback is that transcoding does not stop before the whole file is done, even if I press "stop" on the media player, any idea what might cause this?
You can try this in stream.php:

Code: Select all

$pointer = popen($cmd, 'rb');
fpassthru($pointer);
pclose($pointer);
Instead of:

Code: Select all

@passthru($cmd);
Or maybe some code from kplaylist will help.
You have to rewrite it a little to work with netjukebox.
Cut and past from kplaylist:

Code: Select all

$descriptorspec = array(
						0 => array('pipe', 'r'),
						1 => array('pipe', 'w'));

					$process = proc_open(getlame($lamebitrates[db_guinfo('lamerate')], $f2->fullpath), $descriptorspec, $pipes);
					if (is_resource($process))
					{
						while (!feof($pipes[1]) && !connection_aborted()) echo fgets($pipes[1], 1024);
						fclose($pipes[0]);
						fclose($pipes[1]);
						proc_close($process);
					}
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

Superlexx wrote:even if I press "stop" on the media player,
Do you mean Windows media player?

Bacause Windows media player buffers the whole stream,
Winamp and foobar buffer a small part and therefore trolley the stream.
Post Reply