我正在使用Node.JS Discord机器人在RTP上流式传输语音呼叫。目前,在我的speaking事件处理程序中,我有
var cmd = child_process.spawn("ffmpeg", [
'-protocol_whitelist', 'file,crypto,sdp,rtp,udp,pipe,opus',
'-re',
'-acodec', 'opus',
'-i', '-',
'-ar', '8000',
'-acodec', 'pcm_mulaw',
'-f', 'mulaw',
'-f', 'rtp',
`rtp://${rtp_ip}:${rtp_port}`]);
reciever.createOpusStream(user).pipe(cmd.stdin);相当于运行ffmpeg命令ffmpeg -protocol_whitelist file,crypto,sdp,rtp,udp,pipe,opus -re acodec opus -i - -ar 8000 -acodec pcm_mulaw -f mulaw -f rtp rtp://${rtp_ip}:${rtp_port}
此命令的变体会产生从pipe:: Invalid input或pipe:: Invalid argument到Invalid data on input.再到[mp3 @ 0x5615decebe60] Format mp3 detected only with low score of 1, misdetection possible! [mp3 @ 0x5615decebe60] Failed to read frame size: Could not seek to 16101.的各种错误。有人能帮我发送一个ReadableStream (opus)到RTP mulaw流吗?谢谢!
发布于 2018-08-16 08:27:50
我在ffmpeg IRC上询问,并意识到原始Opus位流无法解码。相反,我传入了一个原始的PCM流,并在输入中添加了-f s32le,它在ffmpeg -formats中以一种格式列出。
https://stackoverflow.com/questions/51833483
复制相似问题