Hi peeps,
I'm having a bit of hard time getting to write some info on a bunch of mp4 metadata.I have encoded some video files but I want to transfer the original metadata into the compressed ones (especially the encoding date and the original author/artist, comments and copyright logo). The date and time is copied just fine from the original video file. However running the same
"exiftool" command for:
"Author", "Copyright", and "Comments" tag produces no change in the target file.
I run this command to copy the original date/time from source file:
exiftool -tagsfromfile src.mp4 -quicktime:createdate -quicktime:modifydate -trackcreatedate -trackmodifydate -mediacreatedate -mediamodifydate dst.mp4
"src.mp4" is the original unmodified file and "dst.mp4" is the edited file for which I want to write some tag values from the source.
Doing this:
exiftool -tagsfromfile src.mp4 -quicktime:artist="title displayed in the src.mp4" -quicktime:comment="comment on src.mp4" -quicktime:userdata_cpy="info from src.mp4" dst.mp4
I get:
QuoteWarning: Tag 'quicktime:Artist' does not exist
Warning: Tag 'quicktime:Comment' does not exist
Warning: Tag 'userdata_cpy' does not exist
1 image files updated
"1 image file updated". In fact the code writes data in the destination file only in XMP group which is empty (no data) in the original file. The only info written to the target file is the "Artist" tag as well as "CreateDate" and "ModifyDate" copied from src.mp4 file.
"Group" and "Tag" labels shown in the code above are copied from the "src.mp4" file using this command:
exiftool -a -g1 -s src.mp4
Since I'm a basic user in the command-line world, I'm not able to debug the source of these errors on my own. I hope Phil or someone will lead me in the right direction on this one.
I'm sure, is a simple fix but I can't figure it out in a reasonable timeframe....
Thanks,
TM
ExifTool currently writes only XMP to MP4 videos. It doesn't write the QuickTime tags.
- Phil
Hi Phil,
Oh gosh...I didn't know that!!! I feel a little confused though....I copied the date and time from the source video with "-quicktime:createdate" and "-quicktime:modifydate" switch and it worked just as intended.But it didn't work when I tried to copy more tags in it. Is it because exiftool only writes partially in "quicktime"?
What kind of tool did the original author use to add the copyrighted info and other comments in quicktime to his videos, I wonder?
Another important question I have is, batch processing. If I have, let's say, 10 mp4 files inside a directory which are the source files, for that matter:
dir_a:
1.mp4, 2.mp4, 3.mp4......10.mp4 (original files)
and the encoded files above inside directory b, labeled the same:
dir_b:
1.mp4, 2.mp4, 3.mp4......10.mp4
What I want to do is to copy original tags from:
1.mp4, 2.mp4, 3.mp4......10.mp4 in directory a, to
1.mp4, 2.mp4, 3.mp4......10.mp4 in directory b,respectively.
So, what could be an efficient/effective and correct line of code to copy metadata from files in one folder to another, in batch mode?
|dir_a |copy meta| dir_b |
|______|________|______|
|1.mp4 | ----> | 1.mp4 |
|2.mp4 | ----> | 2.mp4 |
|3.mp4 | ----> | 3.mp4 |
| ... | ----> | ... |
|10.mp4| ----> |10.mp4|
In the mean time I'm trying this line, but it's not working:
exiftool -tagsfromfile c:\dir_a -quicktime:createdate -quicktime:modifydate -trackcreatedate -trackmodifydate -mediacreatedate -mediamodifydate c:\dir_b
QuoteWarning: Error opening file - c:\dir_a
1 directories scanned
0 image files updated
3 image files unchanged
The above is similar to the script in my 1st post but w/out the 3 tagnames that exiftool apparently can't write to "quicktime".
And here is the meta listed for both directories which I need to change (this just for testing):
exiftool -quicktime:createdate -quicktime:modifydate -trackcreatedate -trackmodifydate -mediacreatedate -mediamodifydate c:\dir_a c:\dir_b
Quote======== c:/dir_a/1.mp4
Create Date : 2012:12:06 20:35:43
Modify Date : 2012:12:06 20:35:43
Track Create Date : 2012:12:06 20:35:43
Track Modify Date : 2012:12:06 20:35:43
Media Create Date : 2012:12:06 20:35:43
Media Modify Date : 2012:12:06 20:35:43
======== c:/dir_a/2.mp4
Create Date : 2012:12:06 21:14:05
Modify Date : 2012:12:06 21:14:05
Track Create Date : 2012:12:06 21:14:05
Track Modify Date : 2012:12:06 21:14:05
Media Create Date : 2012:12:06 21:14:05
Media Modify Date : 2012:12:06 21:14:05
======== c:/dir_a/3.mp4
Create Date : 2012:12:06 23:11:08
Modify Date : 2012:12:06 23:11:08
Track Create Date : 2012:12:06 23:11:08
Track Modify Date : 2012:12:06 23:11:08
Media Create Date : 2012:12:06 23:11:08
Media Modify Date : 2012:12:06 23:11:08
======== c:/dir_b/1.mp4
Create Date : 2014:07:10 12:28:25
Modify Date : 2014:07:10 12:28:25
Track Create Date : 2014:07:10 12:28:25
Track Modify Date : 2014:07:10 12:28:25
Media Create Date : 2014:07:10 12:28:25
Media Modify Date : 2014:07:10 12:28:25
======== c:/dir_b/2.mp4
Create Date : 2014:07:10 12:48:48
Modify Date : 2014:07:10 12:48:48
Track Create Date : 2014:07:10 12:48:48
Track Modify Date : 2014:07:10 12:48:49
Media Create Date : 2014:07:10 12:48:49
Media Modify Date : 2014:07:10 12:48:49
======== c:/dir_b/3.mp4
Create Date : 2014:07:10 15:39:38
Modify Date : 2014:07:10 15:39:38
Track Create Date : 2014:07:10 15:39:38
Track Modify Date : 2014:07:10 15:39:38
Media Create Date : 2014:07:10 15:39:38
Media Modify Date : 2014:07:10 15:39:38
2 directories scanned
6 image files read
Thanks a lot for your help,
TM
-tagsfromfile takes a single file as argument, not a directory. To do what you want you'll have to loop over the files in directory a. E.g., like so:
cd c:\dir_a
for file in *.mo4; do
exiftool -tagsfromfile c:\dir_a\$file -quicktime:createdate -quicktime:modifydate -trackcreatedate -trackmodifydate -mediacreatedate -mediamodifydate c:\dir_b\$file
done
Note though that above is Unix/Mac for loop syntax on windows it is slightly different and you'll probably have to use % instead of $ too. But you get the general idea, I think.
OK, you're right. ExifTool will update a few QuickTime date/time tags. See the QuickTime Tags documentation (https://exiftool.org/TagNames/QuickTime.html) for details.
- Phil
Hello Hayo,
Quote-tagsfromfile takes a single file as argument, not a directory.
Yes, I'm aware that I need to feed a file in the script for that option to work. But I just tried like that to see if
-tagsfromfile would be able to see inside the directory for files and to hopefully copy their meta in consecutive order which it didn't, apparently.
Thank you for writing the code for me, btw.I need to understand how that will work for my situation.
First of, afaik, the string should start by typing the name of the program one wants to execute which is "exiftool" in this case.Your script starts by changing the default directory to, "c:dir_a". Why so? Secondly, I have no idea what the 2nd line does:
for file in *.mo4; do
What is
*.mo4? Did you misspell this and meant
*.mp4, instead?The only part of your script that is very clear to me is the 3rd line. I changed the syntax to
%file, as per your suggestion, since I'm doing this on windows platform and fired it up.
Well, it didn't do anything...
I got this:
exiftool -tagsfromfile c:\dir_a\%file -quicktime:createdate -quicktime:modifydate -trackcreatedate -trackmodifydate -mediacreatedate -mediamodifydate c:\dir_b\%file
QuoteWarning: Error opening file - c:\dir_a\%fileile
Error: File not found - c:/dir_b/%file
0 image files updated
1 files weren't updated due to errors
I've come to understand that this may not be doable in batch mode after all, since the program doesn't know what file name to copy the meta from inside the source directory (dir_a) unless I instruct it to specifically copy from file name (e.g. c:\dir_a\1.mp4). Further, it wont know which file to paste the copied data to inside the destination directory (dir_b), unless I specifically tell it to paste to e.g. c:\dir_b\1.mp4. This can be achieved by doing it manually for each file, one by one...which is fine by me. However, in case I need to copy metadata for thousands of files, that becomes very tedious process and probably error prone.
Nonetheless, this is my own little observation and of course some more advanced programming skills may remedy this issue.
@Phil.
Thanks for pointing out that QT documentation.Very useful, indeed. I have skimmed through it and the program doesn't write to most of quicktime tags, unfortunately."CreateDate" tag is marked as non-writable in that document. However, I have actually written data to that tag name in my mp4 files.
(http://s7.postimg.org/h85v62s3b/exiftool_qt_tag.jpg) (http://postimg.org/image/h85v62s3b/)
Will you support writing all (or at lest most) QT tags in the future, with exiftool?
Thanks,
TM
ExifTool will update QuickTime:CreateDate (look at the QuickTime MovieHeader tags -- it shows as writable in this table). You can also write XMP:CreateDate to QuickTime files. The non-writable QuickTime tag you referenced is called CreationDate.
I think that in your script it should be "*.mp4", and I thought that batch variables looked like this: "%file%", but I can't help much with this.
- Phil
I found this post in search of a way to edit GPSCoordinates for a smartphone video. I can't manage to do it, can someone write me the right command to do it?
I tried:
exiftool -quicktime:GPSCoordinates="41.117600° N, 16.897100° E"
exiftool -location.ISO6709="41.117600° N, 16.897100° E"
but of course I got no results. I've been searching for a tool to edit Quicktime tags, but I found nothing.
Best regards.
ExifTool currently has very limited ability to write MP4 videos -- it basically only writes XMP information. So this will work
exiftool -xmp:GPSlatitude=41.117600 -xmp:gpslongitude=16.897100 FILE
- Phil
Thanks, it works. Unfortunately Google Photos doesn't seem to like exif GPS coordinates, so I still need to find a way to edit Quicktime tags. :)
You mean XMP, not EXIF. But right, XMP isn't well supported by other applications in QuickTime-format files (MOV,MP4).
- Phil