Pelican Parts Forums

Pelican Parts Forums (http://forums.pelicanparts.com/)
-   Off Topic Discussions (http://forums.pelicanparts.com/off-topic-discussions/)
-   -   fellow geeks (esp. linux users) - i need help (http://forums.pelicanparts.com/off-topic-discussions/299410-fellow-geeks-esp-linux-users-i-need-help.html)

id10t 08-18-2006 09:02 AM

fellow geeks (esp. linux users) - i need help
 
OK, so we've been building a new building here at work, and I wanted to do a stop motion movie of it. I've done it before, looks way cool, oohs and aaahs at the opening ceremonies.

This time I forgot to not take pictures at night, so approximately half my movie is boring nothingness. :(

So now I've got not quite 100,000 jpegs, each taken 5 minutes apart, and with sequential file names (2000000001.jpeg, 2000000002.jpeg, etc)

I need to get rid of the boring night stuff. I've tried making my movie and using a NLE (premier on a winxp box) to remove the night stuff, but my skills are weak in that area, and it took forever to just do a few days worth of it, and it would take me weeks to finish it that way.

I'm thinking I'd need to loop thru all the files and check the creation date and then get rid of whatever happened from 7pm to 6am, then re-loop thru them again and rename them so I'm back to consecutive file names (berkeley's mjpeg encoder doesn't like to skip anything in a sequence of names).

Any creative ideas on this?

Tishabet 08-18-2006 09:05 AM

Perl, baby! Regex that shizz!

id10t 08-18-2006 09:28 AM

Yeah, I'll need to use some regexes (maybe)... I can get a long listing of the files that will include the date/time they were taken. Some fancy work with grep and cut could give me the names of the files I want to keep, or vice versa and give me the names of what I want to delete. I'm just trying to figure out the best/easiest way, since if I make a copy of the images it changes the ctime/mtime/atime to now, so I've basically only got one shot ...

widebody911 08-18-2006 09:37 AM

Use perl readdir structure to loop thru the files, for each file grab the fstat (File::stat) structure to get the timestamp, then copy the new file using a new index counter.

hacked-out psuedocode off the top of my head
Code:

use File::copy;
use File::stat;
use Time::locatime;

$new_index=1;
opendir(DIR, "your/data/directory") || die "ooops!"
foreach my $old_file (readdir(DIR)) {
  my $time = ctime(stat($old_file)->mtime);
  next if ($time outside my range) # you have to work out this bit
 
  copy ("$old_file", "file.$new_index)
  $new_index++;
}
close(dir);



All times are GMT -8. The time now is 02:48 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0
Copyright 2025 Pelican Parts, LLC - Posts may be archived for display on the Pelican Parts Website


DTO Garage Plus vBulletin Plugins by Drive Thru Online, Inc.