use DateTime::Format::Strptime qw( );
# Set our ffmpeg creation_time format
-$ffmpeg_time_format = DateTime::Format::Strptime->new(pattern=>'%Y-%m-%dT%H:%M:%S', time_zone => 'UTC', on_error => 'croak');
+$ffmpeg_time_format_utc = DateTime::Format::Strptime->new(pattern=>'%Y-%m-%dT%H:%M:%S', time_zone => 'UTC', on_error => 'croak');
+$ffmpeg_time_format_local = DateTime::Format::Strptime->new(pattern=>'%Y-%m-%dT%H:%M:%S', time_zone => 'local', on_error => 'croak');
$ctime_format = DateTime::Format::Strptime->new(pattern=>'%a %b %d %H:%M:%S %Y', time_zone => 'local', on_error => 'croak');
# Early command line options processing
# 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}'`;
+ $brands = `$ffmpeg -i "$srcdir/$srcfile" 2>&1 | grep "compatible_brands" | tail -n 1`; chomp($brands);
if($creation_time) {
- $date_taken = $ffmpeg_time_format->parse_datetime($creation_time);
+ $date_taken = $ffmpeg_time_format_utc->parse_datetime($creation_time);
+ if ($brands && $brands =~ /$local_tz_brands/) {
+ $date_taken = $ffmpeg_time_format_local->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);