Webm file could not play when MediaRecorder on Chrome does not provide the cluster?

ぃ、小莉子 提交于 2020-06-29 05:15:13

问题


Background: I need to play each webm file individually which are created by MediaRecorder

According to Brad’s suggestion, we need to split the data on the cluster element 0x1F43B675, and prepend everything before the first cluster to a later cluster

I have splitted the data on cluster instances, and made a webm file with header(data before first cluster) and splitted data. For this what I am doing inside the ondataavailable of MediaRecorder API,

 // below  statements would be executed from second invocation of ondataavailable

 1. Get binary data from blob 
 2. Check if cluster is found on data, if yes
      a) Split the actual data and cluster 
      b) Make the the webm file with headerData, previousData and new actual data 
      c) Store the new splitted data (data after cluster) to previousData 
 3. If cluster isn't found, store complete actual data to previousData(for step 2b)

So with the above steps I have created webm files which have header, cluster and actual data.

The cluster is not found when the ondataavailable is triggered every 5 seconds. In this case, the created webm files do not play correctly. There are few problems, for example, the duration of video is 10 seconds, but it would be stuck after playing 5 seconds. There is also synchronization problem between audio and video.

However if I set ondataavailable to trigger on each 11 seconds. I get the cluster on each invocation of ondataavailable and the created webm files would play without any problem.

In short, if I get the cluster and each invocation of ondataavailable, then the webm file plays well, otherwise the problem occurs.

My questions are:

Is there any way to create the cluster data on each ondataavailable invocation when slicing time is 5 to 7 seconds ?

To play the webm file that is created under 5 to 7 seconds, shall I need to do something on video data, like muxing, adjusting/encoding or etc?

来源:https://stackoverflow.com/questions/62302652/webm-file-could-not-play-when-mediarecorder-on-chrome-does-not-provide-the-clust

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!