forked from SergeyRyzhov/exiftool-scripts-for-takeout
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsort_rename_videos.args
More file actions
54 lines (49 loc) · 2.02 KB
/
sort_rename_videos.args
File metadata and controls
54 lines (49 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Sort videos to directories by year.
#
# Options overview: https://exiftool.org/exiftool_pod.html#Option-Overview
# Writing file/directory names: https://exiftool.org/filename.html
#
# Perl regex references:
# https://perldoc.perl.org/perlre
# https://perldoc.perl.org/perlop#Regexp-Quote-Like-Operators
#
# Online testers:
# https://ingram-braun.net/erga/online-regex-tester-perl-php-javascript/
# https://regex101.com/
# Common options, see COMMONARGS.md for details.
-api
LargeFileSupport=1
-duplicates
-unknown2
-ignoreMinorErrors
-progress
-progress:ExifTool %p%%
-overwrite_original
-preserve
-v0
-r
# Process only files with 'video' MIME type.
-if
($MIMEType=~/video/)
# Make sure that the videos have some reasonable
# DateTime tag present and set, cannot really sort otherwise.
# Often the dates can have year set, but date, month and time
# are set to all zeros, or to 1st of January 00:00:00.
-if
((defined $QuickTime:TrackCreateDate and ($QuickTime:TrackCreateDate ne "0000:00:00 00:00:00")) or (defined $QuickTime:TrackModifyDate and ($QuickTime:TrackModifyDate ne "0000:00:00 00:00:00")) or (defined $QuickTime:MediaCreateDate and ($QuickTime:MediaCreateDate ne "0000:00:00 00:00:00")) or (defined $QuickTime:MediaModifyDate and ($QuickTime:MediaModifyDate ne "0000:00:00 00:00:00")))
# Attempt best effort filtering to filter out WhatsApp videos:
# - Filter based on filenames
# - Check for the custom tag values
#
# The filename regexp matches filenames with extra spaces after the extension,
# with filename ending to either newline or line end marker ($).
-if
(($FileName!~m/^VID.?(\d{8}).?(\d{6})?.*WA(\d{1,4})\.(mp4)\s*(\n|$)/i) and (($ItemList:ProductVersion ne "WhatsApp") and ($ItemList:Author ne "WhatsApp")))
#(($ItemList:ProductVersion ne "WhatsApp") and ($ItemList:Author ne "WhatsApp"))
# Sort and rename files to directories by year.
-d
Videos/%Y/VID_%Y%m%d-%H%M%S%%-c.%%e
-FileName<QuickTime:TrackCreateDate
-FileName<QuickTime:TrackModifyDate
-FileName<QuickTime:MediaCreateDate
-FileName<QuickTime:MediaModifyDate