How do I find the date a video (.AVI .MP4) was actually recorded?

前端 未结 8 700
情话喂你
情话喂你 2021-01-01 11:50

properties> date created... I thought this meant the date the video was created, but finally realized that date changes every time I move, reorganize, even open a file. o

相关标签:
8条回答
  • There doesn't seem to be a well defined standard for video metadata (compared to photos and audio files, which have EXIF and ID3/etc. respectively)

    Some tags exists like e.g. Title, Composer etc. You can see those if you select a movie file in Windows 7 (perhaps earlier versions also) explorer or right click and view properties. I have not found a tag for recording date unfortunately - the closest thing available is Year (integer) :-(

    Programatically, you can read and write most of these tags in .NET using Taglib Sharp from the mono project. Source and binaries are available on the banshee FTP server. It has a pretty impressive list of formats it supports (but still, make sure you catch exceptions when trying to read or write tags - it will throw whenever it finds a file it cannot understand, something which happened to me several times for my modest collection of home recordings.)

    To read tags:

    using (var f = TagLib.File.Create(@"c:\Path\To\MyVideo.mp4"))
    {
        if (f.Tag != null)
        {
            string title = f.Tag.Title;
            Size resolution = new Size(f.Properties.VideoWidth, f.Properties.VideoHeight);
            int year = f.Tag.Year;
            // etc.
        }
    }
    

    And similarly, to write metadata back to the file:

    using (var f = TagLib.File.Create(@"c:\Path\To\MyVideo.mp4"))
    {
        f.Tag.Title = "My Awesome Movie";
        f.Tag.Year = (uint)2011;
        f.Save();
    }
    
    0 讨论(0)
  • 2021-01-01 12:25

    For me the mtime (modification time) is also earlier than the create date in a lot of (most) cases since, as you say, any reorganisation modifies the create time. However, the mtime AFAIUI is an accurate reflection of when the file contents were actually changed so should be an accurate record of video capture date.

    After discovering this metadata failure for movie files, I am going to be renaming my videos based on their mtime so I have this stored in a more robust way!

    0 讨论(0)
  • 2021-01-01 12:40

    Quick Command for Finding Date/Time Metadata in Many Video Files

    The following command has served me well in finding date/time metadata on various AVI/MP4 videos:

    ffmpeg -i /path/to/video.mp4 -dump
    

    Note: as mentioned in other answers, there is no guarantee that such information is available in all video files or available in a specific format.

    Abbreviated Sample Output for Some AVI File

        Metadata:
          Make            : FUJIFILM
          Model           : FinePix AX655
          DateTime        : 2014:08:25 05:19:45
          JPEGInterchangeFormat:     658
          JPEGInterchangeFormatLength:    1521
          Copyright       :     
          DateTimeOriginal: 2014:08:25 05:19:45
          DateTimeDigitized: 2014:08:25 05:19:45
    

    Abbreviated Sample Output for Some MP4 File

      Metadata:
        major_brand     : mp41
        minor_version   : 538120216
        compatible_brands: mp41
        creation_time   : 2018-03-13T15:43:24.000000Z
    
    0 讨论(0)
  • 2021-01-01 12:40

    Actually you can find very easy the day a video was created, right-click, property but remember it will only give the details of any copy date of the video but if you do click where it says DETAILS JUST there is the information you need, the original date that the archive was created on. Note that most modern devices will produce this information when you take pictures and videos but others will not.

    0 讨论(0)
  • 2021-01-01 12:44

    The best way I found of getting the "dateTaken" date for either video or pictures is to use:

     Imports Microsoft.WindowsAPICodePack.Shell
     Imports Microsoft.WindowsAPICodePack.Shell.PropertySystem
     Imports System.IO
     Dim picture As ShellObject = ShellObject.FromParsingName(path)
     Dim picture As ShellObject = ShellObject.FromParsingName(path)
     Dim ItemDate=picture.Properties.System.ItemDate
    

    The above code requires the shell api, which is internal to Microsoft, and does not depend on any other external dll.

    0 讨论(0)
  • 2021-01-01 12:45

    Have a try to exiftools or mediainfo, which provides you an export function as text. Just pay attention to daylight saving.

    0 讨论(0)
提交回复
热议问题