Log in

View Full Version : Help for script to superimpose date and time stamps for Canon Avi


medp7060
23rd December 2005, 11:42
Hi, there,

Experts' help is sought for an Avisynth script to impose date and time stamps for avi captured by Canon digital camera. The avi clip is in M-JPEG format and has no date and time stamps recorded. I want to convert it into Divx format with date and time stamp imposed.

The start time and date can be obtained from the file properties.

The source is, 640 x 480 avi clip at 30 fps, created e.g. on 24.12.2005, 20:50:35.

I want the script gets the date and/or time of the avi clips and imposes them to each frame and seems it was recorded with analog camcorder.

Your help is much appreciated.

foxyshadis
24th December 2005, 03:42
The best way I can think of is to have a batch file create the initial script and tack it together after. I don't know of any way avisynth can access stuff like that (without a custom plugin).


@echo off
for /f "Skip=5 Tokens=1,5" %%i in ('dir /N /T:W *.avi') do echo %%j=avisource("%%j").subtitle("%%i") >> source.avs

Not perfect, but it'll get the job done. Just hack off the last two lines.

medp7060
24th December 2005, 12:25
Thank foxyshadis.

Your way can get the modified date of an avi file, which can also be obtained in Windows explorer as Properties. Then the date is shown as a subtitle. But I am expecting a way via which the date is extracted directly from the file within the script. In one word, I just specify the avi file and the file "Modified" date/time stamp will be automatically shown.

foxyshadis
24th December 2005, 14:29
I'm pretty sure that otherwise no one's written filesystem information functions for avisynth, nor is there a way to auto-superimpose such info without decoder help. It'd be very simple if ffdshow's OSD had it, but it doesn't. At least this will save you the time of typing it all in yourself; you can just copy out whichever lines you need and join them. (Unless of course you succeed in getting DVInfo updated.)

If you want time as well: (plus a bugfix)

@echo off
for /f "Skip=5 Tokens=1,2,3,5" %%i in ('dir /N /T:W *.avi') do echo %%~nl=avisource("%%l").subtitle("%%i %%j %%k") >> source.avs

Still might need to be modified depending on exactly what you're looking for.

medp7060
24th December 2005, 22:09
Merry Xmas, foxyshadis.

Thanks for your continuous input. Using your way, I got something like this:

=avisource("").subtitle("24/12/2005 14:41 21,116,928")
=avisource("").subtitle("1 File(s) 21,116,928")
free=avisource("free").subtitle("0 Dir(s) 293,511,168")

It nearly has the info I wanted. It will be perfect if it can show this:

avisource("E:\Canon_test.avi").subtitle("24/12/2005 14:41:16")

Where the file name is included and time is as hh:mm:ss.

foxyshadis
24th December 2005, 23:45
I guess our system time formats are different, mine includes 12h+seconds+am/pm, but yours is 24h w/o seconds. If you want seconds, you have to use regional options to change it. Anyway, to modify my script again:

@echo off
for /f "Skip=5 Tokens=1,2,4" %%i in ('dir /N /T:W *.avi') do echo %%~nk=avisource("%%k").subtitle("%%i %%j") >> source.avs

medp7060
25th December 2005, 00:34
although I got this:

The current time is : 12.29.28.10

However, I still had this:

tt1=avisource("tt1.avi").subtitle("24/12/2005 14:41")
bytes=avisource("bytes").subtitle("1 File(s)")
bytes=avisource("bytes").subtitle("0 Dir(s)")

I think I still have to input the date and time manually into to the script until there comes up a filter for it.

Thank you very much.

Wilbert
25th December 2005, 02:15
Have a look at Time(string):

http://www.avisynth.org/ScriptFunctions

Time(string="%#c")

etc ...

medp7060
25th December 2005, 09:34
Thank you, Wilbert.

But Time(string) Returns the current system time, not the last modification date and time of an avi file.

Fizick
27th December 2005, 11:27
medp7060,
You may try use "call.dll" plugin to generate command line and create some file, and import it to avs by "import" command.
But you wiil first person, so try it yourself and then tell us about results.

medp7060
29th December 2005, 11:34
Thank you, Fizick.

The Call filter is helpful but there is no commands around to show the file time stamp in the format of hh:mm:ss. The DOS DIR command only shows time stamp as hh:mm. DOS function (Int 21H 5700H) can get all the info. However, it is beyong my ability to write a utility with it.

foxyshadis
29th December 2005, 13:57
You know that I said the date format is in your regional and language options, right? ;)

medp7060
30th December 2005, 05:15
Foxyshadis,

I tried and without success. The DOS Time command did give me "The current time is : 12.29.28.10", but the Dir only gave me e.g. 12:29. I think the Dir command shows time in HH:MM format only.



although I got this:

The current time is : 12.29.28.10

However, I still had this:

tt1=avisource("tt1.avi").subtitle("24/12/2005 14:41")
bytes=avisource("bytes").subtitle("1 File(s)")
bytes=avisource("bytes").subtitle("0 Dir(s)")

I think I still have to input the date and time manually into to the script until there comes up a filter for it.

Thank you very much.

stickboy
3rd January 2006, 05:36
Okay, I added a GetFileInfo function to my GetSystemEnv plug-in (http://www.avisynth.org/stickboy/). Right now it only supports retrieving file creation, modification, and last access times.

Usage:
filename = "D:\someFile.avi"
AVISource(filename)
Subtitle(GetFileInfo(filename, "creationTime"))BTW, for DV files, you should consider WarpEnterprise's DVInfo plug-in (http://forum.doom9.org/showthread.php?t=61688).

medp7060
3rd January 2006, 09:23
stickboy,

Thank you very much indeed for the plug-in. I have tested it and it works like a charm. Now I can easily get the Date/Time stamps with the plugin.

May I wish you a very properous new year!