galbarm
galbarm

Reputation: 2543

Obtaining MP4 Creation Time from HTML5 video

Is there a way, in javascript, to obtain the creation time (a sub-field of the moov atom of an MP4 file) of a currently playing mp4 file in a video element?

The motivation is that the webclient should display OSD with absolute timestamps. Without the creation time field it has no knowledge of absolute timestamps and can only display time relative to the start time.

Upvotes: 2

Views: 929

Answers (1)

user1693593
user1693593

Reputation:

Unfortunately no. The browser will only read video and audio data from the MP4 file container and decode those. Other metadata such as duration is handled internally.

You could get around it by doing:

  • Prepare the file on server side using a filename containing the timestamp encoded in the name. Extract the timestamp from the container by the means necessary.
  • Supply meta-file to the mp4 file containing the datestamp which is read separately from client.
  • Load the file via XMLHttpRequest and manually parse the file to find the chunk containing the data. There are some problems with this of course such as risking having to load the entire file into memory.

Upvotes: 2

Related Questions