1 00:00:00,06 --> 00:00:02,08 - [Instructor] ExifTool is a free command line program 2 00:00:02,08 --> 00:00:05,00 that can read and modify embedded metadata 3 00:00:05,00 --> 00:00:07,07 and it runs on Windows, Mac OS and Linux. 4 00:00:07,07 --> 00:00:08,07 You can learn more about it 5 00:00:08,07 --> 00:00:12,01 and download the software @exiftool.org. 6 00:00:12,01 --> 00:00:13,08 It's most basic mode operation 7 00:00:13,08 --> 00:00:17,03 is to simply list all the metadata it can find in a file. 8 00:00:17,03 --> 00:00:18,06 Even though it's called ExifTool, 9 00:00:18,06 --> 00:00:20,04 it can read some other types of metadata 10 00:00:20,04 --> 00:00:22,05 from files that it knows about and supports. 11 00:00:22,05 --> 00:00:25,03 Usually though, we'll use it for media files of some type, 12 00:00:25,03 --> 00:00:27,03 images, audio or video. 13 00:00:27,03 --> 00:00:30,01 ExifTool is also a useful program if we're writing scripts 14 00:00:30,01 --> 00:00:32,06 or processing large amounts of files. 15 00:00:32,06 --> 00:00:34,03 We can use it to extract metadata 16 00:00:34,03 --> 00:00:35,09 from a bunch of files at once 17 00:00:35,09 --> 00:00:39,03 or to change values one at a time or in bulk. 18 00:00:39,03 --> 00:00:40,05 This makes it quite helpful 19 00:00:40,05 --> 00:00:42,04 in both information gathering workflows 20 00:00:42,04 --> 00:00:44,05 and file sanitization workflows. 21 00:00:44,05 --> 00:00:46,03 We can think of a variety of scenarios 22 00:00:46,03 --> 00:00:47,06 where this could be handy. 23 00:00:47,06 --> 00:00:50,02 Perhaps we're a photographer and want to set our copyright, 24 00:00:50,02 --> 00:00:51,08 license data and project number 25 00:00:51,08 --> 00:00:54,01 on each of 600 photos we took, 26 00:00:54,01 --> 00:00:56,00 or we might want to strip GPS data 27 00:00:56,00 --> 00:00:57,04 and camera serial number data 28 00:00:57,04 --> 00:00:59,04 from photos we're sending to an art competition 29 00:00:59,04 --> 00:01:00,09 or to share online. 30 00:01:00,09 --> 00:01:03,09 Many services strip sensitive metadata automatically now, 31 00:01:03,09 --> 00:01:04,09 but not all do, 32 00:01:04,09 --> 00:01:07,07 so it's good to know how to do that for ourselves 33 00:01:07,07 --> 00:01:08,07 and it's useful to know 34 00:01:08,07 --> 00:01:11,05 how to add metadata to images as well. 35 00:01:11,05 --> 00:01:13,06 Let's take a look at a photo I took a few years ago 36 00:01:13,06 --> 00:01:15,05 on a trip to Barcelona. 37 00:01:15,05 --> 00:01:18,02 This was taken inside the Mercat De Sant Antoni, 38 00:01:18,02 --> 00:01:19,06 pardon my pronunciation, 39 00:01:19,06 --> 00:01:21,07 and I know that I took this photo with my camera 40 00:01:21,07 --> 00:01:24,02 that doesn't have a built-in GPS feature. 41 00:01:24,02 --> 00:01:27,00 So I'd like to add some GPS metadata to this photo 42 00:01:27,00 --> 00:01:30,00 so it'll show the right location in my photo browser. 43 00:01:30,00 --> 00:01:32,00 Most photo browsers on most platforms 44 00:01:32,00 --> 00:01:33,08 let us do this within their interface, 45 00:01:33,08 --> 00:01:35,03 but they're all different. 46 00:01:35,03 --> 00:01:36,06 So let's use ExifTool, 47 00:01:36,06 --> 00:01:39,01 which works the same way across all platforms 48 00:01:39,01 --> 00:01:40,08 to explore this photo's metadata 49 00:01:40,08 --> 00:01:43,05 and to make the changes we need to. 50 00:01:43,05 --> 00:01:50,01 I'll switch over to my PowerShell terminal here. 51 00:01:50,01 --> 00:01:52,09 And I'll change to the directory where my photo is stored. 52 00:01:52,09 --> 00:01:55,00 Now let's explore the metadata for this file 53 00:01:55,00 --> 00:01:59,02 with a command exiftool 54 00:01:59,02 --> 00:02:02,07 and the name of the file. 55 00:02:02,07 --> 00:02:04,07 This gives us a huge amount of information 56 00:02:04,07 --> 00:02:06,05 from basic information about the file, 57 00:02:06,05 --> 00:02:09,03 like its name, its size, and so on, 58 00:02:09,03 --> 00:02:10,08 to more specific information 59 00:02:10,08 --> 00:02:12,03 like the camera model name, 60 00:02:12,03 --> 00:02:14,00 the software the camera was using, 61 00:02:14,00 --> 00:02:16,00 and details about the exposure time 62 00:02:16,00 --> 00:02:22,05 and other values that the camera wrote into the file. 63 00:02:22,05 --> 00:02:25,05 We can also read only specific values if we want to 64 00:02:25,05 --> 00:02:27,08 using their argument names. 65 00:02:27,08 --> 00:02:30,07 We can find the argument names that apply to a given file 66 00:02:30,07 --> 00:02:36,03 with the -args option. 67 00:02:36,03 --> 00:02:39,05 I'll recall my previous command and add that here, 68 00:02:39,05 --> 00:02:41,08 and I'll run it again. 69 00:02:41,08 --> 00:02:43,07 And here on the left of the specific arguments 70 00:02:43,07 --> 00:02:48,05 that correspond to each of these values. 71 00:02:48,05 --> 00:02:50,07 For example, we can get just the exposure time 72 00:02:50,07 --> 00:02:53,06 and F stop values for a photo like this. 73 00:02:53,06 --> 00:02:55,04 If these values have been written by the camera 74 00:02:55,04 --> 00:02:57,01 or other software, 75 00:02:57,01 --> 00:02:58,00 that's pretty useful 76 00:02:58,00 --> 00:02:59,07 if you're looking for specific information 77 00:02:59,07 --> 00:03:01,03 in a set of files. 78 00:03:01,03 --> 00:03:04,03 But we can also use argument names to set values too. 79 00:03:04,03 --> 00:03:05,02 I mentioned earlier 80 00:03:05,02 --> 00:03:11,02 that this file doesn't have GPS information. 81 00:03:11,02 --> 00:03:13,08 And if I move back to my photo browser 82 00:03:13,08 --> 00:03:15,07 and open the file info, 83 00:03:15,07 --> 00:03:18,06 I can see that there's no map presented. 84 00:03:18,06 --> 00:03:20,08 So let's add some GPS information 85 00:03:20,08 --> 00:03:24,05 with the arguments GPS latitude and GPS longitude. 86 00:03:24,05 --> 00:03:27,02 Those argument names don't appear in the list for this file 87 00:03:27,02 --> 00:03:28,07 because they're not set for this file, 88 00:03:28,07 --> 00:03:30,05 so that can be a little tricky. 89 00:03:30,05 --> 00:03:33,04 The manual pages for ExifTool on Linux and Mac OS 90 00:03:33,04 --> 00:03:34,08 or the ExifTool website 91 00:03:34,08 --> 00:03:37,00 if you don't have manual pages on your OS, 92 00:03:37,00 --> 00:03:39,00 provide a rich source of documentation 93 00:03:39,00 --> 00:03:41,04 and list the arguments available to us. 94 00:03:41,04 --> 00:03:43,01 To add my GPS information, 95 00:03:43,01 --> 00:03:45,03 I'll need those latitude and longitude values, 96 00:03:45,03 --> 00:03:46,07 so I'll pop over to the web 97 00:03:46,07 --> 00:03:49,03 and grab those from a mapping site. 98 00:03:49,03 --> 00:03:53,00 I'll search for the location that the photo was taken, 99 00:03:53,00 --> 00:03:55,03 and here in the URL 100 00:03:55,03 --> 00:03:57,01 I can find the latitude and longitude values 101 00:03:57,01 --> 00:04:05,06 that I'm looking for. 102 00:04:05,06 --> 00:04:10,00 I'll copy those values 103 00:04:10,00 --> 00:04:12,00 and I'll switch back to my terminal. 104 00:04:12,00 --> 00:04:17,02 Using those values, I'll populate two arguments. 105 00:04:17,02 --> 00:04:21,07 All right, exiftool -GPS latitude equals that first value 106 00:04:21,07 --> 00:04:24,07 - GPS longitude equals the second value, 107 00:04:24,07 --> 00:04:26,03 and then the name of my file. 108 00:04:26,03 --> 00:04:27,03 When I ran this command, 109 00:04:27,03 --> 00:04:29,03 ExifTool made a copy of the original 110 00:04:29,03 --> 00:04:32,01 and replaced it with my updated image. 111 00:04:32,01 --> 00:04:35,05 So, let's open that up and take a look at the GPS data. 112 00:04:35,05 --> 00:04:39,09 There's a location right where I expected it to be, great. 113 00:04:39,09 --> 00:04:40,08 Keep in mind though, 114 00:04:40,08 --> 00:04:42,02 we could have just as easily put in 115 00:04:42,02 --> 00:04:44,00 incorrect GPS information 116 00:04:44,00 --> 00:04:45,03 and make it seem as though this photo 117 00:04:45,03 --> 00:04:48,04 were taken at another market anywhere in the world. 118 00:04:48,04 --> 00:04:50,05 Removing metadata is just as important 119 00:04:50,05 --> 00:04:52,02 and we can remove specific values 120 00:04:52,02 --> 00:04:55,02 by setting their arguments to an empty string. 121 00:04:55,02 --> 00:05:01,08 For example, I could remove the GPS information I just added 122 00:05:01,08 --> 00:05:07,01 with exiftool -GPS latitude equals nothing 123 00:05:07,01 --> 00:05:12,04 - GPS longitude equals nothing, and the name of the file. 124 00:05:12,04 --> 00:05:15,01 Now when I open the file again, 125 00:05:15,01 --> 00:05:17,01 I can see that the GPS information is gone 126 00:05:17,01 --> 00:05:19,05 from this newly made copy. 127 00:05:19,05 --> 00:05:22,05 The information is still there in the previous copy 128 00:05:22,05 --> 00:05:24,04 so keeping the copy straight is important 129 00:05:24,04 --> 00:05:27,06 if you're redacting sensitive information. 130 00:05:27,06 --> 00:05:30,06 We can also use ExifTool to extract information from a file 131 00:05:30,06 --> 00:05:32,08 and represent it elsewhere. 132 00:05:32,08 --> 00:05:35,03 For example, I took this photo in 2018, 133 00:05:35,03 --> 00:05:37,05 but the creation date here in the file information 134 00:05:37,05 --> 00:05:39,07 says it was created today. 135 00:05:39,07 --> 00:05:42,04 That's because this actual file was created today 136 00:05:42,04 --> 00:05:46,01 when we changed the GPS information just a moment ago. 137 00:05:46,01 --> 00:05:48,03 So that's correct if you look at it one way, 138 00:05:48,03 --> 00:05:49,02 but it may be the case 139 00:05:49,02 --> 00:05:51,04 that I want to represent this file's creation date 140 00:05:51,04 --> 00:05:53,09 with the actual date that I took the photo, 141 00:05:53,09 --> 00:05:56,06 that's when the photo was created after all. 142 00:05:56,06 --> 00:05:58,05 To do that, I can use the less than symbol 143 00:05:58,05 --> 00:05:59,08 with a metadata argument 144 00:05:59,08 --> 00:06:05,00 to set the file's creation date like this. 145 00:06:05,00 --> 00:06:13,02 All right, exiftool "-filecreatedate 00:06:14,08 and the name of the file. 147 00:06:14,08 --> 00:06:15,08 This has quotes around it, 148 00:06:15,08 --> 00:06:18,01 so the full argument is pass to ExifTool. 149 00:06:18,01 --> 00:06:19,08 This reads the X of create date 150 00:06:19,08 --> 00:06:22,05 into the file create date value. 151 00:06:22,05 --> 00:06:25,05 I'll press return. 152 00:06:25,05 --> 00:06:27,04 And if I switch back to my file browser, 153 00:06:27,04 --> 00:06:29,03 I can see that that value was updated 154 00:06:29,03 --> 00:06:32,01 from the date inside the embedded metadata. 155 00:06:32,01 --> 00:06:34,07 This date value is actually stored in the file system 156 00:06:34,07 --> 00:06:36,00 not the file itself, 157 00:06:36,00 --> 00:06:38,07 and we'll explore how that works in the next chapter. 158 00:06:38,07 --> 00:06:41,04 Files can have a lot of dates associated with them 159 00:06:41,04 --> 00:06:43,06 both internally in their embedded metadata 160 00:06:43,06 --> 00:06:45,02 and on the file system. 161 00:06:45,02 --> 00:06:47,07 The metadata dates vary by file type, 162 00:06:47,07 --> 00:06:48,05 but many photos 163 00:06:48,05 --> 00:06:51,01 will have a variety of creation and modification dates 164 00:06:51,01 --> 00:06:53,01 that can be interesting to explore. 165 00:06:53,01 --> 00:06:55,05 These embedded dates and the file system dates 166 00:06:55,05 --> 00:06:58,00 can be useful for different purposes, 167 00:06:58,00 --> 00:07:00,04 but some of them, especially file system dates, 168 00:07:00,04 --> 00:07:03,02 can be modified when files are copied or edited. 169 00:07:03,02 --> 00:07:05,00 For example, if you're undertaking a project 170 00:07:05,00 --> 00:07:07,05 to scan old family photos and documents, 171 00:07:07,05 --> 00:07:09,04 you might choose to leave the date you scan them 172 00:07:09,04 --> 00:07:11,09 as their regular file system creation date 173 00:07:11,09 --> 00:07:13,03 and store the date information 174 00:07:13,03 --> 00:07:15,00 from when the photos were actually taken 175 00:07:15,00 --> 00:07:16,05 in an embedded field, 176 00:07:16,05 --> 00:07:18,00 which is less likely to be altered 177 00:07:18,00 --> 00:07:20,06 when files are copied or edited. 178 00:07:20,06 --> 00:07:22,09 While ExifTool can be a little bit tricky to learn, 179 00:07:22,09 --> 00:07:24,06 it's an incredible piece of software 180 00:07:24,06 --> 00:07:27,02 and a valuable tool to become familiar with. 181 00:07:27,02 --> 00:07:29,08 I enjoy using it when I work across different platforms 182 00:07:29,08 --> 00:07:32,04 because it shows me the same information in the same place 183 00:07:32,04 --> 00:07:34,07 using the same commands syntax. 184 00:07:34,07 --> 00:07:36,02 It frees me from having to remember 185 00:07:36,02 --> 00:07:39,00 how to use different tools on different platforms. 186 00:07:39,00 --> 00:07:41,06 And keep in mind, it's not only for images. 187 00:07:41,06 --> 00:07:42,09 If you work with metadata, 188 00:07:42,09 --> 00:07:46,00 I encourage you to spend some time exploring it.