我正在使用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));
}
});
});
}
RecordRTC库是否可行?这是issue on project's github,但他们推荐我使用的选项。是使用ffmpeg从matroska重新打包到mp4的唯一方法吗?