-
- # Make a note of the month, year, and day this video was taken (from the modification time of the file)
- $date_taken = ctime(stat("$srcdir/$srcfile")->mtime);
-
+
+ # Make a note of the month, year, and day this video was taken
+ $creation_time = `$ffmpeg -i "$srcdir/$srcfile" 2>&1 | grep "creation_time" | head -n 1 | awk '{print \$3}'`;
+ if($creation_time) {
+ $date_taken = $ffmpeg_time_format->parse_datetime($creation_time);
+ } else {
+ # From the modification time of the file since we couldn't find it in the video file
+ $date_modified = ctime(stat("$srcdir/$srcfile")->mtime);
+ }
+
+ # Get the date taken from the ffmpeg creation_time
+ if(!$merge_by_modification_time && $date_taken) {
+ $date_taken->set_time_zone('local');
+ $year = $date_taken->year;
+ $month = sprintf("%02d",$date_taken->month);
+ $day = sprintf("%02d",$date_taken->day);
+ $monthnum = sprintf("%02d",$date_taken->month);
+ $monthname = lc($month2monthname{$month});
+ #print "date_taken: $year-$month-$day ".$date_taken->hour.":".$date_taken->minute.":".$date_taken->second." ".$date_taken->time_zone."\n";
+ }