RecordRTC:在 mp4 容器而不是 matroska 中录制

Mat*_*tho 5 javascript webrtc recordrtc

我正在使用 RecordRTC 库来录制屏幕和音频。我需要 mp4 容器中的 h264 编解码器,但通过我的设置,我在 matroska 容器中获得 h264 编解码器。我正在使用以下代码:

this.captureUserMedia(screenConstraints, function(screenStream) {
            that.captureUserMedia(audioConstraints, function(audioStream) {
                var arrOfStreams = [screenStream, audioStream];

                var options = {
                    type: 'video',
                    mimeType: 'video/webm\;codecs=h264', // or video/webm\;codecs=h264 or video/webm\;codecs=vp9
                    audioBitsPerSecond: 192000,
                    recorderType: MultiStreamRecorder,
                    video: {
                        width: desiredWidth,
                        height: desiredWidth / screenAspectRatio
                    }
                };

                that.recorder = RecordRTC(arrOfStreams, options);

                that.recorder.startRecording();

                that.btnStopRecording.onclick = function () {
                    console.log("recording stopped");
                    that.recorder.stopRecording(that.postFiles.bind(that));
                }
            });
        });
    }
Run Code Online (Sandbox Code Playgroud)

RecordRTC 库可以吗?这是项目 github 上的问题,但他们推荐了我使用过的选项。是使用ffmpeg从matroska重新打包为mp4的唯一方法吗?