| View previous topic :: View next topic |
| Author |
Message |
Liquid_Squelch
Joined: 11 Mar 2006 Posts: 56
|
Posted: Thu Feb 09, 2012 6:37 pm Post subject: Insert Long Delay into Audio Streams |
|
|
I'm gearing up for a project, and I need to work the opposite of what everyone wants to do with Icecast.
I need a delay. Not a 30 second or 60 second delay, but a 15 minute or 30 minute delay. Normally, I could just increase the buffer to add a delay, but 15 minutes is a long time to wait
About the best way I could come up with is:
1. Stream live to Icecast with a hidden and password protected mount.
2. wget the live stream via CRON each minute.
3. Save file in step 2 with <mount>_<date>_<hour-minute>.mp3|ogg
So the question is, can Icecast stream a playlist of say <mount>_"Now" - 15|30 Min.mp3|ogg ?
If so, how would I configure the Icecast mount point? Is the best approach a fallback mount as the .mp3|ogg of the delayed file? Would it be easier to have something like Ice2 or DarkIce stream the playlist? Should I look into LiquidSoap?
I'm looking to run all the scripting on the VPS with only a single originating "live" source which is remotely fed.
Long story short- is this at all possible? Am I living in a pipe dream?
Thanks! |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Thu Feb 09, 2012 7:37 pm Post subject: |
|
|
A bit convoluted. you could set up an internal mountpoint with a very large queue and a burst which would be that of the 15 mins, then run curl on that mountpoint with a --limit-rate of the expected bitrate to feed into say ices via stdin. you would just need to make sure that the curl to ices link is not started for at least 15 mins while the queue is being filled.
At 128k, the burst would need to be around 14Meg, the curl --limit-rate would then prevent that being read at once, and ices or something similar would send to the delayed mountpoint. The on-connect script could be used to kick off a sleep followed by an curl/ices
karl. |
|
| Back to top |
|
 |
