How to stream semi-live audio over internet

耗尽温柔 提交于 2019-12-06 07:15:13
Zoredache

For transmitting audio over the Internet you should probably look at using RTP. It is used for SIP, H.323, and many others use this for streaming audio content. You might even want to look at just using a SIP lirbary. It already has much of what it sounds like you want. SIP can have pretty good quality if you have a good codec, and sufficient bandwidth.

VLC supports various types of audio and video transcoding. Might be something you want to check out.

I know that thread is kind-a old, however, one insight that I want to share with you is this: you can't use TCP for this that you are trying to do because of the latency you require - you said 1 second is acceptable, and from that I assume that over 1sec isn't.

Your latency with TCP isn't determined with PING to host. The problem with TCP is that when you connect, and you accept to live with certain latency, ANY problem with a connection will shrink TCP window, all data that is received will be dropped and underlying protocol will have to handle it. At this time, you will lose your 1sec advantage over real-time and the stream will be dropped.

TCP is good for the situation where large delays are acceptable (say 10 seconds or more) which will allow you to always have enough data to eat and play out before connection is re-established.

If I was in your shoes, I'll try the following:

  • UDP for transport
  • some low-delay encoding - AAC-LD for example, but mp3 would also be OK
  • have some mathematical overhead set-up over the UDP so if one packet is lost, audio stream can recover.

BTW, frames at mp3 are 40msec long. With some 'magic' you could mask few dropped frames.

ShoutCAST + SAM Broadcaster or Winamp. Will do the trick easily.

If you’re looking to start your own Internet radio station using icecast2 you can:

  • install icecast on your VPS
    #sudo apt-get install icecast
  • install ezstream also on you VPS
    #sudo apt-get install ezstream
  • create a playlist file with your files

playlist.m3u (you can read more form wikipedia)

    #EXTM3U

    #EXTINF:123, Sample artist - Sample title
    Sample.mp3

    #EXTINF:321,Example Artist - Example title
    Example.ogg
  • create an ezstream config file xml

config.xml

<ezstream>
    <url>http://localhost:8000/stream</url>
    <!--
      If a different user name than "source" should be used, set it in
      <sourceuser/>:
     -->
    <!-- <sourceuser>mr_stream</sourceuser> -->
    <sourcepassword>hackme</sourcepassword>
    <format>MP3</format>
    <filename>playlist.m3u</filename>
    <stream_once>1</stream_once>
    <svrinfoname>My Stream</svrinfoname>
    <svrinfourl>http://www.oddsock.org</svrinfourl>
    <svrinfogenre>RockNRoll</svrinfogenre>
    <svrinfodescription>This is a stream description</svrinfodescription>
    <svrinfobitrate>128</svrinfobitrate>
    <svrinfochannels>2</svrinfochannels>
    <svrinfosamplerate>44100</svrinfosamplerate>
    <svrinfopublic>0</svrinfopublic>
</ezstream>

Or you can try this: nodejs application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!