1

What I want to do:

  1. load a large opus file
  2. processing it using fluent-ffmpeg
  3. output a stream for further use (realtime output is required)

Runnable codes(file path needs to be changed):

const fs = require('fs');
const fluentffmpeg = require('fluent-ffmpeg');
var stream=fs.createReadStream("d:/PD_maid/music_temp/YTTemp/How many times do we have to teach you this lesson old man! (Cafe de touhou 1-8 albums)[RY7FpB9BZH4].opus")
var ffmpeg_audio_stream_C = fluentffmpeg(stream)

var streamOpt;
ffmpeg_audio_stream_C
    .toFormat('hls')
    .audioChannels(2)
    .audioFrequency(48000)
    .audioBitrate('1536k');

ffmpeg_audio_stream_C.on("error", (error) => {
    console.log("ffmpegErr" + error);
});
streamOpt = ffmpeg_audio_stream_C.pipe();

stream.on("data", (c) => {
    console.log("inp got data")
})
streamOpt.on("data", (c) => {
    console.log("Opt got data")
})

streamOpt.pipe(fs.createWriteStream("d:/PD_maid/music_temp/YTTemp/How many times do we have to teach you this lesson old man! (Cafe de touhou 1-8 albums)[RY7FpB9BZH4].hls"))

Expected result:

inp got data
inp got data
Opt got data
inp got data
Opt got data
......

And the output file should grow while processing the file

Result irl:

Lot of "inp got data" in several hours (memory usage growing here).

And Lot of "Opt got data" in a min after that.

It will have the expected result if the input is a .webm format file.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.