![]() |
|
|
|
Registered
Join Date: Mar 2003
Posts: 10,318
|
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?
__________________
“IN MY EXPERIENCE, SUSAN, WITHIN THEIR HEADS TOO MANY HUMANS SPEND A LOT OF TIME IN THE MIDDLE OF WARS THAT HAPPENED CENTURIES AGO.” |
||
![]() |
|
Feelin' Solexy
Join Date: Oct 2003
Location: WA
Posts: 3,786
|
Perl, baby! Regex that shizz!
__________________
Grant In the stable: 1938 Buick Special model 41, 1963 Solex 2200, 1973 Vespa Primavera 125, 1974 Vespa Rally 200, 1986 VW Vanagon Syncro Westfalia, 1989 VW Doka Tristar, 2011 Pursuit 315 OS, 2022 Tesla Y Gone but not forgotten: 1973 VW Beetle, 1989 Porsche 944, 2008 R56 Mini Cooper S |
||
![]() |
|
Registered
Join Date: Mar 2003
Posts: 10,318
|
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 ...
__________________
“IN MY EXPERIENCE, SUSAN, WITHIN THEIR HEADS TOO MANY HUMANS SPEND A LOT OF TIME IN THE MIDDLE OF WARS THAT HAPPENED CENTURIES AGO.” |
||
![]() |
|
Too big to fail
|
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);
__________________
"You go to the track with the Porsche you have, not the Porsche you wish you had." '03 E46 M3 '57 356A Various VWs |
||
![]() |
|