Extract Samsung Motion Photos from Batch

Started by SpyHunter, August 02, 2024, 08:00:46 AM

Previous topic - Next topic

SpyHunter

I would like to extract the videos from Samsung jpgs and place them into a subfolder. I've been able to get the following bat file to work, but it has two problems. I can't use it to drag and drop multiple files or a single folder. And the mp4 file it creates has the .jpg in the filename title.

exiftool -k -b -EmbeddedVideoFile %* >%*.mp4

This works well to leave the original jpg intact and creates an mp4, but with .jpg in it's title "20240728_191617.jpg.mp4". Anything else I try just adds the text as a name - %%F, etc.


I was able to get a file rename working for iphone mov files, with many suggestions from this forum. Thank you all for that! The rename appended the CreationDate to the beginning of the original filename with the below bat. This is my ultimate goal for the mp4s --> extract from jpg and append CreateDate to the title. I don't have a problem if this has to be in two steps with two separate bat files.

exiftool -d "%%Y-%%m-%%d--%%H%%M%%S_%%%%f.%%%%e" "-filename<CreationDate" -k %*

This works great to drag and drop multiple files or even a single folder. I would just like to get similar functionality from the first script.

Thank you,
Joe



StarGeek

Quote from: SpyHunter on August 02, 2024, 08:00:46 AMexiftool -k -b -EmbeddedVideoFile %* >%*.mp4

This works well to leave the original jpg intact and creates an mp4, but with .jpg in it's title "20240728_191617.jpg.mp4". Anything else I try just adds the text as a name - %%F, etc.

Exiftool never sees the %* and >. These are handled by the command line before anything is passed to exiftool. So you can't use exiftool % variables such as %f with them.

On the batch file side, you can edit the percent varible. See "Using batch parameters". I think what you would want to use is %~dpn* or maybe %~dp1%~n*, though I'm not sure if you would use the asterisk or the number 1.

I haven't tested it, but on the exiftool side, maybe something like
exiftool -b -W %d%f_%t%-c.%s -EmbeddedVideoFile /path/to/files/
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

SpyHunter

Quote from: StarGeek on August 02, 2024, 12:24:51 PMI haven't tested it, but on the exiftool side, maybe something like
exiftool -b -W %d%f_%t%-c.%s -EmbeddedVideoFile /path/to/files/

Thank you! That worked very well! And I'm fine with entering commands directly. I'm not very good with batch scripts, so that's something I can attempt on down the road.

I am having an issue with the CreateDate. I think I read in another post where you mentioned the Samsung timestamps need to be adjust because they don't include a time zone. All the new EXIF dates look like they need adjusted. However, I can use -tagsFromFile to copy from the original JPG and it correctly updates the CreateDate. That's really the only date I need adjusted so I can rename MP4 with the script from my first post. (Should have been CreateDate instead of CreationDate. That's what I used to organize iPhone JPGs)


I'm using exiftool-12.92 and here is the original JPG:

C:\zzTestEXIF\zSamsung Motion Photo\Test>exiftool.exe -k -s -time:all "C:\zzTestEXIF\zSamsung Motion Photo\Test\2024-07-28--191617_20240728_191617 - Copy.jpg"
FileModifyDate                  : 2024:07:28 19:16:20-04:00
FileAccessDate                  : 2024:08:03 22:17:06-04:00
FileCreateDate                  : 2024:08:03 22:13:08-04:00
ModifyDate                      : 2024:07:28 19:16:17
DateTimeOriginal                : 2024:07:28 19:16:17
CreateDate                      : 2024:07:28 19:16:17
OffsetTime                      : -04:00
OffsetTimeOriginal              : -04:00
SubSecTime                      : 684
SubSecTimeOriginal              : 684
SubSecTimeDigitized             : 684
TimeStamp                       : 2024:07:28 19:16:18.017-04:00
SubSecCreateDate                : 2024:07:28 19:16:17.684
SubSecDateTimeOriginal          : 2024:07:28 19:16:17.684-04:00
SubSecModifyDate                : 2024:07:28 19:16:17.684-04:00


Here is the MP4:

C:\zzTestEXIF\zSamsung Motion Photo\Test>exiftool.exe -k -s -time:all "C:\zzTestEXIF\zSamsung Motion Photo\Test\2024-07-28--231620_20240728_191617.mp4"
FileModifyDate                  : 2024:08:03 21:47:44-04:00
FileAccessDate                  : 2024:08:03 22:16:25-04:00
FileCreateDate                  : 2024:08:03 21:46:20-04:00
CreateDate                      : 2024:07:28 23:16:20
ModifyDate                      : 2024:07:28 23:16:20
TrackCreateDate                 : 2024:07:28 23:16:20
TrackModifyDate                 : 2024:07:28 23:16:20
MediaCreateDate                 : 2024:07:28 23:16:20
MediaModifyDate                 : 2024:07:28 23:16:20


If I use -tagsFromFile it updates CreateDate:

C:\zzTestEXIF\zSamsung Motion Photo\Test>exiftool.exe -k -s -time:all "C:\zzTestEXIF\zSamsung Motion Photo\Test\20240728_191617 - Copy.mp4"
FileModifyDate                  : 2024:08:04 00:08:05-04:00
FileAccessDate                  : 2024:08:04 00:08:24-04:00
FileCreateDate                  : 2024:08:04 00:07:39-04:00
TrackCreateDate                 : 2024:07:28 23:16:20
TrackModifyDate                 : 2024:07:28 23:16:20
MediaCreateDate                 : 2024:07:28 23:16:20
MediaModifyDate                 : 2024:07:28 23:16:20
DateTimeOriginal                : 2024:07:28 19:16:17
CreateDate                      : 2024:07:28 19:16:17
ModifyDate                      : 2024:07:28 19:16:17

Is there a way I can copy the tag(s) with the -EmbeddedVideoFile script? If not, can I iterate through a folder with a second -tagsFromFile?

Also, where can I find documentation -EmbeddedVideoFile? This tool is so powerful and there's already a ton of documentation! I can't even image all the work that's gone into this. I really appreciate everyone's efforts!

StarGeek

Quote from: SpyHunter on August 04, 2024, 12:23:20 AMI am having an issue with the CreateDate. I think I read in another post where you mentioned the Samsung timestamps need to be adjust because they don't include a time zone.

It's not Samsung time stamps, it's video time stamps. Most video time stamps are supposed to be set to UTC, not local time.

All the new EXIF dates look like they need adjusted.

Actually, from the data you're showing, they are (almost) correct. Your video shows a Quicktime:CreateDate of "2024:07:28 23:16:20" and an EXIF:CreateDate of "2024:07:28 19:16:17" and that you are in a -04:00 time zone. When "2024:07:28 19:16:17" is adjusted to UTC by adding four hours to compensate for the time zone, the result is "2024:07:28 23:16:17", off by a few seconds. But most cameras are a bit inconsistent when it comes to the exact second in videos.

Of course, it's up to you if you want to change these. But know that programs that correctly read the data will show you a different time. For example, if you right-click->Properties->Details tab on a file, you will see that the date under "Media Created" will be adjusted from UTC to the local time zone of the computer.

QuoteIs there a way I can copy the tag(s) with the -EmbeddedVideoFile script?

Maybe. There's a new SetTags helper function which might do this, except I'm not sure how it could be used with the -W (-TagOut) option. Maybe adding this to the command?
-api "Filter=SetTags"

QuoteAlso, where can I find documentation -EmbeddedVideoFile?

There is none. Many of the thousands of tags exiftool can read don't have any documentation on them. It's only known that they exist. In this case, someone saw that there was something new with the motion jpegs, provided a sample, and Phil was able to figure out how to extract it. Samsung didn't provide any information about the tags.

The tags that exiftool knows are only those that there was a spec on, such as the EXIF and XMP specs, or they have been figured out by the photography/programming community at large.

As an example, try running this command on one of your unedited files
exiftool -G1 -a -s -u file.jpg

If you look the output, you may see something like this
[IFD0]          Exif_0x0220                     : 0
[IFD0]          Exif_0x0221                     : 0
[IFD0]          Exif_0x0222                     : 0
[IFD0]          Exif_0x0223                     : 0
[IFD0]          Exif_0x0224                     : 0
[IFD0]          Exif_0x0225                     :
[Samsung]       SamsungTrailer_0x0a01Name       : Image_UTC_Data
[Samsung]       SamsungTrailer_0x0aa1Name       : MCC_Data
[Samsung]       SamsungTrailer_0x0c61Name       : Camera_Capture_Mode_Info
[Samsung]       SamsungTrailer_0x0c61           : (Binary data 1 bytes, use -b option to extract)

These are completely unknown tags. There are literally thousands, more likely tens of thousands, of these unknown tags.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).