Last active
August 30, 2020 17:04
-
-
Save jhmartin/1c9051dc297e6c3972aa9932d374f814 to your computer and use it in GitHub Desktop.
Apply File Creation Time as TimeCode
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
mkdir tc | |
$files = Get-ChildItem * -include @("*.mp4", "*.mov") | |
foreach ($file in $files) { | |
$fileDate=(Get-Item $file).creationTime | |
$dateParts = $filedate -split " " | |
$fileParts = $file.Name -split "\." | |
$fbname = $fileParts[0] | |
$fext = $fileParts[1] | |
$ftime = $dateParts[1] | |
$fbase = $file.BaseName | |
$cm = " C:\Users\Jason\Downloads\ffmpeg-4.3-win64-static\bin\ffmpeg.exe -i $file -vcodec copy -timecode $ftime```:00 tc/$fbname-tc.$fext" | |
echo $cm | |
iex $cm | |
$newFile = Get-ChildItem tc/$fbname-tc.$fext | |
$newFile.CreationTime = $file.CreationTime | |
$newFile.LastWriteTime = $file.LastWritetime | |
$newFile.LastAccesstime = $file.LastAccesstime | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://stackoverflow.com/questions/4037939/powershell-says-execution-of-scripts-is-disabled-on-this-system describes what to do if you get:
“execution of scripts is disabled on this system.”
Run-As-Administrator powershell:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted