CastInit with BASS_ENCODE_TYPE_OGG gives Error -1

Started by Couin,

Couin

Hi (Ian) :)

I spent few hours to try to stream in OGG format, with BASSenc 2.4.17 and BASSenc_OGG 2.4.3 .
Test server is IceCast on a Windows XP Virtual Machine.

My (reduced, for the forum) code:
Caster = BASS_Encode_OGG_Start(recording, "-b 128", BASS_ENCODE_NOHEAD Or BASS_ENCODE_AUTOFREE, 0, 0)
Call BASS_Encode_CastInit(Caster, "192.168.0.45:8000/stream", "hackme", BASS_ENCODE_TYPE_OGG, Name, url, genre, desc, "", 128, 0)

I get a -1 error.

After a lot of searching, I found this message, where
QuoteBASS_ENCODE_TYPE_OGG = "application/ogg"

In the bassenc files (for c, delphi, vb), I find
QuoteBASS_ENCODE_TYPE_OGG = "audio/ogg"

If I replace audio for application, I have no longer error and I can stream. It's also OK with an IceCast server (part of AzuraCast) on a VPS.

Is it a wrong entry in bassenc or missed I something in my code?

Thanks :)

Ian @ un4seen

I think either "audio/ogg" or "application/ogg" should work. What Icecast version are you using? I believe the "application/ogg" MIME type was introduced before "audio/ogg" was, so perhaps it's a very old version from before "audio/ogg" was introduced? I checked that "audio/ogg" is working with Icecast 2.4.4 and 2.5.0.

Note that when using OGG formats, you should start either the recording or encoding in a paused state (ie. use BASS_RECORD_PAUSE or BASS_ENCODE_PAUSE) before connecting to the Icecast server, to make sure the server doesn't miss any of the encoder output. For example:

Caster = BASS_Encode_OGG_Start(recording, "-b 128", BASS_ENCODE_AUTOFREE Or BASS_ENCODE_PAUSE, 0, 0)
Call BASS_Encode_CastInit(Caster, "192.168.0.45:8000/stream", "hackme", BASS_ENCODE_TYPE_OGG, Name, url, genre, desc, "", 128, 0)
Call BASS_Encode_SetPaused(Caster, BASSFALSE)

Couin

Hi Ian,
Thanks for answer  ;)
You are right, after testing with several versions, audio/ogg has been introduced in v2.2.0 .
I made some code changes so I try with BASS_ENCODE_TYPE_OGG (so "audio/ogg") fisrt, and if error -1, try again with "application/ogg".

Also, are BASS_ENCODE_PAUSE and BASS_Encode_SetPaused false recommended or required for MP3?
Is BASS_ENCODE_NOHEAD recommended/required for MP3 (and OGG)? I don't see exactly what this should do, the online help description of this flag looks confusous for me.

Thanks :D

Chris

BASS_ENCODE_NOHEAD will mean that the sample format must be passed to the encoder some other way, eg. via the encoder.
Thats the same with Encoders mp3, ogg, opus, flac.
BASS_Encode_SetPaused should be set on the Formats ogg or Opus.

Ian @ un4seen

Quote from: CouinAlso, are BASS_ENCODE_PAUSE and BASS_Encode_SetPaused false recommended or required for MP3?

It isn't as important with MP3 because MP3 doesn't have a header (like OGG does), but I think it's a good idea to just always start the encoder in a paused state when using BASS_Encode_CastInit (or BASS_Encode_ServerInit).

Quote from: CouinIs BASS_ENCODE_NOHEAD recommended/required for MP3 (and OGG)? I don't see exactly what this should do, the online help description of this flag looks confusous for me.

BASS_ENCODE_NOHEAD isn't needed (or even supported) by the format-specific encoding functions, eg. BASS_Encode_OGG_Start. It's only relevant when using command-line encoders (eg. OGGENC.EXE) with BASS_Encode_Start.

Couin