Closed azertyalex closed 2 years ago
I managed to do this with following code
void start() {
virt_mic = new std::ofstream("/tmp/virtmic", std::ios::out | std::ios::binary);
std::thread t([=, this]() {
cmd = new subprocess::popen(
"ffmpeg",
{"-re", "-i", "-", "-f", "s16le", "-ar", "48000", "-ac", "1", "-"},
*virt_mic);
while (true) {
if (!packets.empty()) {
cmd->stdin().write(packets.front().data, packets.front().size);
delete packets.front().data;
packets.pop();
}
}
});
t.detach();
};
`
Cool, great that you sorted it out 👍
I create an ffmpeg process which needs to write to
/tmp/virtmic
, how can I redirect the output?Bash equivalent: