#1 2006-08-25 12:05

fjord
Member
From: Denmark
Registered: 2006-08-25
Posts: 43

AVI Date and Time

I hope your holiday trip is fantastic, and you return refreshed and inspired to add another metadata code to ReNamer. I've been using ReNamer for some time now, to put EXIF date and time into jpeg filenames, among other things. ReNamer is great!

I have lots of DV video clips -- and now digital camera video clips, too -- which I would like to give the same filename treatment. My video capture and edit software (Sony Vegas 6d) doesn't have a way to show a clip's original date and time, although it is embedded in the captured avi files.

ReNamer's Meta Tag File_DateCreated gives me the date that I captured the video from tape, rather than the date recorded. Can you add the AVI Date and Time tags to your list of metadata tags, so I can put the original recording date in the filename, just like EXIF_Date and EXIF_Time give the date the picture was taken?

I have used the AVI_Width, AVI_Height and AVI_FramesPerSecond tags to rename avi's from my digital camera (Canon S3), so I know you already have some code to handle avi headers. I hope it's not too big a project to add the date and time from the avi header.

Another program I ran into that can put avi date and time into filenames is Paul Glaga's DVdate http://www.digital-digest.com/software/dvdate.html. (I haven't tried it yet.) His website also refers to a page with info and code on avi DateCode at Stefans Skydiving Spielwiese http://www.skydiver.de/stef/datecode_en.htm.

Best regards, and thanks for a great program.

Edit: ps. I could also imagine using a video's initial frame TimeCode stamp in a filename (not to be confused with the clock time). Can you can get that from the avi header or the first frame of the video? If implemented, be sure to clarify the difference to users if you refer to an avi "time" tag. The tags could be named AVI_Date, AVI_Time and AVI_TimeCode to avoid confusion. TimeCode is actually a sequential numbering of the video frames, in the form hh:mm:ss:ff where ff is frame number 0..24 (PAL) or 0..29 (NTSC), so you would need to allow for that in formatting the TimeCode value.

Last edited by fjord (2006-08-25 12:34)

Offline

#2 2006-08-25 13:11

dloneranger
Senior Member
From: Birmingham, UK
Registered: 2006-05-03
Posts: 122

Re: AVI Date and Time

The timecodes exist in DV/Mpg streams, but not in AVI files i'm afraid unless they use DV codec
Even in DV and Mpg, there's no requirement for the real time and date to be used, a lot depends on the camera etc hmm

http://paul.glagla.free.fr/dvdate_4_en.htm

Last edited by dloneranger (2006-08-25 13:13)

Offline

#3 2006-08-25 13:58

fjord
Member
From: Denmark
Registered: 2006-08-25
Posts: 43

Re: AVI Date and Time

Your right. The same is true for jpeg files created in photo software that doesn't write EXIF headers. EXIF_Date is undefined on such jpegs. But EXIF_Date is very useful on camera jpegs.

The avi's I need to rename are captured DV. They should have the original camera date in the avi header. I assume my capture program wrote it in the header (but I have yet to verify that). I'll have to try DVdate.

Offline

#4 2006-09-04 12:23

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: AVI Date and Time

Thanks fjord, my trip was great, and now i'm back, refreshed and inspired smile

About timestamps in AVI... dloneranger is right! I came to the same conclusion few months ago, when another user was asking to add a metatag which reads timestamp from an AVI file. Below, is a template for an AVI header, and I can add anything that is in that header. Unfortunately, timestamp is not defined in there...

  TAVIMainHeader = record
    dwMicroSecPerFrame: DWORD;         // Time delay between frames
    dwMaxBytesPerSec: DWORD;           // Data rate of AVI data
    dwReserved1: DWORD;                // (Reserved)
    dwFlags: DWORD;                    // Data parameters
    dwTotalFrames: DWORD;              // Number of video frame stored
    dwInitialFrames: DWORD;            // Number of preview frames
    dwStreams: DWORD;                  // Number of data streams in chunk
    dwSuggestedBufferSize: DWORD;      // Minimum playback buffer size
    dwWidth: DWORD;                    // Width of video frame in pixels
    dwHeight: DWORD;                   // Height of video frame in pixels
    dwReserved: array [0..4] of DWORD; // (Reserved)
    end;

