Skip to content

Instantly share code, notes, and snippets.

@retorillo
Last active April 12, 2021 12:56
Show Gist options
  • Save retorillo/6e221f328c12b2e65fa888f3849f19b7 to your computer and use it in GitHub Desktop.
Save retorillo/6e221f328c12b2e65fa888f3849f19b7 to your computer and use it in GitHub Desktop.
$TZ = 9; $PN = 'メディアの作成日時'; $E = @{ H='AVC'; X='HENC' }; $S = new-object -comObject shell.application; $I = -1; $D = $S.namespace((get-item .).fullName); 0..512 | foreach { $prop = $D.getDetailsOf($null, $_); if ($prop -eq $PN) { $I= $_; } }; if ($I -ne -1) { dir *.mp4 | foreach { $F = $D.parseName($_.name); $W = '{0}.wav' -f $_.baseName; $M = ($_.name + "`t" + $D.getDetailsOf($F, $I)) -match '^G(H|X)([\d]{2})[\d]{4}.((?i)mp4)\t[^\d]*(\d{4})[^\d]+(\d{1,2})[^\d]+(\d{1,2})[^\d]+(\d{1,2})[^\d]+(\d{1,2}).*$'; if ($M) { $G = $Matches; $J = ((new-object datetime ($G[4], $G[5], $G[6], $G[7], $G[8], "0")) - [timespan]::fromhours($TZ)); $N = 'GOPRO_{0}_C{1}_{2}_{3}' -f $J.toString('yyyyMMdd_HHmm'), $G[2], $E[$G[1]], $_.baseName; rni $_.name ('{0}.mp4' -f $N); if (test-path $W) { rni $W ('{0}.wav' -f $N) } } } }
@retorillo
Copy link
Author

GoProをRAWオーディオで撮影した場合に出力されるWAVファイルも合わせて変更されるように改良しました

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment