Skip to content

Instantly share code, notes, and snippets.

@jhmartin
Last active August 30, 2020 17:04
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 jhmartin/1c9051dc297e6c3972aa9932d374f814 to your computer and use it in GitHub Desktop.
Save jhmartin/1c9051dc297e6c3972aa9932d374f814 to your computer and use it in GitHub Desktop.
Apply File Creation Time as TimeCode
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
}
@jhmartin
Copy link
Author

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

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