Closed giannik closed 1 month ago
Hi! The reason for passing duration as argument is because of the way browser records a webm file. The duration of the video supposed to be in the start of the file, but browser cannot know the duration in advance, so it just doesn't include the duration in the file. So we need to measure it manually and add it to the file manually. That's exactly the issue that the current repo fixes. The library can't be used to retrieve the FPS, but you probably can know it in advance (approximately) by accessing the properties of the media stream you use to record the video.
thank you for your response. can you elaborate on how to get the fps value from a webm file ?. im struggling with this.
Looks like there's a "FrameRate" header in the file format, according to the spec. But I don't know if it's the FPS or not, and I don't know if browser actually adds it or not when recording. I don't even know if FPS is constant or dynamic for webm files... You can try adding a breakpoint after file = new WebmFile
and inspecting the contents of the file in the debugger to check if the file contains what you need.
Again, getting the FPS is not the purpose of the library, but you could use the code as a basis for breaking the webm structure apart and create your own package for that.
But it would be much easier to just know the approximate FPS in advance by accessing the stream's settings, e.g. stream.getVideoTracks()[0].getSettings().frameRate
Just recorded a webm file from a browser, and the header section looked like this:
So I don't believe that the file contains any information about the framerate.
Hello, My use case is i want to to have a screen recordered .webm file and extract the duration and fps value to do some processing. Up till now i had to convert to mp4 to get fps which was time consuming.