Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streaming reads #53

Open
lolgesten opened this issue Apr 8, 2021 · 2 comments
Open

Streaming reads #53

lolgesten opened this issue Apr 8, 2021 · 2 comments

Comments

@lolgesten
Copy link

Hi! Thanks for writing this lib!

Have you thought about the case of streaming reads? It seems the API is centered around Mp4Reader::read_sample(track_id, sample_id) which in turn delegates to Track::read_sample. Reading the code it seems the latter assumes a reader.seek(SeekFrom::Start(sample_offset))?;

With very large files, or continuous TS-streams, it's not necessarily practical to assume the whole things can be wrapped in a BufReader.

Would it be possible to extend the API somehow to have more of a "read-next-sample-whatever-it-is" approach? Happy to contribute a PR.

@alfg
Copy link
Owner

alfg commented Apr 8, 2021

Hey @lolgesten,

Thanks for the input and suggestion. I admit most of the sample bytes I have worked with have been small enough to be wrapped into a buffer when reading each sample, but I agree it can be improved.

I would appreciate a PR if you have the time for it. :)

@DCNick3
Copy link
Contributor

DCNick3 commented Feb 14, 2023

Just to not: generally, I think, mp4 is not really designed to be streamable =(

There are some things that can be done to make it so: https://trac.ffmpeg.org/wiki/HowToCheckIfFaststartIsEnabledForPlayback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants