How can I get the original capture timestamp from my home movie files:: AVI and MPG4?

10,671

Solution 1

Here is a hacky howto based on mplayer that works at least for the MOV files produced by my camera:

mplayer -vo null -ao null -frames 0 -identify myfile.MOV 2>/dev/null|grep creation_time:

I use it to batch-rename them:

for m in MVI*.MOV; do
    t=$(mplayer -vo null -ao null -frames 0 -identify $m 2>/dev/null|grep creation_time:|sed 's/.*creation_time: *//;s/[-:]//g;s/ /-/')
    mv ${m} ${t}_${m}
done

Solution 2

Here is a bit of code that i found a while back that should get you started.

http://www.developerfusion.com/code/3435/a-convenient-wrapper-class-to-get-file-info/

Solution 3

There's a good chance you're out of luck unless the original capture used absolute timestamps. In my experience, most capture applications use time 0 for the first frame, not a universal time. To check this out, get GraphStudio, load the file in it, then look at the start time in the properties for the first output pin.

You might look at using GSpot to see if the metadata you're looking for is even present in the files. For your AVI files, you might also look into VirtualDub's RIFF features in its hex editor. Unless your capture application was nice to you, that data was probably never recorded.

Assuming that the original timestamps are available somehow, I'd suggest looking at the source of whichever application helped you find it.

For my videos, I've taken to grabbing the metadata at capture time, storing it in an XML file and having my transcoding / post-processing apps keep the last modified timestamp fixed as the original timestamps.

Solution 4

I can’t talk about DVD, but the Digital Video (DV) codec does indeed store time and date (as set in the camera) on each single frame!

For Linux, programs like dvgrab handle those timestamps, for Windows I believe a tool named dvdate.exe does.

DV video can be stored in AVI containers (.avi), raw (.dv or .dif) and QuickTime (.mov). But not all AVIs are DV. 60min of DV video is about 13GB. – If your files are smaller, they are probably already converted to other codecs and the timestamps are lost.

Solution 5

You should have a look at exiftool. It's an non-GUI utility that allow you to access such information in many media files metadata

http://www.sno.phy.queensu.ca/~phil/exiftool/#supported

You can probably extract exiftool output to make a nice GUI to rename in any language you want. I have my own python script for that.

Share:
10,671
dustinson
Author by

dustinson

Independent consultant, .Net developer, Technical Mentor/Trainer, VB, C#, ASP, SQL.

Updated on June 17, 2022

Comments

  • dustinson
    dustinson about 2 years

    I have over a TB of home movies with horrible file names. Finding what you want is impossible. I would like to rename all files to the time they were originally recorded (not the file time they were placed on my computer). Some applications (like Ulead Video Studio) can access this information, which I believe is embedded in the CODEC.

    I would LOVE to find how how either I can write a .Net app to extract this information to rename my files so I can easily organize them OR find an application that will do this for me. Thank you very much in advanced.

    additional information:: home movies were captured on miniDV and DVD camcorders.

  • dustinson
    dustinson over 15 years
    Thank you for the suggestion. Unfortunately the information I'm looking for is not in the file properties and these options won't get me it. I had tried :( I believe the time/date stamp from the camcorder is embedded in the file. Thank you though!
  • Max Williams
    Max Williams almost 9 years
    This is awesome, thanks. As a little tweak you could make it handle spaces in filenames by changing $m to "$m" and the mv line to mv "${m}" "${t}_${m}". I know you wouldn't expect to have any spaces in files if they're direct from your phone but it's a nicer general solution.
  • Pianoman
    Pianoman over 6 years
    This one saved me a ton of time in organising my video's! It can read the timestamp and move files according to new directories. find ../Videos/ -iname '*.avi' -exec exiftool "-Directory<DateTimeOriginal" -d "%Y-%m-%d" "$*".