BASS_Encode_CastInit and IceCast server = Timeout

Started by Couin,

Couin

Hi :)

I'm trying to build a small and simple stream encoder for an Icecast server, with record to file option.

Basic test for recording is ok but I encounter difficulties with streaming. Here is my code (I put returns of debug prints as comment)

encoder = BASS_Encode_MP3_Start(rchan, "-b 128", 0, 0, 0) '// set MP3 encoder on it
Debug.Print encoder 'returns 1073741825
Debug.Print BASS_ErrorGetCode 'returns 0
If encoder <> 0 Then
Debug.Print BASS_Encode_CastInit(encoder, "localhost:8110/live", "source:mypassword", BASS_ENCODE_TYPE_MP3, "name", "url", "genre", "description", 0, 128, BASS_ENCODE_CAST_PUT)    'returns 0, after 5 seconds
Debug.Print BASS_ErrorGetCode 'returns 40 (Timeout)
End If

With BUTT (https://danielnoethen.de/butt/), no problem, connection is OK, streaming is OK.

I searched in a lot of topics but I did not found where I make a mistake  :-[

Thanks :)

Ian @ un4seen

A timeout would most likely be a problem with the address in the "server" parameter, ie. "localhost:8110". Are you sure that's correct, ie. you have a local Icecast server running on port 8110? Is it exactly the same as you're using with BUTT? Please also try it with the pre-compiled CAST.EXE or CAST-ADDONS.EXE examples from the BASSenc package (C\BIN folder).

Couin

Hi Ian :)

Yes, I use the same parameters with BUTT.
BUTT_test.jpg

I just tried with cast.exe and cast-addons.exe, and with cast.exe, I get a "Can't start encoding - error code:2", but with cast-addons.exe it's OK.
cast-addons.jpg


In my code, if I just set "localhost:8110" as server, without the mount point, I get no error, but I have no mount point.

I'm not familiar with "c" but I tried to understand how it was working, I don't find where I make a mistake in my code :(

Ian @ un4seen

The main difference I see between the example's BASS_Encode_CastInit call and yours is the use of the BASS_ENCODE_CAST_PUT flag. Does removing that from your call help?


Ian @ un4seen

OK. The only other difference I see is the "source:" prefix in your call's password, so you could try also removing that.

I guess another possibility is that Windows firewall is blocking your app's connection to the Icecase server. You could try renaming your EXE and see if that makes any difference. You could also try using Wireshark to capture the traffic and see if anything is getting through to the Icecast server when you try connecting to it.

Couin

With only the password (without "source:" ,) same thing .
About Firewall, it is disabled.
Also, I'm looking about how Cast example in Vb dir is working. I had to add bassenc_mp3.bas to the project, and change BASS_Encode_Start for BASS_Encode_MP3_Start ( so encoder = BASS_Encode_MP3_Start(rchan, "-b 128", BASS_ENCODE_NOHEAD Or BASS_ENCODE_AUTOFREE, 0, 0) ), to get good result (I can connect to localhost server, and even to remote server).
This is a good way to explore :)