Live streaming using FFMPEG to web audio api

前端 未结 2 1436
萌比男神i
萌比男神i 2021-01-13 00:13

I am trying to stream audio using node.js + ffmpeg to browsers connected in LAN only using web audio api.

Not using element because it\'s adding it\'s own buffer of

相关标签:
2条回答
  • 2021-01-13 00:19

    I got it working !!

    All I had to do is adjust the number of channel.

    I've set FFMPEG to output mono audio and it worked like a charm. Here is my new FFMOEG command:

    var ffmpeg = child_process.spawn("ffmpeg",[
        "-re","-i",
        "A.mp3",
        "-ac","1","-f",
        "f32le",
        "pipe:1"                     // Output to STDOUT
        ]);
    
    0 讨论(0)
  • 2021-01-13 00:26

    You are taking chunks of data, creating separate nodes from them, and starting them based on network timing. For audio to sound correct, the playback of buffers must be without break, and sample-accurate timing. You need to fundamentally change your method.

    The way I do this is by creating a ScriptProcessorNode which manages its own buffer of PCM samples. On process, it reads the samples into to the output buffer. This guarantees smooth playback of audio.

    0 讨论(0)
提交回复
热议问题