使用网络服务器记录广播/音频流(asx/asf) [英] Record radio / audio stream (asx/asf) with a webserver

查看:107
本文介绍了使用网络服务器记录广播/音频流(asx/asf)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让PHP(或在Linux网络服务器上运行的任何东西)记录(广播电台的)音频流?是的,我已经寻求了很多东西,但是我似乎找不到类似的东西,尽管我坚信我不能成为第一个-对吗?

Is there a way I get PHP (or anything that runs on a linux webserver) to record a (radiostation's)audiostream? Yes, I have sought a lot, but I can't seem to find anything like it, though I'm convinced I can't be the first one - right?

我的目标是录制音频流,然后在听众打开时对其进行斩波,以便他们以后可以听自己(以及家人,朋友等).

My goal is to record an audiostream and then chopping parts of it when listeners are on, so they can listen to themselves afterwards (and family, friends and so on).

因此,记录,上载,切碎和发布会更好,因为我有一些志愿者愿意切碎(我想我可以照顾).也许有一项我尚未找到的服务?

So recording, uploading, chopping and publishing would be nicer as I have some volunteers willing to do the chopping part (that I think I can take care of). Maybe there is a service I haven't found (yet)?

感谢任何依赖的人.

推荐答案

我现在在以下站点上发现了它:

I've found it now on this site: http://www.freelists.org/post/darkice/Using-cron-and-wget-for-hourly-archiving-Was-Ogg-Recording-and-Cutting,1

以防万一:

以下bash shell由cron在小时内启动:

The following bash shell is launched on the hour by cron:

#!/bin/bash
#Go to the archive directory:
cd /aa/icecast/archive
#Stop the archiving for the last hour:
kill `cat archivePID`

#Start recording in the background (&) a new archive file of the stream "http://127.0.0.1:8000/stream.ogg":
wget http://127.0.0.1:8000/stream.ogg &

#Get the Process IS for the job we just started:
echo $! > archivePID

#Wait a few seconds to make sure the job has started and the archive file has been opened:
sleep 5

#Rename the current archive file to a name based on the date and time (YYYYMMDD-HHMM.ogg):
mv stream.ogg `date +%Y%m%d-%H%M.ogg`

此命令在我们的Icecast盒子上运行,并通过以下方式从icecast中拾取流 本地IP 127.0.0.1,但可以从任何Internet连接运行 框(通过将127.0.0.1:8000更改为流的网址).

This runs on our icecast box and picks up the stream from icecast via the local IP 127.0.0.1, but it could run from any Internet-connected box (by changing 127.0.0.1:8000 to the url of the stream).

Wget打开一个与输入流同名的输出文件 (在我们的示例中为"stream.ogg").但是几秒钟后,脚本 根据当前日期和时间将文件重命名为一个名称. (Wget 忽略了这一点,因为它正在写入一个打开的文件句柄,而不是 而不是文件名.)

Wget opens an output file with the same name as the input stream ("stream.ogg" in our case). But a few seconds later, the script renames the file to a name based on the current date and time. (Wget is oblivious to this since it is writing to an open file handle rather than the file name.)

请注意,我们的流采用ogg格式,并命名为"stream.ogg",并且 Shell脚本反映了这一点.如果您的流是mp3格式的,或者是命名 除了stream.ogg之外,您需要更改脚本 相应地(特别是wget命令和mv命令).

Note that our stream is in ogg format and is named "stream.ogg", and the shell script reflects that. If your stream is in mp3, or is named anything other than stream.ogg, you'll need to change the script accordingly (specifically the wget command and the mv command).

希望有帮助.

此致

约翰

我已经通过记录AAC(发送AAC数据的ASX流?-不熟悉这些东西的工作或定义)和MP3流进行测试.两者都记录良好,VLC播放时没有问题.但是,ASX文件似乎被损坏(从逻辑上讲,因为它是您要参加的一个流),无法被已知的网络播放器(例如JWPlayer/Longtail)播放.但是MP3流的录制部分似乎不受此影响.

I've tested it with recording an AAC (ASX stream sent AAC-data? - not familiar with how this stuff works or defined) and a MP3 stream. Both recorded fine and VLC had no problem with playing it. However, the ASX-file seems to be too damaged (logically, as it is a stream which you get a party of) for playback by known webplayers (e.g. JWPlayer / Longtail). But the recorded parts of the MP3 stream don't seem to be affected by that.

使用MP3和AAC的缺点== 45Mb vs 12Mb(每小时@ 96kbps,我想).

Downside on the use of MP3's vs AAC == 45Mb vs 12Mb (per hour @96kbps - I guess).

希望能帮助某人帮助约翰斯在这里工作.

Hope to help someone with putting Johns work out here.

这篇关于使用网络服务器记录广播/音频流(asx/asf)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