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

Files not seekable #134

Closed
jech opened this issue Dec 25, 2020 · 4 comments
Closed

Files not seekable #134

jech opened this issue Dec 25, 2020 · 4 comments

Comments

@jech
Copy link

jech commented Dec 25, 2020

Galène (jech/galene) uses this package for saving videos to disk. It appears that the files are not terminated correctly:

  • when played back in a web browser or a media player, the files are not seekable;
  • mediainfo reports that the files are truncated.

Is this an intrinsic limitation of the library, or am I doing something wrong?

@at-wat
Copy link
Owner

at-wat commented Dec 31, 2020

To make seekable webm, SeekHead element (which contains position of Info/Track/Cues elements) must be put in front of the Segment.
And Cues element must contain video keyframes information and should be put before Clusters.
(https://www.webmproject.org/docs/container/#muxer-guidelines)

It usually requires two-pass processing as the contents of SeekHead and Cues are not deterministic at the point of writing them.
There is an implementation to make webm seekable (TypeScript): https://github.com/legokichi/ts-ebml#try-to-convert-a-mediarecorder-webm-to-seekable-webm
You can implement similar process using ebml-go. (My company internally has it.)

@jech
Copy link
Author

jech commented Dec 31, 2020

Thanks for the info, that's clear.

What about mediainfo indicating that the file is truncated?

@at-wat
Copy link
Owner

at-wat commented Jan 1, 2021

I don't know what mediainfo is actually saying, but I guess it says data size of Segment and Cluster elements are unknown. (https://github.com/ietf-wg-cellar/ebml-specification/blob/master/specification.markdown#unknown-data-size)
As webm.NewSimpleBlockWriter() is designed to use io.WriteCloser (without seek), size of Segment and Clusters are unknown when the size header is written to the stream.
To make webm seekable for all player, these data sizes must be known value.

@jech
Copy link
Author

jech commented Jan 1, 2021

Thanks a lot for your explanations. May I suggest that all of this should be documented.

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

2 participants