Skip to content

Instantly share code, notes, and snippets.

@mono0x
Last active May 30, 2022 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mono0x/8f84870ef4230b15dde2b9f419b7bc7c to your computer and use it in GitHub Desktop.
Save mono0x/8f84870ef4230b15dde2b9f419b7bc7c to your computer and use it in GitHub Desktop.
$ErrorActionPreference = 'Stop'
$outputPath = "D:\Desktop\$(date '+%Y%m%d%H%M%S').mp4"
$listFile = New-TemporaryFile
try {
$files = $args | ForEach-Object { Get-Item $_ }
foreach ($file in $files) {
Out-File -Encoding UTF8 -Append -FilePath $listFile -InputObject "file '$($file.FullName)'"
}
$argFile = New-TemporaryFile
$creationTime = try {
Out-File -Encoding UTF8 -FilePath $argFile -InputObject $files[0].FullName
exiftool.exe -CreateDate -api largefilesupport=1 -api QuickTimeUTC -charset FileName=UTF8 -s -s -s -d '%Y-%m-%d %H:%M:%S' -@ $argFile
}
finally {
Remove-Item -Force $argFile
}
ffmpeg.exe -f concat -safe 0 -i $listFile -metadata creation_time="$creationTime" -c copy $outputPath
}
finally {
Remove-Item -Force $listFile
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment