Hello
I've a mov file that was shot on 2011 July 5th at 07:16:10 AM local time in Los Angeles (GMT-7)
It's exif datetime data are :
Quoteexiftool -time:all clip-2011-07-05\ 07\;16\;10.mov
File Modification Date/Time : 2018:03:08 13:21:00+01:00
File Access Date/Time : 2018:03:08 13:20:59+01:00
File Inode Change Date/Time : 2018:03:08 13:21:00+01:00
Create Date : 2011:07:20 11:22:58
Track Create Date : 2011:07:05 07:16:10
Track Modify Date : 2011:07:05 07:16:10
Media Create Date : 2011:07:05 07:16:10
Media Modify Date : 2011:07:05 07:16:10
Creation Date : 2011:07:05 07:16:10+02:00
Modify Date : 2011:07:05 07:16:10+02:00
In bold the wrong value
So I ran this command
exiftool '-CreateDate<CreationDate' clip-2011-07-05\ 07\;16\;10.mov ; exiftool -CreateDate-='00:00:00 00:00:00+09:00' clip-2011-07-05\ 07\;16\;10.mov
and now the exifdata are :
exiftool -time:all clip-2011-07-05\ 07\;16\;10.mov
File Modification Date/Time : 2018:03:08 13:21:08+01:00
File Access Date/Time : 2018:03:08 13:23:19+01:00
File Inode Change Date/Time : 2018:03:08 13:21:08+01:00
Track Create Date : 2011:07:05 07:16:10
Track Modify Date : 2011:07:05 07:16:10
Media Create Date : 2011:07:05 07:16:10
Media Modify Date : 2011:07:05 07:16:10
Creation Date : 2011:07:05 07:16:10+02:00
Create Date : 2011:07:05 07:16:10-07:00
Modify Date : 2011:07:05 07:16:10+02:00
My trouble is that google photo (manual upload via browser) order it on the correct DATE/TIME (2011/07/05 07:16) but at GMT+1 (London) so date my movie is not corretly ordered in my photo time line
What can I do using exiftool ?
Thank for help
I don't have time to look into this in detail right now, but there are a couple of issues here:
1. MOV file dates are sometimes in UTC and sometimes in local time. You can add -api quicktimeutc to the command to get ExifTool to assume they are UTC and convert them to local times
2. When you use ExifTool to write CreateDate, it writes only XMP:CreateDate, and not the QuickTime:CreateDate that you probably need. Add -a -G to your commands to see where the tags were written.
- Phil
Hi multinet,
I saw your question a couple of days ago and I have been trying to figure out how to respond since as this is the very reason I started using exiftool, was to try and set the quicktime date and time values of videos taken on other cameras in order to have them appear in the correct order in my camera roll on my iPhone. As Phil has said unfortunately exiftool is unable to do this and after about a week of tinkering and reading through Apple's pages upon pages of quicktime documentation I finally worked out how to change these values. I wasnt able to find any software to do the job for me so the solution I came up with was to manually edit the file using a hex editor (which involves directly editing the bytes which make up the file). The problem with this is that it is really fidilly and complex if you dont know what you're doing but once you get the hang of it is actually really simple. I will attempt to try walk you through a process in order to fix your file but questions will more than likely be raised. If I can find time I will try maybe upload a youtube video or write a quick java program for you to run to do this for you but I am pressed tight for time at the moment with University. So without further ado here we go.
1) First things first, download hxd hex editor and install it so that we're able to view the bytes of the file (Download link: https://mh-nexus.de/en/downloads.php?product=HxD)
2) Next download FFmpeg (https://www.ffmpeg.org/download.html) and make sure you are able to run this tool from the command line (in windows you need to add it to your path variable, I'm unsure of other operating systems though)
3) Then open hxd editor and drag you're movie file you want to edit into the window to open the file (BACKUP the original file before doing this as any mistake will possibly result in a loss of your data)
You should see a whole bunch of bytes and characters at this stage but dont feel overwhelmed it isnt too complicated
Note: quicktime files store their data in blocks called atoms, which is what I will be referring to in the next point
4) From here we want to make sure that our moov atom (the block of data that contains all the movie information is at the end of the file so that we can easily edit it without breaking data markers
We will use ffmpeg to convert our file exactly to how it is but with the moov atom at the end of the file. To do this open a terminal/command prompt and navigate to the directory where the video file is. From there run the following command
ffmpeg -i "inputFileName.mov" -c copy "outputFileName.mov"
You can change the input and output file names to whatever you like but this command will do a lossless copy of your file without re-encoding, meaning quality and file size is preserved and we are just moving around the blocks of data in the video file so we can easily edit them.
5) Then we want to copy over as much date and time data as possible from the original file to the new file as this is lost in the conversion process. We do this with exiftool with the following command
exiftool -overwrite_original -ExtractEmbedded -tagsFromFile "inputFileName.mov" -createdate -modifydate -trackcreatedate -trackmodifydate -mediacreatedate -mediamodifydate "outputFileName.mov"
This will copy the following tags to the new output file from the original file (-createdate -modifydate -trackcreatedate -trackmodifydate -mediacreatedate -mediamodifydate)
6) Now we want to look at hxd to fix our date woes. Press the Ctrl+Enter keys to navigate right to the very end of the file. From there hold shift and press the page up button a couple of times (twice for me gets me right under where we need to be but may vary for you depending on screen size) until you can see two words in the right hand column of hxd which say "udta" followed by "meta". See the included screenshots for more detail
7) Once you have found these two names we want to select everything from the 4 bytes before the word "udta" all the way to the end of the file and delete it. Again see attached screenshot
8) I have attached a file called "JustCreationDate.hex" which contains the value you need for the creation date for this file along with you're timezone of -7. Download this file and open it with hxd, have a look at it for educational value, hopefully it isnt too hard to understand. You will be able to edit the time value in this file as you need to for other videos. I have also attached a sample file of a metadata atom incase you are interested that I used for my one of my iPhone videos but changing values for these fields such as make from Apple to Sony for example is not as easily done as it requires resizing the subatoms of the main meta atom. That was just some side information so back to it!! :)
Once you have opened JustCreationDate.hex in hxd select the contents of the whole file (ctrl + a) and copy and paste it to the end of your movie file. See attached screenshot
9) We're nearly finished so hang in there. Now we just need to resize the moov atom so that programs accessing the file know where to look for information and for how long to search for. This step is a bit tricky to explain but again really is quite simple so try bear with me and hang in there. Now we want to press ctrl + f and do a find for the text string "moov", searching backwards. I have attached a screen shot just in case you need confirmation here. When we find the word moov, we want to go to the 4 bytes before the word moov and then select everything to the end of the file. Screenshot attached
This will give us the new size of the moov atom that we now need to update, the size can be found in the bottom corner of hxd. Screenshot provided
10) Note down this number, navigate again to the very end of the file and then do another ctrl + f to the moov atom (the search setting should be preserved from our previous search so just press enter :)) Now go back to the 4 bytes before the word moov and on the left hand side of the screen in hxd where all the bytes are displayed, overwrite the 4 bytes before the word moov to be the value that we have just noted down. This will tell programs that this is now the new size of the moov block and is actually how all atoms in quicktime store their size, ie the 4 bytes of data before the atom title, in this case moov. So we have: size size size size title title title title -> ## ## ## ## m o o v
11) And thats it!!! :D Hit the save button and now we should have a fully working moov file with the correct dates. Exiftool is able to validate your file for u to check all ur atom sizes are correct simply by typing
exiftool -validate out.mp4
You can check the description of any errors it finds by typing
exiftool -if "$validate ne 'OK'" -p "" out.mp4
If you get an error like this one
Warning: Truncated 'ilst' data (missing 91 bytes) - out.mp4
It means the size for that atom is incorrect and needs to be adjusted. Otherwise you should see
Validate : OK
For the +02 errors with your creation and modify dates I'm assuming these aren't written as quicktime tags as the quicktime values for these fields should not have a timezone quantifier with them. Sample output:
[QuickTime] Create Date : 2017:09:20 20:38:03
[QuickTime] Modify Date : 2017:09:20 20:38:09
I would suggest running the command again as Phil suggested with -G and -a to see where the tags have been written.
Also all of the track and media modify and create times EXCEPT creationdate are meant to be stored in UTC time. As an example from my file
[Track2] Media Modify Date : 2017:09:20 20:38:09
[QuickTime] Creation Date : 2017:09:21 06:38:03+10:00
We can see that the media modify date is 10 hours behind the creation date (ie the time difference between AUS and UTC)
To modify these trak and media modify and create dates requires calculating the time in seconds as a hexadecimal number from 1/1/1904 to the desired time and the inserting this for each trak but hopefully you wont need to worry about this as exiftool (or ffmpeg not entirely sure which one) should do it when we converted the file right at the start :)
I know it a bit confusing to explain but if you have questions just post a reply and I'll try get back to you soon
All the best of luck with it, stick with it and you'll be okay ;D
Regards, Nick
P.s. I realised after writing this that I can only upload 8 files so I have uploaded the two .hex files to dropbox instead. You can access them here :)
https://www.dropbox.com/sh/2esuwez5bk7nqut/AACoio-AM6ufyseA0rufZ_0Ua?dl=0
Wow. This sounds dangerous. I didn't read your description in detail, but if you are changing the offset of the mdat atom you will need to update a bunch of offsets in the file (eg. stco and co64 atom values, and others) or else they will be invalid. ExifTool doesn't validate these.
- Phil
The "mdta" atom isnt touched here. The only ones touched are the "meta" atom which is going to be a copy paste operation from the file I provided so this one is safe and tested. The only size which needs to be changed here is that of the "moov" atom :)
If you change the size of anything before the mdat atom, then its offset will change. You need to be sure that whatever you add/remove change is after mdat, or else you must update the necessary pointers.
Often the moov atom comes after mdat, but not always. [Added]: If moov comes before mdat, I think you are in trouble.
- Phil
That's the beauty of doing it this way. One of the first steps is to use ffmpeg to place the mdat atom and all of its data at the front/top of the file and the moov atom directly after it, so that changing the moov size won't actually affect this :)
Using ffmpeg guarantees that the moov atom will be at the end of the file. I've been editing my iPhone videos this way for over a year and a half this way now and have never had a problem :)
- Nick
Hi Nick,
Ah yes. That will avoid the problem. Smart.
- Phil
@Invindicator thank you for your reply!
Really saved me a ton of time and bandwidth.
Here is some shell for future generations to identify remote file.
#!/bin/bash
function exiftool_remote() {
set -x
echo "@see https://exiftool.org/forum/index.php/topic,9005.msg46748.html#msg46748"
echo "@see https://stackoverflow.com/a/26163980"
out=$(mktemp /tmp/etr_out1.XXXX)
out2=$(mktemp /tmp/etr_out2.XXXX)
url="${@: -1}"
start=0
end=$((10 * 1024 * 1024))
curl -L --range "0-$end" "$url" --output "$out"
ffmpeg -y -i "$out" -c copy -f mp4 "$out2"
exiftool -overwrite_original -ExtractEmbedded -tagsFromFile "$out" -createdate -modifydate -trackcreatedate -trackmodifydate -mediacreatedate -mediamodifydate "$out"
exiftool "$out2"
rm "$out"
rm "$out2"
}
exiftool_remote "https://some.remote.file/location.mov"
Note that this thread is very old and ExifTool now has the ability to write all of these tags.
- Phil