0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

macの写真ライブラリから、写真バックアップ用のBlu-rayディスクを作る時の備忘録

Posted at

iCloud上の写真をBlu-rayディスクに移す用事があったんですけど、予想以上に相当めんどくさかったので、次もしもう1度同じことをやる時のために、また同じ問題にぶち当たってる人のために、議事録としてここに書いておきます。

iCloudの写真をローカルに落とす方法

システム環境設定→AppleID→「iCloud」の項目の「写真」の項目をオフにする→mac上にデータを残すを選択→処理が完了するまで待つ

これをやっておかないとめんどくさいことになる

「写真」アプリの元データはどこ?

写真アプリは、「ユーザー/ピクチャ/Photos Library.photoslibrary」のデータを読み取っている
パッケージの内容を表示すれば、元データに辿り着くことができる
image.png
image.png
この「originals」フォルダの中に、写真のオリジナルのデータが入っている

一昔前まで(Catalina以前)は、↓こんな感じで年月日ごとに分類されてたのに、、、なぜ仕様変更した、、こっちの方がよかった、、
image.png
(参考:https://applica.info/mac-picture

jpegにする

この元データをそのままBlu-rayに入れることも考えたが、heicイメージだと互換性が弱いから、全てjpegにしようと思った

jpegにするためには、写真アプリ上で書き出したい写真を選択した後、メニューバーの「ファイル→書き出す→〇〇項目を書き出す→
image.png
→書き出す」

でできる
写真アプリから直接finder上にドラックアンドドロップしても書き出しされるが、あまり安定しないのでおすすめしない

写真データの「作成日」「変更日」を、実際に写真を撮った日付に修正

image.png
書き出した写真のデータは、作成日や変更日が、書き出した日付になっている
これだと、並び替えたり分類したりがやりづらいので、揃えたい

参考: https://note.com/wtr0201/n/nbfe2e6f41dad

for file in "$@"
do
   touch -t $(date -v+9H -jf "%Y%m%d%H%M" $(mdls ${file} | grep kMDItemContentCreationDate | head -n1 | awk '{gsub("[^[:digit:]]+"," ");print $1$2$3$4$5}') +%Y%m%d%H%M) ${file}
done

Automatorでアプリケーションを作成、「シェルスクリプトを実行」でシェルを「/bin/zsh」入力の引き渡しを「引数として」を指定し、上記をコピペして保存すれば作成・変更日の変換アプリが完成。
該当の写真ファイルを一括選択で作った変換アプリのアイコンにドラッグ&ドロップすれば変換完了(のはず)

動画データの「作成日」「変更日」を、実際に動画を撮った日付に修正

上の方法では、写真の日付を修正することはできても、動画の日付を修正することはできない
なので、どうにかできるようにしてみた
まず、ffprobeというものが必要なので、ffprobeが含まれているffmpegをインストールします。(homebrewも必要)

% brew install ffmpeg

そしたら上と同じような手順で、下記をコピペして保存して使うだけ

for file in "$@"
do
   touch -t $(/usr/local/bin/ffprobe -show_format -v error ${file} | grep 'com.apple.quicktime.creationdate' | head -n1 | awk '{gsub("[^[:digit:]]+"," ");print $1$2$3$4$5}') ${file}
done

年月でフォルダ分けしたい

参考: https://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q10193263630 https://youtu.be/bdGJLvMxGUg
参考元は年月日でフォルダ分けしていたが、別にそこまでする必要はないので年月だけフォルダ分けするやつがこの下記のやつ

tell application "Finder"
	set aFol to (insertion location) as alias
	if (aFol as string) does not end with "Desktop:" then -- デスクトップにあるファイルは処理しない
		tell folder aFol
			
			set aList to every file as alias list
			
			repeat with i in aList
				set aFile to contents of i
				set posixAFile to POSIX path of aFile -- POSIX pathに変換
				set creationDate to creation date of aFile -- 作成日を取得
				set aYear to year of creationDate -- 年を取得
				set aMonth to month of creationDate as number -- 月を取得
				set aDay to day of creationDate -- 日を取得
				if aMonth < 10 then set aMonth to "0" & aMonth -- 10月以前なら0を付ける
				if aDay < 10 then set aDay to "0" & aDay -- 10日以前なら0を付ける
				
				if not (exists folder (aYear as text)) then ¬
					make new folder at aFol with properties {name:aYear} -- 年のフォルダを作成
				
				tell application "Finder"
					set yearFolder to (aFol & aYear as text) as alias -- 年のフォルダのエイリアス
					tell folder yearFolder
						if not (exists folder (aMonth as text)) then
							make new folder at yearFolder with properties {name:aMonth} -- 月のフォルダを作成
						end if
					end tell
					
				end tell
				set bFol to POSIX path of ((aFol & aYear & ":" & aMonth as text) as alias) -- 移動先のフォルダのパス
				do shell script "mv " & quoted form of posixAFile & " " & quoted form of bFol -- 移動
			end repeat
			
		end tell
	end if
end tell

macはブルーレイにデータ書き込みできない(はず、多分)

なのでwindowsを用意します
macで用意したデータをどうにかしてwindowsに運びましょう
zipにするときはkekaとか使うと.DS_Storeとか消してくれるからおすすめ

で、データを入れるときはUSBメモリとして使用じゃない方の方が書き込み安定した

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?