gpt4 book ai didi

php - 使用网络服务器录制广播/音频流 (asx/asf)

转载 作者:太空宇宙 更新时间:2023-11-04 09:07:06 24 4
gpt4 key购买 nike

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

我的目标是录制一个音频流,然后在听众打开时切掉其中的一部分,这样他们之后就可以听到自己(以及家人、 friend 等)的声音。

所以录制、上传、剪辑和发布会更好,因为我有一些志愿者愿意做剪辑部分(我认为我可以处理)。也许有我还没有找到的服务?

感谢任何回复。

最佳答案

我现在在这个网站上找到了它:http://www.freelists.org/post/darkice/Using-cron-and-wget-for-hourly-archiving-Was-Ogg-Recording-and-Cutting,1

以防万一:

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`

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 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.)

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).

Hope that helps.

Regards,

John

我已经通过录制 AAC(ASX 流发送 AAC 数据?- 不熟悉这些东西的工作原理或定义)和 MP3 流对其进行了测试。两者都录制得很好,VLC 播放也没有问题。然而,ASX 文件似乎损坏太多(从逻辑上讲,因为它是一个流,你参与其中)无法被已知的网络播放器(例如 JWPlayer/Longtail)播放。但 MP3 流的录制部分似乎不受此影响。

使用 MP3 与 AAC 的缺点 == 45Mb 与 12Mb(每小时 @96kbps - 我猜)。

希望能帮助别人解决 Johns 的问题。

关于php - 使用网络服务器录制广播/音频流 (asx/asf),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9010984/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com