Liquid_Squelch
Joined: 11 Mar 2006 Posts: 56
|
Posted: Wed Feb 15, 2012 9:04 pm Post subject: |
|
|
Thanks again for the info Karl.
If I follow correctly,
I will have example mount points /live and /delay
I know from my wget scripts that locally record my "/live" stream that each file is 3.5meg for a 30 minute file. So, for the rest of the exercise we'll assume 30 minute delay.
The buffer size on the /live mount point will be 3.5Meg
Icecast will be setup with an 'on connect' script that will curl the /live feed, then kick a ice0 session 30 minutes later.
We'll curl --limit-rate localhost/live to a file in the icecast web directory.. example: record.mp3
Then, runing ices0 (because I need mp3), I would setup the following in the config:
| Code: |
<instance>
<hostname>localhost</hostname>
<port>(ICECAST PORT)</port>
<password>changemenow</password>
<mount>delay</mount>
</instance>
<module>stdinpcm</module>
<param name="rate">16000</param>
<param name="channels">1</param>
<param name="metadata">1</param>
<param name="metadatafilename">/path/to/icecast/web/record.mp3</param> |
So the question is, why do I need a buffer equal to 30 minutes on the /live mount if curl will be feeding ice0 30 minutes later? Or are we using the 30 minute buffer on the /live mount because curl isn't actually saving a file?
Also, since I am fairly new to this... will the curl file continue to grow forever?
As you can tell, I'm still learning a lot of the linux commands, but I'm trying;). I have a openSUSE pc as my primary desktop, so I'm not as lost as I once was!
Thanks again Karl for the help. |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Wed Feb 15, 2012 9:45 pm Post subject: |
|
|
I did not refer to a file.
/live would have a large burst say 3.5meg, and curl would be started after 30mins after the stream starts. curl then feeds into say ices using a non re-encoding conf to feed into /delay eg
#!/bin/sh
(sleep 1800
curl -s --limit-rate 2048 http://.../live | ices -c delay.conf )
the exact rate may need to be checked but the key thing here is that the curl keeps a steady pace to feed ices which sends the older burst data into the second mountpoint. The curl|ices is kicked off from the on-connect or mount_add scripts.
karl. |
|
| Back to top |
|
 |
Liquid_Squelch
Joined: 11 Mar 2006 Posts: 56
|
Posted: Thu Feb 16, 2012 11:05 pm Post subject: ices0.4 no playlist |
|
|
Karl,
Thank you again for all the help. I have one more question for the Code Warrior.
In the ices0 config file, there is a section for Playlist. Since I'm piping in a curl source, what do I put in for the playlist section of the ices0.conf file?
I've gone with ices0.4 because I am running an mp3. Can ices2.x run mp3 or only ogg?
The link on the ices page for an ice0 config file is broken, so that is why I am seeking help in this thread.
Thanks again for all the help. |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Fri Feb 17, 2012 12:13 am Post subject: |
|
|
IIRC If the filename from inside the playlist is a single hyphen then standard input is used (ie the pipe)
karl. |
|
| Back to top |
|
 |
Liquid_Squelch
Joined: 11 Mar 2006 Posts: 56
|
Posted: Fri Feb 17, 2012 1:14 am Post subject: |
|
|
After some playing around after your last advice...
Creating a playlist file called playlist.txt and defining an mp3 file works.
Editing the same file, and replacing the mp3 path with '-' seems to work, but I never see the mount on my Icecast server....
| Code: |
-bash-3.2# curl -s --limit-rate 16 http://localhost/mount | ices -c ices_delay.conf
Logfile opened
DEBUG: Sending following information to libshout:
DEBUG: Stream: 0
DEBUG: Host: localhost (protocol: http)
DEBUG: Mount: /test-delay, Password: hackme
DEBUG: Name: Delayed Stream URL: http://localhost/
DEBUG: Genre: Default genre Desc: Default description
DEBUG: Bitrate: 16 Public: 0
DEBUG: Dump file: (null)
DEBUG: Initializing playlist handler...
DEBUG: Initializing builting playlist handler...
DEBUG: Startup complete
DEBUG: Builtin playlist handler serving: -
DEBUG: Filename cleaned up from [-] to [-]
DEBUG: Reading audio from stdin
|
Now to look at the icecast logs and see if it is even making it over to that side of the house.. Nothing.. Nothing in access.log or error.log
The only entries are from when I fed the mp3.
I can see 1 listener on the /live mount (which is curl), but I never see the /delay mount connect. After a few minutes, the count on /live returns to 0. I'm stumped again. Any thoughts? |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Fri Feb 17, 2012 2:36 am Post subject: |
|
|
You'll have to check which part is failing, is the curl not working, is it getting valid data to parse. It doesn't look like the connection to icecast is done from that output.
One other problem will be that the metadata is not being transferred. The only app that did something like this was stream transcoder but you want it without the transcoding. you could use something like vlc to act as the relay but I haven't tried it like that.
karl. |
|
| Back to top |
|
 |
Liquid_Squelch
Joined: 11 Mar 2006 Posts: 56
|
Posted: Fri Feb 17, 2012 3:58 am Post subject: |
|
|
From what I can tell, curl is working.
Here is a verbose dump. I only assume that the hieroglyphics at the bottom of the capture is the binary mp3 in ASCII format.
| Code: |
-bash-3.2# curl -v -s --limit-rate 16 http://localhost/live
* About to connect() to localhost port 80
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 80
> GET /live HTTP/1.1
> User-Agent: curl/7.15.5 (x86_64-redhat-linux-gnu) libcurl/7.15.5 OpenSSL/0.9.8b zlib/1.2.3 libidn/0.6.5
> Host: localhost
> Accept: */*
>
< HTTP/1.0 200 OK
< Content-Type: audio/mpeg
< icy-br:16
< ice-audio-info: ice-samplerate=44100;ice-bitrate=16;ice-channels=2
< icy-br:16
< icy-description:...scanning...
< icy-genre:Scanning
< icy-name:live
< icy-pub:0
< icy-url:http://localhost
< Server: Icecast 2.3.2
< Cache-Control: no-cache
�����J���(�����
����Ftq�V�[H��P11���R���X��C,�SI�
�Q+8��B���(��
���
L�x▒�6��▒����K�▒qPHэ)yJ������(A@��2|�
�P�XML0��
Xnѱ��(����Rj B�;��ΙiG-@`���
�Hx�ڦ�O��H�b$ ���bc;���P\��g5��!�GH��242��s����(����ƾ�� B<P�Y!0�
��"s�x!6`��.o4"��9-
-bash-3.2#
|
It might be the metadata isn't being transferred. Is there a workaround on this? Can it be coded into the mount point, or is the meta data sent as a part of the stream?
This is from the error.log file:
| Quote: |
[2012-02-16 22:43:48] INFO connection/_handle_source_request Source logging in at mountpoint "/test-delay"
[2012-02-16 22:43:48] INFO source/source_main listener count on /test-delay now 0
[2012-02-16 22:43:48] INFO admin/admin_handle_request Received admin command metadata on mount "/test-delay"
[2012-02-16 22:43:48] INFO admin/command_metadata Metadata on mountpoint /test-delay changed to "-"
[2012-02-16 22:43:59] INFO source/source_shutdown Source "/test-delay" exiting
|
|
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Fri Feb 17, 2012 2:20 pm Post subject: |
|
|
based on the error log snippet there, it looks like ices is connecting and curl is retrieving content. I don't know of a way around the metadata issue unless you can use something like vlc to act as a reader and source client. I'm almost sure that ices only reads ID3 tags for metadata not icy metadata inserts.
karl. |
|
| Back to top |
|
 |
|