From where in an AVI file can I extract the recorded date?

断了今生、忘了曾经 提交于 2019-12-24 00:36:09

问题


The problem explained

I am trying to extract the recorded date from some AVI files (in this particular case created with a Sony DV camcorder).

Starting with no knowledge on the format, I have been able to make sense of the metadata in the main chunks in the file using this reference: https://msdn.microsoft.com/en-us/library/windows/desktop/dd318189(v=vs.85).aspx

I been searching a lot to find out where the date is stored, but without any luck. The closest that I came was the following answer from the MediaInfo forum, but I didn't manage to make enough sense out of it to solve the problem: https://sourceforge.net/p/mediainfo/discussion/297610/thread/8bb6e526/

I know that the recorded date is in the file metadata somewhere, because Sony's PlayMemories is able to display it, and the same is MediaInfo.

What I need to find out is the details on how the recorded date is stored in the file:

  1. in which chunk
  2. at what offset
  3. in what format

Any help on this would be highly appreciated. :)

I have extracted a list of the chunks in the file that I am testing on (see below listing), but I am not sure what chunk the date is stored in.

<RIFF - AVI  - size="11969600" offset="0">
  <LIST - hdrl - size="33330" offset="12">
    <avih size="56" offset="24"></avih>
    <LIST - strl - size="16500" offset="88">
      <strh size="56" offset="100"></strh>
      <strf size="40" offset="164"></strf>
      <indx size="16376" offset="212"></indx>
    </LIST>
    <LIST - strl - size="16478" offset="16596">
      <strh size="56" offset="16608"></strh>
      <strf size="18" offset="16672"></strf>
      <indx size="16376" offset="16698"></indx>
    </LIST>
    <LIST - odml - size="260" offset="33082">
      <dmlh size="248" offset="33094"></dmlh>
    </LIST>
  </LIST>
  <JUNK size="1446" offset="33350"></JUNK>
  <LIST - movi - size="11932228" offset="34804">
    <00db size="144000" offset="34816"></00db>
    <01wb size="5120" offset="178824"></01wb>
    ...            
    <00db size="144000" offset="11816560"></00db>
    <01wb size="5120" offset="11960568"></01wb>
    <ix00 size="664" offset="11965696"></ix00>
    <ix01 size="664" offset="11966368"></ix01>
  </LIST>
  <idx1 size="2560" offset="11967040"></idx1>
</RIFF>

Heuristic approach?

I have also been thinking that since I know the date for the file I am testing on, then maybe I somehow could be able to search for it in the binary file to locate the byte location(s) that way. However, then I would first need to know (or guess) what kind of binary format the date is stored in. For the file I am testing on, the date is reported as "2007-08-12 12:30:27.000" in MediaInfo (as in PlayMemories). Any suggestions on how to search for the date in the binary file would also be appreciated.

Additional information / test results

I have found out by examination that the date is not stored in the JUNK chunk, as that is completely blank (all zeros).

I have also tried to search for the date in the binary file in various ways (using the HxD hex editor), but with no luck:

  • Searched for "2007" as integer - only one occurence in the movi chunk - should not be it (had no effect when modified)
  • Searched for "2007" as floating-point - no occurences
  • Searched for "2007" as ascii string - no occurences
  • Searched for "2007" as hex string - only one occurence in the movi chunk - should not be it (had no effect when modified)
  • Searched for the date ("2007-08-12 12:30:27.000") as a unix time stamp ("1186921827") as integer and float - no occurences

Gut feeling

I know it is not in this chunk: JUNK

I don't expect it to be in any of these chunks: hdrl, avih, strl, strh, strf

If so, then it should be in one of these: indx, odml, dmlh, (movi, idx1)

Current status

I have basically not been able to find out how and where the date is stored, so my problem remains unsolved...

The fact that my binary searches gave no results has left me a bit puzzled...

Any help would be highly appreciated. :)


回答1:


Under Linux you could try avprobe which is part of libav (https://libav.org/download/). Look there at creation_time:

avprobe capture.mp4
avprobe version 9.18-6:9.18-0ubuntu0.14.04.1+fdkaac, Copyright (c) 2007-2014 the Libav developers
  built on Apr 10 2015 23:22:24 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'capture.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isom
    creation_time   : 2016-03-24 12:31:18
  Duration: 01:22:33.57, start: 0.000000, bitrate: 1957 kb/s
    Stream #0.0(eng): Video: h264 (Main), yuv420p, 960x540 [PAR 1:1 DAR 16:9], 1764 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc
    Metadata:
      creation_time   : 2016-03-24 12:31:18
    Stream #0.1(deu): Audio: aac, 48000 Hz, stereo, fltp, 189 kb/s
    Metadata:
      creation_time   : 2016-03-24 12:31:18
# avprobe output


来源:https://stackoverflow.com/questions/36899431/from-where-in-an-avi-file-can-i-extract-the-recorded-date

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!