Hello !
I have a code that works fine on windows to cast from a mixer to shoutcast 1, 2, and icecast serveur.
However, from mac, my encoder dies as soon as I start to cast, the server react for a moment, and before I can listen to anything, the encoder dies out. I receive BASS_ENCODE_NOTIFY_ENCODER this signal from
// BASS_Encode_Start
this._encoder = this.objBass.BASS_Encode_Start(
this.mixer.enc, //mixer to encode
`${this.lamepath} -r -m s -s ${this.SAMPLE_RATE} -b ${this.BIT_RATE} -`,
this.objBass.BASS_Encode_Startflags.BASS_ENCODE_NOHEAD
);
// error management
if (this._encoder === 0) {
console.log("error);
//error
this.stopStreamingInt(event);
return;
} else {
console.log("Encoder channel: " +this._encoder);
}
const bam = this;
var watchConnection = this.objBass.BASS_Encode_SetNotify(
this._encoder,
function (handle, status, user) {
// bam.stopStreamingInt(event);
console.log("server connection is dead :" + status);
for (let prop in bam.objBass.EncoderNotifyStatus) {
if (bam.objBass.EncoderNotifyStatus[prop] === status) {
console.log(prop);
}
}
// }
}
);
// BASS_Encode_CastInit
if (!this.encoderProtocol) {
this.stopStreamingInt(event);
return;
}
const isCast = this.objBass.BASS_Encode_CastInit(
this._encoder,
this.streamURL,
this.streamID,
this.objBass.BASS_Encode_CastInitcontentMIMEtypes.BASS_ENCODE_TYPE_MP3,
"",
"",
"",
null,
null,
this.BIT_RATE,
true
);
if (!isCast) {
console.log("error at BASS_Encode_CastInit: " + this.objBass.BASS_ErrorGetCode());
this.stopStreamingInt(event);
return;
} else {
console.log("CastInit success" +"listen @ " +this.streamURL);
}
....
stopStreamingInt(event) {
if (this._encoder) this.objBass.BASS_Encode_Stop(this._encoder);
this._encoder = null;
}
I get this output :
Encoder channel: 12289
CastInit success listen @ serveradress:port/PUB
server connection is dead :1
BASS_ENCODE_NOTIFY_ENCODER
Everythin related to encoding is here. The encoder seems to work on command line in the terminal, I took it on
https://www.rarewares.org/mp3-lame-bundle.phpI have an apple chip, and took the LAME 3.100 for Apple Silicon (arm64) processors.
I wanted to try your code example given with bassenc.dylib (to check if the issue is from my lame executable or somewhere else), but, I'm new to xcode and I did not succeed in trying it out. I have added the needed dylib, but not lame yet, I get this message when I successfully compile (but I can not find the executable?) :
"
2021-01-06 13:33:32.139015+0100 convert[12106:316632] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x10051ae40> F8BB1C28-BAE8-11D6-9C31-00039315CD46
BASSenc transcoding example
---------------------------
usage: convert [-e#] <file> [encoder options]
-e = encoder: 0=wav, 1=aiff, 2=lame, 3=oggenc, 4=opusenc, 5=flac, 6=aac, 7=alac
Program ended with exit code: 126
"
I do not understand this message, what should I do here ?