将原始 PCM 流转换为 wavs (cli)
我需要一个程序,可以将原始 PCM 流传输到其中,并将 wav 文件发送到标准输出。
由于输入是一个流,我不能只向其中添加标头,但我可以每隔 x 秒(例如,程序读取十秒的流,并输出一个十秒长的 wav文件,读取接下来的十秒,输出一个 wav 文件,等等)。
有没有一个程序可以做到这一点?它需要在 Linux 上运行。
I need a program that I can pipe a raw PCM stream into, and will send wav files to stdout.
Since the input is a stream, I can't just add headers to it, but I can for every x
seconds (For example, program reads ten seconds of the stream, and outputs a ten second long wav file, reads the next ten seconds, outputs a wav file, and so on).
Is there a program that can do this? It needs to run on Linux.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
查看sox,声音处理的瑞士军刀。
Check out sox, the Swiss Army knife of sound processing.
这是一个编写起来非常简单的程序,事实上,如果您可以保证每个波形文件中的 PCM 数据字节数完全相同,您只需为此预先创建一个标准波形文件头即可PCM 数据量,然后只是
cat wavehdr + chunk-of-streamdata
This is a dead simple program to write, in fact, if you can guarantee exactly the same number of bytes of PCM data in each wave file, you can just pre-create a standard wave file header for that amount of PCM data and then just
cat wavehdr + chunk-of-streamdata
mplayer 非常适合此类任务。它带有两个界面,mencoder 和 mplayer。 mencoder 作为您想要将原始 pcm 转换为各种声音格式的所有命令行开关。
它还附带了一个很长的手册页,很好地解释了所有选项。
mplayer is quite good for this kind of tasks. It comes with two interface, mencoder and mplayer. mencoder as all the command line switch you want to transform raw pcm into various sound format.
It also come with a very long man page that explains all the options quite well.