fluent-ffmpeg/node-fluent-ffmpeg

Is possible to input a media stream / media stream tracks?

Seikon opened this issue · 0 comments

I was wondering if it could be possible set input as a MediaStream or MediaStreamTrack object and output to video or hls server, etc. like this:

const mediaStream = event.streams[0];

    // Extract video and audio tracks from the media stream
    const videoTrack = mediaStream.getVideoTracks()[0];
    const audioTrack = mediaStream.getAudioTracks()[0];

    // Create FFmpeg process to generate HLS stream
    const ffmpegCommand = ffmpeg()
        .input(videoTrack)
        .input(audioTrack)
        .videoCodec('copy')
        .audioCodec('aac')
        .format('hls')
        .outputOptions([
            '-hls_time 10',
            '-hls_list_size 6',
            '-hls_segment_filename output_%03d.ts',
            'output.m3u8'
        ])
        .output('output.m3u8');