简体   繁体   English

从 HTML5 视频中获取 MP4 创建时间

[英]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?有没有办法在javascript中获取视频元素中当前播放的mp4文件的创建时间(MP4文件的moov原子的子字段)?

The motivation is that the webclient should display OSD with absolute timestamps.动机是 webclient 应该显示带有绝对时间戳的 OSD。 Without the creation time field it has no knowledge of absolute timestamps and can only display time relative to the start time.如果没有创建时间字段,它不知道绝对时间戳,只能显示相对于开始时间的时间。

Unfortunately no.抱歉不行。 The browser will only read video and audio data from the MP4 file container and decode those.浏览器只会从 MP4 文件容器中读取视频和音频数据并对其进行解码。 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.将元文件提供给包含从客户端单独读取的日期戳的 mp4 文件。
  • Load the file via XMLHttpRequest and manually parse the file to find the chunk containing the data.通过 XMLHttpRequest 加载文件并手动解析文件以查找包含数据的块。 There are some problems with this of course such as risking having to load the entire file into memory.这当然存在一些问题,例如必须将整个文件加载到内存中的风险。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM