frameflow icon indicating copy to clipboard operation
frameflow copied to clipboard

duration is always 0 for web recorded media

Open nick-delirium opened this issue 1 year ago • 2 comments

const video = await fflow.source(videoBlob());
console.log(video.duration, video.metadata.tracks);
// 0, then two streams, each has 0 as duration

which later becomes a problem:

const result = await video
      .trim({ start: 5, duration: 5 })
      .exportTo(Blob, { format: "webm" });

Will trim from 5th second to end of the video instead of next 5 seconds, ignoring duration because here it will be Math.min(5 + 0, 0 + 0)

Can you point to any synthetic solution for now on? Otherwise, library is fantastic, thank you.

additional details: I'm trying to trim webm video with vp9+opus codecs, its a basic browser tab recording done via mediaRecorder, then transported as base64 string into another part of the application and back to blob before being put into fflow.source

nick-delirium avatar Jun 24 '24 14:06 nick-delirium

Actually I'm pretty sure this is the same issue that's causing 0 duration mediaRecorder webms in Chrome browser. There are some libraries that fix it, that this just causes more issues with this library, although it parses duration correctly after fixing

image image

nick-delirium avatar Jun 24 '24 15:06 nick-delirium

Yes, you are right. It's Chrome's problem. In this library, frameflow can directly receive stream of frames and encode to mp4 file. Like this example: https://github.com/carsonDB/frameflow/blob/main/examples/browser/codec.html#L51

carsonDB avatar Jun 27 '24 02:06 carsonDB