Nob*_*ody 8 command-line debian audio recording
我想在命令行上将程序的音频输出重定向到文件,例如
$ redirect-wrapper file.wav my-program
Run Code Online (Sandbox Code Playgroud)
以便
有没有办法做到这一点?这个相关的问题没有帮助,我需要一个命令行解决方案,没有“点击那里,然后在那里”。这大概也是相关的,但也依赖于图形应用程序pavucontrol。我找到了 pavucontrol 的终端替代品 pacmd。
但这仍然只能使以下妥协成为可能:
pacmd list-sinkspacmd set-default-sink。pacmd list-sink-inputs | grep name-of-my-program如果找到了一些东西,输入是打开的。pacmd set-default-sink.但这仍然会在长达几分钟的时间跨度内更改默认接收器(接收器输入通常不会打开,直到程序实际播放不需要在启动后立即播放的声音)。我实现了这个妥协;GitHub。
仍在寻找不妥协的答案。
嗯,看一下pulsaudio文档。
\n\nman pulseaudio
我们有以下环境变量
\n\n $PULSE_SERVER: the server string specifying the server to connect to when a client asks for a sound server connection and doesn\'t explicitly ask for a specific\n server. The server string is a list of server addresses separated by whitespace which are tried in turn. A server address consists of an optional address type speci\xe2\x80\x90\n fier (unix:, tcp:, tcp4:, tcp6:), followed by a path or host address. A host address may include an optional port number. A server address may be prefixed by a string\n enclosed in {}. In this case the following server address is ignored unless the prefix string equals the local hostname or the machine id (/etc/machine-id).\n\n $PULSE_SINK: the symbolic name of the sink to connect to when a client creates a playback stream and doesn\'t explicitly ask for a specific sink.\nRun Code Online (Sandbox Code Playgroud)\n\n这有望让您完全更换pulseaudio接收器,如果这还不够,请运行我们自己的一次性pulseaudio服务器。
\n\n参考此页面(https://askubuntu.com/questions/60837/record-a-programs-output-with-pulseaudio),我们找到了parec/pacat命令(它们是别名),它可以从接收器记录并写入接收器和溪流。
把它们放在一起,我们得到了以下包装器(我还没有实际运行 - 尽管我已经成功地让这个方法在临时基础上工作)
\n\nsink_name="sink-$(date +%s)"\npacat $sink_name.monitor \nparec -d steam.monitor | oggenc -b 192 -o /tmp/steam.ogg --raw - &\npid=$!\nPULSE_SINK=$sink_name "$@"\nkill $pid\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
4163 次 |
| 最近记录: |