Open hcglitte opened 3 weeks ago
Hi @hcglitte, I'm trying to understand your issue, so if I miss something, please let me know. For starters, there's no guarantee that onReady
will be called at the beginning of the file. The metadata (i.e., moov
) doesn't have to be at the beginning of the file. So, it's expected that arrayBuffer
wants the entire file.
Therefore, there is no official way to get around that (see the relevant code below). However, you could append zeros before and after your samples to trick MP4Box.js into extracting your samples. But then, why not just use the offset and size information you already have?
Hi,
I am using FileReader() to read an mp4 file in chunks. Initially I read enough of the start of the file to load the metadata in order for onReady(info) to be called.
After this I would like to only read a specific byte range of this mp4 source file which corresponds to a given set of samples. I know the offsets and sizes for the samples, so I can read at the correct location with FileReader().
The problem seems to be that appendBuffer(arrayBuffer) needs to process the whole mp4 file from the start of the file to the end of the file. I am not sure if this assumption is correct?
Preferably I would like to read appendBuffer(arrayBuffer) with arrayBuffer.fileStart = offset at the starting point corresponding to my set of sampels. Then I would imagine that onSamples is called with the samples I have "requested".
Is there any way to achieve this? In this case, how can I do it?