Last active
May 30, 2022 14:49
-
-
Save mono0x/8f84870ef4230b15dde2b9f419b7bc7c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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