Node.js: realtime conversion from jpeg images to video file

后端 未结 3 570
轮回少年
轮回少年 2021-02-05 16:40

I\'m using node.js and through the socket.io library I receive chunks of data that are actually jpeg images. These images are frames of a realtime video captured from a remote w

3条回答
  •  萌比男神i
    2021-02-05 16:48

    FFMPEG supports streams as inputs, as stated in the docs.

    You can add any number of inputs to an Ffmpeg command. An input can be [...] a readable stream

    So for instance it supports using

    ffmpeg().input(fs.createReadStream('/path/to/input3.avi'));
    

    which creates a Readable stream from the file at '/path/to/input3.avi'.

    I don't know anything about FFMPEG, but you may pull your messages coming from socket.io (messages may be a Buffer already) and wrap it with your own implementation of Readable stream.

提交回复
热议问题