Here is a SO posting which shows how to inhale an entire MP4 (stored locally), then discover its length:
public static long getAudioLength(byte[] content) throws Exception {
IsoFile isoFile = new IsoFile(new MemoryDataSourceImpl(content));
double lengthInSeconds = (double)isoFile.getMovieBox().getMovieHeaderBox().getDuration() / isoFile.getMovieBox().getMovieHeaderBox().getTimescale();
return (long)lengthInSeconds;
}
I need to parse large MP4s stored on AWS S3 and obtain their length by reading a minimum of data. S3 has an API that allows a file to read as a Stream. An implementation of DataSource that knows how to handle a data stream seems like a way to accomplish the goal.
Seems it would be a generally useful feature to be able to obtain MP4 metadata from a Stream, and read the minimum number of bytes necessary. Is anyone interested in writing the DataSource subclass?
Related issues: #195 (Get total number of frames/video length of a mp4.file) and #196 (Support of parsing MP4 arriving as a stream).
Here is a SO posting which shows how to inhale an entire MP4 (stored locally), then discover its length:
I need to parse large MP4s stored on AWS S3 and obtain their length by reading a minimum of data. S3 has an API that allows a file to read as a Stream. An implementation of
DataSource
that knows how to handle a data stream seems like a way to accomplish the goal.Seems it would be a generally useful feature to be able to obtain MP4 metadata from a Stream, and read the minimum number of bytes necessary. Is anyone interested in writing the
DataSource
subclass?Related issues: #195 (Get total number of frames/video length of a mp4.file) and #196 (Support of parsing MP4 arriving as a stream).