无法使用recordRTC to webm录制高于30帧/秒的视频。摄像机能够以所需的分辨率1920x1080以60fps的速度进行记录。有关于如何完整记录60帧/秒的想法吗?
var options = {
mimeType: 'video/webm',
video: {
width: 1920,
height: 1080
},
bitsPerSecond: 51200000,
frameRate: 60
};
this.stream = stream;
this.recordRTC = RecordRTC(stream, options);发布于 2018-05-18 12:25:18
请尝试以下操作:
<script src="https://cdn.webrtc-experiment.com/RecordRTC.js"></script>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
<button id="btn-record">Click To Record</button>
<hr>
<video id="your-video" autoplay playsinline controls style="width: 50%; border-adius: 9px;"></video>
<script>
var recorder;
var yourVideo = document.getElementById('your-video');
document.getElementById('btn-record').onclick = function() {
this.disabled = true;
this.style.background = 'transparent';
this.style.color = 'grey';
var cameraProperties = {
video: {
width: 1920,
height: 1080
},
audio: true
};
navigator.mediaDevices.getUserMedia(cameraProperties)
.then(function(cameraStream) {
yourVideo.volume = 0;
yourVideo.srcObject = cameraStream;
recorder = RecordRTC(cameraStream, {
videoBitsPerSecond: 51200000,
mimeType: 'video/webm'
});
recorder.startRecording();
setTimeout(function() {
recorder.stopRecording(function() {
var blob = recorder.getBlob();
alert('Recording size: ' + bytesToSize(blob.size));
var videoURL = URL.createObjectURL(blob);
yourVideo.srcObject = null;
yourVideo.volume = 1;
yourVideo.src = videoURL;
});
}, 5000);
}).catch(function(error) {
console.error('Unable to capture 1080p', error);
alert('Maybe 1080p is not supported by your camera. Please check yoru console logs.');
});
};
</script>https://stackoverflow.com/questions/50396113
复制相似问题