Skip to content

Instantly share code, notes, and snippets.

Last active Aug 30, 2020
What would you like to do?
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
Copy link

jhmartin commented Jul 6, 2020

For updating the timecode of a video file based on the file creation date. Not as good as proper timecode / clapboard, but at least gets you started. Run in the same directory as the source files, a subdirectory 'tc' is created and all input files placed there.

Copy link

jhmartin commented Aug 30, 2020 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