6

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.

Daniel
  • 7,684
  • 7
  • 52
  • 76
  • 4
    I fixed thanks to package https://github.com/yusitnikov/fix-webm-duration/blob/master/fix-webm-duration.js, but I am surprised that it is done by low-level access to sections of webm binary. – Daniel Aug 28 '20 at 21:27
  • Related: https://stackoverflow.com/q/67041475/1066234 – Avatar Apr 13 '21 at 12:19

1 Answers1

1

The solution proposed by daniel works like a charm, which was to use the library from https://github.com/yusitnikov/fix-webm-duration to add the duration metadata to the webm Blob.

Kernel James
  • 3,752
  • 25
  • 32