How to add duration to metadata of files recorder by MediaRecorder

Viewed 1968

I am recording video by MediaRecorder in Chrome. My code is similar to an example from MediaStream docs. I am receiving videos that do not have Duration metadata.

I compared it by mediainfo with exemplary webm file from:

https://file-examples-com.github.io/uploads/2020/03/file_example_WEBM_480_900KB.webm

On the left, there are metadata of file recorded by MediaRecorder, on the right from the exemplary webm file.

enter image description here

Detailed comparison on DiffChecker

https://www.diffchecker.com/87G23lbX

There are three key differences:

In the file from MediaRecorder:

  1. there is lacking Duration.
  2. there is lacking Bit rate.
  3. there is added IsTruncated: Yes.

In effect when I add this file to the video tag on website with controls attribute, then I can use controls only when file is displayed to the end.

I need to fix it and save non truncated files with this duration. Both frontend and backend solutions are accepted.

0 Answers
Related