performance - Licode Erizo.Stream Video Frame quality -
i utilize licode open source webrtc communications platform. want cut down video quality (video-frame bits size).
the stream looks this:
var stream = erizo.stream({ audio:true, video:video_constraints, data: true, attributes: {name:'mystream', type:'public'} }); it possible videoframe :
var bitmap; var canvas = document.createelement('canvas'); var context = canvas.getcontext('2d'); canvas.id = "testcanvas"; document.body.appendchild(canvas); setinterval(function() { bitmap = stream.getvideoframe(); canvas.width = bitmap.width; canvas.height = bitmap.height; context.putimagedata(bitmap, 0, 0); }, 100); and send canvas (one video frame):
var bitmap; var canvas = document.createelement('canvas'); var context = canvas.getcontext('2d'); setinterval(function() { canvas.width = video.clientwidth; canvas.height = video.clientheight; context.drawimage(video, 0, 0, canvas.width, canvas.height); mydata = canvas.todataurl("image/jpeg"); erizostream.senddata({ base64:mydata}); }, 200); the erizostream.senddata({ base64:mydata}); useless speed performance.
it sends info fast when receiving has issues animation:
stream.addeventlistener("stream-data", function(evt){ //alert('received info '+ evt.msg['base64']); if(evt.msg['base64']){ renderbase64(evt.msg['base64']); } }); the set setinterval time 200ms makes sending goes fast. goes faster when open page(tab) in new window.
i want cut down video frame (bits size) without using erizostream.senddata();. video or using solving speed performance issue.
when publishing room..
room.publish(localstream, {maxvideobw: 300}); it possible add together maxvideobw, sets max video bandwidth 300 kbps. reduces quality value become bandwidth value.
and don't forget alter maxframerate:
var video_constraints = {mandatory: { maxframerate:30 }, optional: [ ] }; as illustration compute :
if have 30 frame per second, , bandwidth 300 kbps:
then using 300/30 = 10 kb/sec uploading.
by reducing bw 35 can solve the speed performance issue.
quality control
performance video-streaming html5-video webrtc licode
No comments:
Post a Comment