Record stream audio in some way
#1
Hi,
i'd like to record aqudio stream coming from mixcloud or southcast. For southcast I found a way to rip the stream with streamripper but I have to invoke the command from a terminal. I tried to put the command in advanced launcher and as a program item in the menu but it doesn't work. Also the audio stops from the moment I invoke the script
here's the command but you have to install streamripper if not present
streamripper `netstat -n -A inet | grep -v ":22" | grep -v ":80" | grep "ESTABLISHED" | awk '{print substr($0,45,20)}'`


For mixcloud i'm experimenting with arecord and lame but all I get is noise. Although I have to add I'm using digital output through s/pdif.
This command should intercept audio from the source and parse it to mp3, rather than ripping from the audio-stream it't ripping the audio that goes to the speakers.
here's the command but first install lame if not present
arecord -f cd -t raw -D sysdefault:CARD=NVidia | lame -x -r - /home/blabla/outstream.mp3

anybody ideas
regards,
Boein
Reply
#2
(2013-01-03, 13:06)boein Wrote: Hi,
i'd like to record aqudio stream coming from mixcloud or southcast. For southcast I found a way to rip the stream with streamripper but I have to invoke the command from a terminal. I tried to put the command in advanced launcher and as a program item in the menu but it doesn't work. Also the audio stops from the moment I invoke the script
here's the command but you have to install streamripper if not present
streamripper `netstat -n -A inet | grep -v ":22" | grep -v ":80" | grep "ESTABLISHED" | awk '{print substr($0,45,20)}'`
OK so there you have a command which finds all your internet connections, then discards those that are on port 22 (ssh) and 80(http), and connects streamripper to what remains.

Bearing in mind that the average computer has many tcp connections going on, there could be quite a number of results to that command, some of which may not be the ones you want streamripper to capture. In all it's a pretty blunt tool IMHO.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#3
I know the command is not very accurate but in most cases when you are only listening to southcast it'll work. For now it's an ugly quick and dirty test to see if you could use streamripper from the xbmc menu. If that should work, it could be interesting for the skin developers to integrate it in their skins or plugins. It might be even more easy for those developers because when you click to play sth from southcast the skin probably has the complete url in some variable you only have to pass to the streamripper program. If I knew how to create a plugin I would try it myself but don't know where to start :-)
Anyway apart from streamripper the other command (rip audio output with arecord) looks more interesting but haven't found a way yet to make it work. If this should work you could rip all kinds of audio coming from the source (streaming, mp3, CD) straight to mp3 (in theory :-) But for the moment all I get is noise or device busy... I think there's a conflict with xbmc and arecord using the same device? I tried all kinds of pcm devices from .asoundrc but no luck. I'm stuck here.

regards,
Boein


Reply
#4
alsa often confuses me, but with arecord you need to record a capture device, not a playback device.

Also this approach, if it worked, would capture everything going through the soundcard, including system noises, gui navigation sounds etc.

I'll have a play....
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#5
Thanks, I hope it's possible. IT should because somewhere on the internet I found this command, and they said if it comes out of your speakers you should be able to record it. So this looks like a real challenge here ;-)
regards,
boein
Reply
#6
mixcloud has a plugin for XBMC, you could study the code and see how it finds the stream and develop something from there

Also do you mean southcast or soundcast?
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#7
I'm using the mixcloud and soundcloud plugin, but haven't got a clue where to begin creating my own plugin. Some time ago I created my own plugins for mediaportal and could record from internet radio channels using my plugin as a frontend for the streamripper program. To create plugins MP's wiki was well documented
and could be programmed in VB.net. Nevertheless made the switch to xbmc because of the instability of MP and or windows and xbmc looks better, runs smoother, more better plugins... :-) The only thing missing is the ability to record, dowload or rip audio coming from internet radio's, something that was possible with Mediaportal.
It is indeed southcast from southcast radio, also a great plugin for xbmc.
Reply
#8
The mixcloud plugin is fairly simple - there is essentially one file under

.xbmc/addons/plugins.audio.mixcloud, the file that does all the work is default.py

If you add a line in the function play_cloudcast so it reads like this:

Code:
def play_cloudcast(key):
    url=get_stream(key)
    if url:
        if debugenabled:
            print ("Resolved to URL: "+url)
        xbmcplugin.setResolvedUrl(handle=plugin_handle,succeeded=True,listitem=xbmcgui.ListItem(path=url))
        add_to_settinglist('play_history_list',key,'play_history_max')
    else:
        xbmcplugin.setResolvedUrl(handle=plugin_handle,succeeded=False,listitem=xbmcgui.ListItem())
Then enable debug in the settings, you'll get the stream url printed in your log file (.xbmc/temp/xbmc.log) like this:

Code:
12:58:30 T:140261879441152  NOTICE: MIXCLOUD resolving cloudcast stream for http://www.mixcloud.com/milesbonny/tbc53/
12:58:32 T:140261879441152  NOTICE: Resolved to URL: http://stream14.mixcloud.com/cloudcasts/originals/d/0/0/b/a86e-7198-40d3-a915-b9a227573c5d.mp3

There are then plenty of ways to get that stream, my favourite is mplayer:

Code:
mplayer -dumpstream -dumpfile myname.mp3 http://stream14.mixcloud.com/cloudcasts/originals/d/0/0/b/a86e-7198-40d3-a915-b9a227573c5d.mp3


Famous last words but it should be possible to make some kind of recording interface in the existing plugin - add somehow an option to record instead of play.

Depends too on how you envisage it working from a user perspective. I see two ways to go:

1. I am listening to something I like on mixcloud plugin and decide I want to keep it. I push a button which initiates a download of the file to somewhere in my music folder (optionally I carry on listening while this is going on); or

2. I browse the menus in mixcloud plugin and when I choose a stream I get the option to listen or download, if I choose listen it works as before, if I choose download it puts it somewhere in my music folders.

I think 2 would be easier to code because once you are in play mode I am not sure how to add an option to download into the gui.

In either case you'd want it to add some metadata into the music database. Actually I see on the one I downloaded there are tags already in the mp3, so probably just get xbmc do it's normal metadata handling?

In short the mixcloud plugin author has done the work of indexing the mixloud site and working out the urls. We can possibly build on that.
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#9
Afterthought: There is no reason to use mplayer to download, it just complicates things. wget or curl will work better. In my case (from above)

Code:
wget http://stream14.mixcloud.com/cloudcasts/originals/d/0/0/b/a86e-7198-40d3-a915-b9a227573c5d.mp3 -O Miles.Bonny.TBC53.mp3
If I have helped you or increased your knowledge, click the 'thumbs up' button to give thanks :) (People with less than 20 posts won't see the "thumbs up" button.)
Reply
#10
Thanks for figuring all this out. Now it's up to the skin developers to integrate a nice "record" or "download current stream" button in their skin :-)
Maybe throw this forum thread into their forum and maybe some comes out in a next release...let's hope

regards,
Boein
Reply

Logout Mark Read Team Forum Stats Members Help
Record stream audio in some way0