如何流WAV文件? [英] How to stream a WAV file?

查看:236
本文介绍了如何流WAV文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个应用程序,我录音并上传音频文件在Web上。为了加快上传我要开始上传之前,我已经完成了录制。

I'm writing an app where I record audio and upload the audio file over the web. In order to speed up the upload I want to start uploading before I've finished recording.

我创建的文件是一个WAV文件。我的计划是使用多个数据块。因此,而不是正常的编码(RIFF,格式化,数据),我使用(RIFF,格式化,数据,数据,...,数据)。第一个问题是,RIFF头想整个文件的总长度,但是这当然是流式音频(我现在使用任意数量)不知道的。另一个问题是,我不知道这是否是有效的,因为无畏无法识别该文件,和Windows Media Player打开该文件,但只起很小的一部分。我一直在阅读WAV规格,但还没有找到答案。

The file I'm creating is a WAV file. My plan was to use multiple data chunks. So instead of the normal encoding (RIFF, fmt , data) I’m using (RIFF, fmt , data, data, ..., data). The first issue is that the RIFF header wants the total length of the whole file, but that is of course not known when streaming the audio (I’m now using an arbitrary number). The other problem is that I'm not sure if it's valid since Audacity doesn't recognise the file, and Windows Media Player opens the file but plays only a very small part. I've been reading WAV specs but haven’t found an answer.

有什么建议?

推荐答案

您只需要使用支持,而无需编辑标题附加一种容器格式。

You will just have to use a container format that supports appending without editing the header.

我建议原始PCM样本。它们可以被转换成随意别的

I suggest Raw PCM samples. They can be converted to anything else at will.

无畏将导入原始字节从文件 - >导入 - >原始数据菜单

Audacity will import raw bytes from the File -> Import -> Raw Data menu.

另一种选择可能是一种无损音频codeC如FLAC一个流化容器格式内。 (正如捷克网络电台做)

Another option might be a lossless audio codec such as FLAC inside of a streamable container format. (As done by a Czech web radio station)

我注意到VLC CAN通讯preSS和流FLAC,在OGG从声卡。应该从有一个简单的步骤,存储或uncom preSS在服务器端的数据流。

I notice VLC can compress and stream FLAC-in-OGG from the soundcard. Should be a simple step from there to store or uncompress the stream on the server end.

这篇关于如何流WAV文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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