![]() |
#1 |
Junior Member
Join Date: Aug 2015
Posts: 14
|
Streaming to SHOUTcast v1 using C#
Hi Everyone,
What I am trying to do is write a program to feed mp3s to a hosted shoutcast stream. I am doing this in c#. I have been successful logging into my stream, passing my password and station data and I receive the "OK2" message. According to a number of articles, posts, and webpages, the next thing I have to do is send the mp3 data. I've tried sending it as binary, it didn't work. I've tried sending it as ASCII, that didn't work. The mp3 files are saved to my hard drive, read in, in binary, and sent to my shoutcast host. I know this data is getting there because I use Wireshark to track the the tcp connection and see the data getting there. When I check my shoutcast stats page it says that the stream is up and running, but nothing plays on my player. Could someone PLEASE point me in the right direction to attain the information on sending the mp3 to my shoucast host? Algoritmns, block size, example code, etc........ I've been kicking this around so long now that it's driving me nuts! Thank you in advance for ANY help!! |
![]() |
![]() |
![]() |
#2 |
Join Date: Sep 2003
Posts: 27,873
|
it'd be a bit easier to do it against the supported 2.x DNAS than the unsupported 1.x DNAS as you can enable the source debugging options on 2.x to get a better idea of what the DNAS is actually seeing from your connection (in addition to what you're checking on sending). as 2.x fully supports 1.x sources (however much people seem to think that is not the case).
but it sounds like you've got most things right, just ensure that you're not sending any ID3 tags and other related tag data - it just needs to be the raw audio (preferably ensuring that you're only sending whole audio frames - not doing that will break a number of HTML5 / Flash players and is something we've had to add to the recent 2.x release to improve stream playback under such cases). |
![]() |
![]() |
![]() |
#3 |
Junior Member
Join Date: Aug 2015
Posts: 14
|
To DrO
Thanks for the response, the reason I have not moved to Shoutcast v2.0 is the php code that runs my station website. It would all have to be recoded. Do you have any insight on how to EXACTLY send the mp3 data?
I'm not quite sure where the header breaks and the raw mp3 data begins. Are there resources out there that you know of that I could study? |
![]() |
![]() |
![]() |
#4 | ||
Join Date: Sep 2003
Posts: 27,873
|
Quote:
can I ask what (person, article, etc) has made you think you'd need to re-code everything? Quote:
|
||
![]() |
![]() |
![]() |
#5 |
Junior Member
Join Date: Aug 2015
Posts: 14
|
To DrO
It was a bad assumption on my part regarding Shoutcast v2 I guess.
Do you know what block size to use when sending the mp3 to Shoutcast? |
![]() |
![]() |
![]() |
#6 |
Join Date: Sep 2003
Posts: 27,873
|
you just keep trying to send what you've got until either you decide to stop the connection or the DNAS closes the connection (which you'll need to monitor for). there is no concept of block size (especially with 1.x) and the DNAS will just keep taking what it's given.
as long as what you're sending is valid MP3 data (and if possible you can ensure you're only sending complete MP3 frames) then it should help improve the likelihood that when the DNAS then provides that data to the listeners, then it will work (subject to my notes in my first reply re: 1.x and HTML5/some Flash players). |
![]() |
![]() |
![]() |
#7 |
Junior Member
Join Date: Aug 2015
Posts: 14
|
Thank you again DrO
What you have told me is basically everything that I had learned from reading different threads and articles in the past. I do appreciate you educating me on the fact that there isn't really a need to reprogram my site based on the difference between Shoutcast v1 & v2.
What I am asking for is specific code snippets used to send the mp3s to Shoutcast. I've tried all that I've said above and am at a dead end. Is there anyone out there that has specifics. Frame size when sending? Delay times when sending frames? I'm looking for the Exact procedural practices used. I'm not sure what the big mystery is behind the concept of what should be a simple task of sending mp3s to a Shoutcast Steam. There are CLEAR and definitive instructions on how to do millions of things in other areas of programming on the net, but when you research writing shoutcast streaming it all gets criptic. |
![]() |
![]() |
![]() |
#8 |
Join Date: Sep 2003
Posts: 27,873
|
I have made it as clear as possible when I cannot provide you example C# code (which would constitute me having to write a C# source to be able to make it a viable example, which is not something I can do).
you just send the password + headers + MP3 data + dealing with any responses back from the DNAS as needed. that's it, there's nothing magic or special needing to be done. the DNAS doesn't care about framing, delays, etc as I've already said - you just have to ensure you're sending things as soon as you can and when the DNAS wants to accept things over the socket connection. the DNAS then just shoves it into a buffer and it's down to the listener to regulate how it gets the data and how it processes what is provided. the DNAS (subject to very recent builds) doesn't do anything on the audio (and none will do any re-processing of the audio data). hence why there is basically nothing out there as there's nothing special to do. if anything, it's like a HTTP PUT with a custom header setup i.e. about as basic as you can get. you can always try looking at one of the open source broadcasting tools / libraries to see how they're doing it and try to port that to C#. that's about as much as I can do / suggest than what I've already said. but other than seeing what the DNAS is reporting &/or dumping the output and checking that it's correct, without anything to actually test against (as it could be the stream is correct and it's something with the player you're trying to use), there's little else I can suggest. |
![]() |
![]() |
![]() |
#9 | |
Forum King
Join Date: Jun 2007
Location: Under the bridge
Posts: 2,289
|
Quote:
Is it just me or are shoutcast users getting dumber? |
|
![]() |
![]() |
![]() |
#10 |
Junior Member
Join Date: Dec 2012
Posts: 5
|
Hi!
I was thinking same thing past couple months. I haven't tried it but I'm 100% sure that's how it'll be done. Download Wireshark for sniffing packets your current DSP (SAM? Maybe?) sends to DNAS v2 or v1 and DNAS sends to your client. If you are using transcoder then do it the same thing for it. Then apply everything to your C# Code. |
![]() |
![]() |
![]() |
#11 | |
Forum King
Join Date: Jun 2007
Location: Under the bridge
Posts: 2,289
|
Quote:
The only flaws in that are a) SAM broadcaster b) if you're going to go for v2 (ultravox 2.1 protocol) it's fully documented (I wrote a nodejs source client based on the documentation) c) SAM broadcaster d) sniffing packets gives very little info compared to the documentation mentioned above, or even the source code in another language (if you're able to understand the other language); and finally e) SAM broadcaster Is it just me or are shoutcast users getting dumber? |
|
![]() |
![]() |
![]() |
#12 |
Junior Member
Join Date: Aug 2015
Posts: 14
|
I have Wireshark and SAM Broadcaster. I have sniffed the packets coming and going. I am able to connect to my Shoutcast Stream in the exact manner that SAM Broadcaster does. I receive the ok to send, BUT, when I send the mp3 data I am either sending too much of the header, or sending too fast or too slow to the server. What I really need is to see some example code of sending the mp3 to shoutcast. The handshake between client and server is made just fine. I can see the mp3 data streaming to my shoutcast stream, but hear nothing playing on a player connected to the stream. I know the player works because I can hear the stream when I use SAM to play the mp3 file.
This is extremely frustrating. Why wouldn't there be more information out there to perform what seems like a simple task? I'll check that AltaCast out thanks! |
![]() |
![]() |
![]() |
#13 | |
Major Dude
Join Date: Sep 2003
Location: Harpurhey, Manchester UK
Posts: 1,322
|
Quote:
|
|
![]() |
![]() |
![]() |
#14 |
Junior Member
Join Date: Aug 2015
Posts: 14
|
Viewlog file
Here is a snippet of the View log file after connecting to Shout Cast and trying to have a player connect to retrieve the stream and play the music.
Can anyone translate/tell me what is going wrong? <09/01/15@21:02:58> [source] connected from 24.188.98.3 <09/01/15@21:02:58> [source] icy-name ![]() <09/01/15@21:02:58> [source] icy-pub:1 ; icy-br:128 ; icy-url:http://www.allrequestradio4u.com <09/01/15@21:02:58> [source] icy-irc:#audiorealm ; icy-icq:NA ; icy-aim:NA <09/01/15@21:02:59> [dest: 24.188.98.3] starting stream (UID: 1677)[L: 1]{A: NSPlayer/12.00.10011.16384 WMFSDK/12.00.10011.16384}(P: 1) <09/01/15@21:02:59> [dest: 24.188.98.3] connection closed (0 seconds) (UID: 1677)[L: 0]{Bytes: 18723}(P: 1) <09/01/15@21:02:59> [dest: 24.188.98.3] starting stream (UID: 1678)[L: 1]{A: NSPlayer/12.00.10011.16384 WMFSDK/12.00.10011.16384}(P: 1) <09/01/15@21:02:59> [dest: 24.188.98.3] starting stream (UID: 1679)[L: 2]{A: NSPlayer/12.00.10011.16384 WMFSDK/12.00.10011.16384}(P: 2) <09/01/15@21:02:59> [dest: 24.188.98.3] connection closed (0 seconds) (UID: 1679)[L: 1]{Bytes: 15819}(P: 2) <09/01/15@21:02:59> [dest: 24.188.98.3] starting stream (UID: 1680)[L: 2]{A: NSPlayer/12.00.10011.16384 WMFSDK/12.00.10011.16384}(P: 2) <09/01/15@21:02:59> [dest: 37.59.25.124] starting stream (UID: 1681)[L: 3]{A: SHOUTcast Directory Tester}(P: 3) <09/01/15@21:02:59> [dest: 24.188.98.3] connection closed (0 seconds) (UID: 1680)[L: 2]{Bytes: 15800}(P: 2) <09/01/15@21:02:59> [dest: 24.188.98.3] connection closed (0 seconds) (UID: 1678)[L: 1]{Bytes: 161500}(P: 1) <09/01/15@21:03:00> [dest: 24.188.98.3] starting stream (UID: 1682)[L: 2]{A: NSPlayer/12.0.10011.16384 WMFSDK/12.0}(P: 1) <09/01/15@21:03:00> [dest: 37.59.25.124] connection closed (0 seconds) (UID: 1681)[L: 1]{Bytes: 35947}(P: 3) <09/01/15@21:03:00> [dest: 24.188.98.3] connection closed (0 seconds) (UID: 1682)[L: 0]{Bytes: 49780}(P: 1) <09/01/15@21:03:00> [yp_add] yp.shoutcast.com added me successfully <09/01/15@21:03:00> [dest: 24.188.98.3] starting stream (UID: 1683)[L: 1]{A: NSPlayer/12.0.10011.16384 WMFSDK/12.0}(P: 1) <09/01/15@21:03:00> [dest: 24.188.98.3] connection closed (0 seconds) (UID: 1683)[L: 0]{Bytes: 57040}(P: 1) <09/01/15@21:03:00> [dest: 24.188.98.3] starting stream (UID: 1684)[L: 1]{A: NSPlayer/12.00.10011.16384 WMFSDK/12.00.10011.16384}(P: 1) <09/01/15@21:03:01> [dest: 24.188.98.3] connection closed (0 seconds) (UID: 1684)[L: 0]{Bytes: 15819}(P: 1) <09/01/15@21:03:01> [dest: 24.188.98.3] starting stream (UID: 1685)[L: 1]{A: NSPlayer/12.00.10011.16384 WMFSDK/12.00.10011.16384}(P: 1) <09/01/15@21:03:30> [dest: 24.188.98.3] connection closed (28 seconds) (UID: 1685)[L: 0]{Bytes: 4421166}(P: 1) <09/01/15@21:03:30> [dest: 24.188.98.3] starting stream (UID: 1686)[L: 1]{A: NSPlayer/12.00.10011.16384 WMFSDK/12.00.10011.16384}(P: 1) <09/01/15@21:03:30> [dest: 24.188.98.3] connection closed (0 seconds) (UID: 1686)[L: 0]{Bytes: 51151}(P: 1) <09/01/15@21:03:53> [source] source dropped connection. disconnecting. <09/01/15@21:03:55> [main] connecting to yp.shoutcast.com to remove myself [no source] <09/01/15@21:03:55> [yp_rem] yp.shoutcast.com removed me! |
![]() |
![]() |
![]() |
#15 | ||
Forum King
Join Date: Jun 2007
Location: Under the bridge
Posts: 2,289
|
Quote:
Quote:
Is it just me or are shoutcast users getting dumber? |
||
![]() |
![]() |
![]() |
#16 |
Junior Member
Join Date: Aug 2015
Posts: 14
|
Shoutcast supposed experts quoting? That is very helpful!
I come here for help I get sarcastic remarks. Thanks! |
![]() |
![]() |
![]() |
#17 |
Join Date: Sep 2003
Posts: 27,873
|
the log output doesn't give much to work with, hence why I've said in my first reply to use the 2.x DNAS with debugging enabled as that gives more information on what the DNAS is trying to process and may even show what the issue could be (when there's no url to a DNAS to check the output off).
|
![]() |
![]() |
![]() |
#18 |
Junior Member
Join Date: Aug 2015
Posts: 14
|
Does anyone have an algorithm that calculates packet size and frequency of sending the mp3 data to Shoutcast? Also, is it sent in binary format?
|
![]() |
![]() |
![]() |
#19 | ||
Forum King
Join Date: Jun 2007
Location: Under the bridge
Posts: 2,289
|
Quote:
1) max packet size negotiated in the initial connection phase; or 2) A single complete chunk of mp3 (or HE-AAC for that matter) audio, if I'm doing the compressing and not simply passing on already compressed audio (subject to the limit in point 1) Quote:
for a 96k stream, send 12kBYTES per second, for a 128k stream, send 16kBYTES per second, There's a formula for figuring it out, I just can't seem to find it Is it just me or are shoutcast users getting dumber? |
||
![]() |
![]() |
![]() |
#20 |
Junior Member
Join Date: Aug 2015
Posts: 14
|
Do you have examples of your code Jaromanda? That you would be willing to share?
Your response was helpful. I am able to send the mp3 data, but my stream shuts down as soon as I do. I think I'm sending it in the wrong format. |
![]() |
![]() |
![]() |
#21 |
Forum King
Join Date: Jun 2007
Location: Under the bridge
Posts: 2,289
|
Not any more, I gave up on edcast years ago and two computer upgrades later I've lost all the source code. You may be able to find it on sourceforge or maybe google code
Is it just me or are shoutcast users getting dumber? |
![]() |
![]() |
![]() |
#22 |
Junior Member
Join Date: Aug 2015
Posts: 14
|
Through more trial and error I have found that my connection is closing just before sending the Mp3 data to the shoutcast server. I am getting an error 10053. It's a cryptic error even in Microsoft forums. Any info on circumventing this error would be appreciated.
|
![]() |
![]() |
![]() |
#23 |
Forum King
Join Date: Jun 2007
Location: Under the bridge
Posts: 2,289
|
WSAECONNABORTED
10053 Software caused connection abort. An established connection was aborted by the software in your host computer, possibly due to a data transmission time-out or protocol error. Is it just me or are shoutcast users getting dumber? |
![]() |
![]() |
![]() |
#24 |
Junior Member
Join Date: Aug 2015
Posts: 14
|
Yes, Thanks Jaromanda, that is exactly what I found when I googled the error also. There is no advice anywhere on how to circumvent the error. That is what I am looking for.
Expect that if I posed the question, I've looked on the internet for an answer. I am coming to the 'professionals' that are supposed to be here for help. Re-quoting or reposting the obvious may get you more points on here as a Major Dude, but does little to help. |
![]() |
![]() |
![]() |
#25 |
Join Date: Sep 2003
Posts: 27,873
|
as was stated in the first reply to this thread, you need to be using a current DNAS and not 1.x so you can enable the debugging options to see why things are failing and so those of us who might be able to give you a reason have that information.
the 1.x DNAS is not going to give that information and if that's all you're going to work against then there is no 'official' help going to be coming as the 1.x DNAS is not supported (and as it does not provide detailed debug output, it's hindering you finding a cause of your issues). so if you want official help, then you need to do as was initially asked to do. |
![]() |
![]() |
![]() |
#26 | |
Forum King
Join Date: Jun 2007
Location: Under the bridge
Posts: 2,289
|
Quote:
wayne - the professionals here have no idea what monkey code you write, so stick your attitude where the sun don't shine, and learn to at least read a real programming language so you can duplicate oddsocks (bad) code in the toy language you write in Is it just me or are shoutcast users getting dumber? |
|
![]() |
![]() |
![]() |
#27 |
Junior Member
Join Date: Aug 2015
Posts: 14
|
Very professional reply Jaromanda. I don't want to 'steal' code, I am attempting to learn a process.
Thank you Dr. O I will move to v2. |
![]() |
![]() |
![]() |
#28 | ||
Forum King
Join Date: Jun 2007
Location: Under the bridge
Posts: 2,289
|
Why do I need to make a "professional" reply to your "I can't be bothered doing any research, someone do it for me" attitude? I have no affiliation with winamp/shoucast, so I can be as rude to you as you are to me.
Good luck on Stack Overflow http://stackoverflow.com/questions/3...ast-mp3-server Quote:
Quote:
Is it just me or are shoutcast users getting dumber? |
||
![]() |
![]() |
![]() |
#29 |
Junior Member
Join Date: Aug 2015
Posts: 14
|
Lmao, Forum King? More like a Forum Queen! You should respond less and get on with
your transformation like Caitlyn Jenner! Just stay out of the thread asshole if you have no insight to provide. |
![]() |
![]() |
![]() |
#30 |
Forum King
Join Date: Jun 2007
Location: Under the bridge
Posts: 2,289
|
First thing I did in this thread was give you a link to altacast (edcast derivative) source.
I showed you how to "calculate" the rate of sending data I made sarcastic comments in response to some dimwit who thought it would be a good idea to BUY SAM Broadcaster just to wireshark the interaction (guaranteed NOT to be helpful, as SAM Broadcaster is a piece of SHIT) I mistakenly pointed out what that error was, because I thought you couldn't find ANY info about it, my mistake, since you couldn't find ANY code to copy, I assumed you wouldn't be able to find out ANY description for that error I started out trying to help, now I make it my mission to be a pain in your arse, Wayne, you little bitch Is it just me or are shoutcast users getting dumber? |
![]() |
![]() |
![]() |
#31 | ||
Major Dude
Join Date: Sep 2003
Location: Harpurhey, Manchester UK
Posts: 1,322
|
Quote:
Quote:
|
||
![]() |
![]() |
![]() |
#32 | |
Forum King
Join Date: Jun 2007
Location: Under the bridge
Posts: 2,289
|
Quote:
I actually did finish riocast - the core is written in javascript, encoding done by ffmpeg (or any other suitable program), a couple of other external programs to source the actual audio from a sound card or winamp I was trying to write a "source" plugin for radiodj, but could not find any documentation on doing so, so I gave up the whole lot Is it just me or are shoutcast users getting dumber? |
|
![]() |
![]() |
![]() |
#33 | |
Major Dude
Join Date: Sep 2003
Location: Harpurhey, Manchester UK
Posts: 1,322
|
Quote:
|
|
![]() |
![]() |
![]() |
#34 | |
Forum King
Join Date: Jun 2007
Location: Under the bridge
Posts: 2,289
|
Quote:
![]() Is it just me or are shoutcast users getting dumber? |
|
![]() |
![]() |
![]() |
#35 |
Major Dude
Join Date: Sep 2003
Location: Harpurhey, Manchester UK
Posts: 1,322
|
What RDJ really needs is someone to write a streaming plugin that doesn't cause the program to crawl when there's a connection issue..... It's the only downside to the Altacast plugin.
The developer of Altacast has a few things going on in his life right now and can't give any more updates until that's sorted. If i knew where to start i'd write something .... but I don't. |
![]() |
![]() |
![]() |
#36 | |
Forum King
Join Date: Jun 2007
Location: Under the bridge
Posts: 2,289
|
Quote:
p.s. I'm "not allowed" to post on this thread any more ... pffft Is it just me or are shoutcast users getting dumber? |
|
![]() |
![]() |
![]() |
#37 | |
Forum King
Join Date: Jun 2007
Location: Under the bridge
Posts: 2,289
|
Quote:
but many people don't like the idea of separate processes for some reason. having to start two or more programs at a time seems to be too difficult Is it just me or are shoutcast users getting dumber? |
|
![]() |
![]() |
![]() |
#38 | |
Major Dude
Join Date: Sep 2003
Location: Harpurhey, Manchester UK
Posts: 1,322
|
Quote:
It's no more difficult than having them built into the program IMHO. Currently using what was meant to be a temporary streamer plugin written by Marius which is actually working OK (Mp3 128K 22khz) but it could do with a few tweaks. When it comes to standalone streaming software the options are somewhat limited....It's a right pain in the BUTT!! (See what i did there) |
|
![]() |
![]() |
![]() |
#39 |
Forum King
Join Date: Jun 2007
Location: Under the bridge
Posts: 2,289
|
Saw it
![]() Is it just me or are shoutcast users getting dumber? |
![]() |
![]() |
![]() |
#40 |
Forum King
Join Date: Jun 2007
Location: Under the bridge
Posts: 2,289
|
radiodj DSP "system" is BASS_WADSP? No "native" interface (i.e. non-wadsp?)
Is it just me or are shoutcast users getting dumber? |
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|