Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Seikon opened this issue Mar 26, 2024 · 0 comments
Open

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

Seikon opened this issue Mar 26, 2024 · 0 comments

Comments

@Seikon
Copy link

Seikon commented Mar 26, 2024

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');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant