I’m working in node js video streaming web application I would like to upload the video and get the buffer data using multer package and convert the buffer video data into m3u8 format and store it in server For converting m3u8 format am using ffmpeg Here I found the issue when handling the buffer data using ffmpeg It is possible to use input in ffmpeg as buffer data If it is possible kindly share reference link or code Thank you
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hello,
FFmpeg can handle buffer data, but it requires a bit of setup when working within a Node.js environment. When you upload a video using Multer, you receive the video file as a buffer. To convert this buffer into an
m3u8
format using FFmpeg, you can’t directly pass the buffer to FFmpeg. Instead, you need to handle the buffer in a way that FFmpeg can process it.One common approach in such cases is to save the buffer to a temporary file and then use that file as the input for FFmpeg.
After the conversion, you can then delete the temporary file.
Here’s a basic outline of how you can achieve this:
fs
module for this.m3u8
format. Here’s how you might do it in Node.js:This script first saves the buffer as a temporary file, then uses FFmpeg to convert that file to
m3u8
format, and finally deletes the temporary file. That way you don’t store any temp files on the server after this is done.Regarding direct buffer processing without a temporary file, FFmpeg doesn’t directly support buffers as input, so the above approach is a practical way to handle your use case in Node.js.
If you have any more questions or need further clarification, feel free to ask!
Best,
Bobby