Offline

#5 2006-09-04 13:28

fjord
Member
From: Denmark
Registered: 2006-08-25
Posts: 43

Re: AVI Date and Time

Hi Denis

Glad to have you back!

I suppose the datecode and timestamp is specific to the DV-AVI format. This link to "Extracting Recording Date & Time from AVI film clips" http://www.eden-foundation.org/products … ate_stamp/ mentions a java library for handling DV-AVI date & time. It also gives a link to "Extracting time codes from DV frames" http://www.lightweightvideo.com/dv_timecode/ which has some VB code for extracting time & date info. Does any of this help?

I also found "OpenDML AVI File Format Extensions" http://www.jmcgowan.com/odmlff2.pdf referred to under "AVI File Format" on the page http://decsai.ugr.es/mia/complementario … itech.html. In that PDF, see the ISMP & IDIT chunks under "Microsoft-Defined Tombstone Data". They have something to do with date and timecode.

I am working with DV-AVI type 2 files, which the Eden-avi-lib java library apparently supports.

If the file was not a DV-AVI, then the parameter values would be undefined of course.

Offline

#6 2006-09-06 12:33

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: AVI Date and Time

Thanks for all these links. I looked carefully through all of them...

I didn't find any clear specification. I found Java code, C code and VB code. I have a knowledge of Java, and a little bit of C, and none in VB. First 2 are to big to convert them to Delphi, it will take a loooooot of time, and probably will not be successful, since libraries that they use are completely different from what Delphi has. VB code is an unfinished mess, and I can't understand it. It is very unclear, and most of the stuff author did was based on his guess, but not on facts/specification. Author kinda provides a way to extract date from actual DV frames, without mentioning how to get to those frames. So if VB code actually does work, it probably works only for about 10% of all DV files with dates in them.

It seems like Ihave to decode/parse the whole AVI file, in order to extract the date. And that is simply too big of a task for me, baring in mind that I'm not getting paid for any time spent on this, and that task will require a loooot of time, which I also don't have.

I have another idea, maybe I could create a PascalScript function which can launch a console mode application and capture the output from it. There are few command line tools that extract DV dates which could be used for that task. I will look into this...

Offline

#7 2006-09-06 14:13

fjord
Member
From: Denmark
Registered: 2006-08-25
Posts: 43

Re: AVI Date and Time

Too bad sad, but I understand it's a mess to deal with...especially in your free time wink. I will just have to learn to live with the limited rename functionality in DVdate (http://paul.glagla.free.fr/dvdate_6_en.htm) for renaming avi files with recording date and/or timecode. If I need more than that, I can follow DVdate renaming with re-renaming in ReNamer tongue. For example, to rearrange the date and time in the filename produced by DVdate. So all is not lost. big_smile

Offline

#8 2006-09-06 22:24

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: AVI Date and Time

That DVdate program (by Paul Glagla) can work via the command line (look in the about window), and it can save the output in text files. Well, here is the way, I can add a function to pascal script to run an external program (DVdate in our case). Run it for every file, and via pascal script you can read those files and use the date time produced by DVdate in ReNamer!

What do you think? smile

Offline

#9 2006-09-07 12:21

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: AVI Date and Time

While you are still thinking, I've added those functions for executing external applications:

function ExecuteProgram(const Command: string; WaitForProgram: Boolean): Cardinal;
- simply executes any application, optionally waiting until it is finished.

function ExecConsoleApp(const CommandLine: string; out Output: string): Cardinal;
- works line a command prompt, it executes a console mode application and captures its output.

These added functions provide extra power! Now, previously impossible tasks like extracting date from DV and CRW files - are possible, using 3-rd party tools for extraction and these functions for capturing their output, and all that can be done via a single PascalScript rule in ReNamer smile

Latest development version: ReNamerBeta.zip

Offline

Board footer

Powered by FluxBB