Figuring out Movie date and time

shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Tue, 2005-07-12 14:50

I don't know if this is the correct place to post this. But if anyone is interested i've created my own php script that tries to figure out a movie's date and time. I like to sort my albums by origination date and because my movies don't have exif information they always end up at the end of the album. Since I use a Sony digital camera my image naming convention is DSC00001 and so on and my movie naming convention is MOV00002 and so forth. So I decided if I strip the DSC and MOV off the front of the file names and do some other work on the filenames I can get a number. Then I can search the gallery2 database for other filenames that are within a certain distance away from this number, say 20 higher and 20 lower. That way I can determine the JPG's that are closest to the movie in question and from the JPG's EXIF data, I can closely determine the date and time of the movie. I have made mine so it only tries to find adjacent JPG's in the same album as the movie is located. Anyway, it's worked pretty good for me and thought someone else may want this. I don't have the time but it would be great if someone wanted to turn this into a maintence task or something. Thanks.

gallery2findmoviedates.zip1.61 KB

Joined: 2003-05-28
Posts: 26
Posted: Wed, 2005-07-27 10:43

This looks interesting. I need some solution for my movie clips as well, in G2. In G1 I hacked a new sort method in that ignores the first three characters. (Canon camera, filenames start with MVI/IMG/STA/STB/ST... - ST? filenames are stitch assist mode files.) The way I see it, I have three options for G2:

1) Hack in a new sort method, ignoring the first three characters of the filename. I assume (having not looked at the code) that this would require an SQL query modification, using something similar in principle to "SELECT ..., substring(filename from 'regular_expression') AS sortcol FROM ...... ORDER BY sortcol;".

2) Code something to extract the date from the movie files (having opened the files in a text editor, I know Canon cameras do store the date in there).

3) Modify and use the above script to guess the time from "neighbouring" photos.

I suspect 1 might be the fastest for a quick, temporary hack, but that it will be harder to do neatly - or is G2 so modular that you can add new sort methods easily? 2 is probably the "correct" solution, most useful to other G2 users (or G2+Canon users, then). Considering the possibilities of 1 and 2, 3 makes the least sense (other than the advantage over 1 of actually having a capture time for the item).

This is something that I definately need, so if I know where to start, I will end up coding it myself sooner or later, if someone else hasn't done it already. Advice on where to start? Developer's documentation? Due to lack of time more specific pointers would help in me getting around to this earlier. It is possible that I may only get around to this in September though, August is really busy...



Joined: 2003-05-28
Posts: 26
Posted: Mon, 2005-08-01 08:51

I think I should post this in G2 General Development? Extracting dates/times from Canon movie clips can be generally useful, and if done right, should make it easier to extract dates/times from other clips that do have it hidden away somewhere as well.


Joined: 2003-08-17
Posts: 25
Posted: Thu, 2005-12-22 06:05

I have started working on a module to incorporate Getid3() My Canon SD400 generates AVI's, and the module already supports the originationDatestamp for it, so they are properly sorted by time with the images. My previous camera generated quicktime videos, and it looks like I can grab the dates out of them too. I'll need as many different sample files to make sure I hit as many cases as possible. The attached file should work against today's CVS, in the HEAD branch. Note that this software should be considered "alpha" level, so please back up files/databases before using it. Also see:
Getid3 has it's own thread, with file attached at: