-
Hello osxphotos users! I wanted to convert all my previously loaded MPG old movies on Photos to MOV format. So that I can play with metadata which is not possible on MPG files. So I was planning on:
So far I've managed steps 1, 2 and 3. For Steps 4, 5 and 6 any recommendations/comments? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 20 replies
-
Edit: Apparently mpeg doesn't support metadata so writing with --exiftool on export won't preserve the keywords. Updated to use a sidecar file to then apply the metadata to the converted .mov file. Edit 2: fixed sidecar filename You should be able to do this all with osxphotos. I'd use an actual export to a temp folder instead of a query. The following commands are from memory so might need some slight tweaking. I suggest reading the docs to learn what each option does. 1., 2., 3. I don't use |
Beta Was this translation helpful? Give feedback.
-
Edit: The following will work but it just occurred to me you said your library used referenced files which means this won't work for your specific use case and the converted files would be in the export directory. You'd have to move them to the reference library path before the import. This could be done with another Did some testing. Previous answer is close but unfortunately the exiftool JSON sidecars encode the Create a TOML file called [export]
add_exported_to_album = "Exported_MPG_movies"
directory = "{folder_album}"
post_command = [ [ "exported", "ffmpeg -i {filepath|shell_quote} {shell_quote,{filepath.parent}/{filepath.stem}.mov}",], [ "exported", "exiftool -overwrite_original -tagsfromfile {shell_quote,{filepath}.xmp} -all:all {shell_quote,{filepath.parent}/{filepath.stem}.mov}",],]
report = "exported_mpg_files_{today}.csv"
sidecar = [ "xmp",]
uti = "public.mpeg"
verbose = true
timestamp = true Run the following command (substituting your export folder)
Then run the following command to import:
This worked in my limited test. Recommend you try with a test library until you're sure it's working to your liking. |
Beta Was this translation helpful? Give feedback.
-
Almost perfect! Only glitch is that it did not recognise the GPS info on $ osxphotos import export --no-progress --verbose --glob "*.mov" --exiftool --walk --album "{filepath.parent}" --relative-to "export" --split-folder "/"
Importing /Users/Shared/Pictures/Export/convert_mpg/export/iPhoto Events/(...)/MOV01046.mov
Imported MOV01046.mov with UUID F48B826F-54AB-4687-8CF2-7D95902CAD16
Setting metadata and location from EXIF for MOV01046.mov
Set metadata for MOV01046.mov:
title='', description='', keywords=['XXXXXXX']
No location to set for MOV01046.mov
Adding photo MOV01046.mov to 1 album
Adding photo MOV01046.mov to album iPhoto Events/(...)
Added MOV01046.mov (F48B826F-54AB-4687-8CF2-7D95902CAD16) to album iPhoto Events/(...)
Done: imported 1 file, 0 errors, $ exiftool -G -u -a "/Users/Shared/Pictures/Export/convert_mpg/export/iPhoto Events/(...)/MOV01046.mov" | grep GPS
[XMP] GPS Latitude : XX.633301 N
[XMP] GPS Longitude : YY.900000 W
[Composite] GPS Latitude Ref : North
[Composite] GPS Longitude Ref : West
[Composite] GPS Position : XX.633301 N, YY.900000 W |
Beta Was this translation helpful? Give feedback.
-
Found that on the osxphotos/osxphotos/cli/import_cli.py Line 315 in 8caee5a What is available is under XMP
So I'm putting up a code change for: #912 if latitude is None:
latitude = metadata.get("XMP:GPSLatitude"):
if longitude := metadata.get("EXIF:GPSLongitude"):
longitude = float(longitude)
longitude_ref = metadata.get("EXIF:GPSLongitudeRef")
if longitude_ref == "W":
longitude = -longitude
elif longitude_ref != "E":
longitude = None
if longitude is None:
longitude = metadata.get("XMP:GPSLongitude"): |
Beta Was this translation helpful? Give feedback.
-
Convert MPG to MOV | Applicable to other conversions on PhotosFlow: Find .MPG files (hidden or not hidden) in Photos | export & convert | import | delete
Export
mkdir export;
osxphotos export export --name MOV02979 --name MOV01046 --name MOV02838 --load-config convert.toml Auxiliary TOML file
[export]
add_exported_to_album = "Exported_MPG_movies"
directory = "{folder_album}"
query_eval = [ "photo.filename[-3:] == 'MPG'",]
post_command = [
# Select one of the following two options for ffmpeg
# ffmpeg standard quality/compression
[ "exported", "ffmpeg -i {filepath|shell_quote} {shell_quote,{filepath.parent}/{filepath.stem}.MOV}",],
# ffmpeg better quality/slower conversion
# [ "exported", "ffmpeg -i {filepath|shell_quote} -c:v libx264 -preset veryslow -crf 17 {shell_quote,{filepath.parent}/{filepath.stem}.MOV}",],
[ "exported", "exiftool -overwrite_original -tagsfromfile {shell_quote,{filepath}.xmp} -all:all {shell_quote,{filepath.parent}/{filepath.stem}.MOV}",],
[ "exported", "exifcreatedate {shell_quote,{filepath.parent}/{filepath.stem}.MOV}",],
[ "exported", "exifsetMVI {shell_quote,{filepath.parent}/{filepath.stem}.MOV}",],
]
report = "exported_mpg_files_{today}.csv"
sidecar = [ "xmp",]
uti = "public.mpeg"
skip_original_if_edited = true
verbose = true
timestamp = true
no_progress = true
export_as_hardlink = true Import
osxphotos import export --no-progress --verbose --timestamp --glob "*.MOV" --exiftool --walk --album "{filepath.parent}" --relative-to "export" --split-folder "/" --report "imported_mpg_files_{today}.csv" Go to album "Exported_MPG_movies"(named above) and delete
|
Beta Was this translation helpful? Give feedback.
-
An update on this topic. I am using this approach very successfully. It's a life/saver. Thanks! Only twist is that, following the import -- as we know, it takes the Album names from the folders on the filesystem -- it ends-up creating a second Album on Photos with the same name. Please note many of my albums have international characters.
I've changed the name of the algum to "ÁLBUM"in the log file. 2023-05-21 17:47:40.850781 -- Importing /Users/Shared/Pictures/Export/rotate_uD800/export/iPhoto Events/2000-2005/ÁLBUM/PC100030_rotated.JPG
2023-05-21 17:47:41.297356 -- Imported PC100030_rotated.JPG with UUID 59C5D6D0-CF8D-4B9A-90AE-0582A94E12F3
2023-05-21 17:47:41.298081 -- Setting metadata and location from EXIF for PC100030_rotated.JPG
2023-05-21 17:47:41.696440 -- Set metadata for PC100030_rotated.JPG:
2023-05-21 17:47:41.697298 -- title='', description='OLYMPUS DIGITAL CAMERA ', keywords=['XXXX']
2023-05-21 17:47:41.697613 -- No location to set for PC100030_rotated.JPG
2023-05-21 17:47:41.698971 -- Adding photo PC100030_rotated.JPG to 1 album
2023-05-21 17:47:41.699287 -- Adding photo PC100030_rotated.JPG to album iPhoto Events/2000-2005/ÁLBUM
2023-05-21 17:47:45.819553 -- Creating album 'ÁLBUM'
2023-05-21 17:47:46.009084 -- Added PC100030_rotated.JPG (59C5D6D0-CF8D-4B9A-90AE-0582A94E12F3) to album iPhoto Events/2000-2005/ÁLBUM
2023-05-21 17:47:46.028648 -- Wrote import report to imported_rotate_2023-05-21.csv
2023-05-21 17:47:46.029109 -- Done: imported 1 file, 0 errors, Wild guess!!! Would this be a Unicode UTF-8 NFD topic? I'm running some tests to understand:
Side Note: Will add one more example of this transform/convert process (#909) which I'm using to fix directly on the JPG files the appropriate orientation for some old Pics (of one particular camera which did not record the pic orientation correctly!) which even though are edited/rotated in Photos, Photos does not create an edited file representation and |
Beta Was this translation helpful? Give feedback.
-
@oPromessa I'm trying to replicate all these issues so I can write tests for them then fix them. Have done some initial refactoring of the unicode code in #1085
In my tests, Photos does not create a duplicate album if the album exists at the top level of the library but it does create a duplicate album if the album is in a folder. Have you seen an occurrence where you got a duplicate top-level album? Album In folder: duplicates (also duplicate folder when folder name is NFC vs NFD) |
Beta Was this translation helpful? Give feedback.
Convert MPG to MOV | Applicable to other conversions on Photos
Flow: Find .MPG files (hidden or not hidden) in Photos | export & convert | import | delete
Export
--not-hidden
flag to bypass them or the--hidden
flag …