“Aaaaarg – the timecode on my source clips doesn’t match the actual time they were shot!”
If your camera date/time was accurate, you can fix the timecode by transcoding the source files based on their actual creation time (as saved to your SD/XQD/SSD card in-camera). You’ll need to run some scripts. This solution is from a macOS POV. Fix your timecode to match the real time (in macOS) below.
Why is the Timecode goofy?
When editing my first multi-camera shoot, I found that the timecode in the recorded files did not match real time, despite Timecode Origin being set to Current Time in both of my [Nikon Z] cameras. So, laying out clips on the timeline and syncing them with the separate audio track was a real PITA.
By default, on my Nikon Z cameras, Record Timecode is off. When turned on, Timecode Origin is set to Current Time. Sounds great, yeah?
But the default Timecode Count-up method is set to [Record run], meaning timecode only increments when recording. So, if you stop recording at midday for a break of 2 hours, 13 minutes, and 53 seconds, the next shot will start back at midday (+ 1 frame) rather than the actual time.
To ensure your timecode reflects real time in each clip, you must set Timecode Count-up to [Free run] in your camera settings. Nikon Z 8 Timecode Settings.
How to fix (to the nearest second)
While staring morosely at the folder with my source clips, I noticed the file creation dates were accurate.
So, off to ChatGPT I went, and after an hour of trial and error, I had a working solution. It was much quicker and more accurate than manually editing the timecode in DaVinci Resolve.
Solution
Using basic scripting, we can re-encode the source files with new timecode metadata based on the modification date. This requires FFmpeg (installed via Homebrew).
Fixing Timecode to Match Real Time (macOS)
1. Install Homebrew & FFmpeg
First, install Homebrew (if you don’t have it yet). Open Terminal (search “Terminal” in Spotlight) and paste:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Once installed, add FFmpeg by running:
brew install ffmpeg
2. Duplicate and Navigate to Your Video Files
- Duplicate your source video folder (the script rewrites the new files over the old ones – by design). Make a backup first!
- Open the Terminal application
- Type
cd
(with a space aftercd
) - Drag & drop the folder with your video files into the Terminal window
- Press Enter
💡 Tip: This saves you from manually typing the file path!
3. Save & Run the Fix-Timecode Script
A. Create the Script
- Open TextEdit
- Click Format > Make Plain Text
- Copy & paste the following script:
#!/bin/bash
for file in *.MOV; do
echo "Processing: $file"
# Extract existing timecode (for reference)
existing_tc=$(ffmpeg -i "$file" 2>&1 | grep -o 'timecode [0-9:]*' | awk '{print $2}')
echo " Existing Timecode: $existing_tc"
# Extract file creation time
creation_time=$(mdls -raw -name kMDItemContentCreationDate "$file" | tr -d 'Z')
# Extract frame rate (detects 25fps or 50fps)
fps=$(ffprobe -v error -select_streams v -show_entries stream=r_frame_rate -of csv=p=0 "$file" | awk -F'/' '{print $1/$2}')
if [[ "$fps" == "25" ]]; then
timecode_format="HH:MM:SS:FF"
else
timecode_format="HH:MM:SS;FF" # Drop-frame notation for 50fps
fi
echo " Detected FPS: $fps ($timecode_format format)"
# Convert creation time to HH:MM:SS
timecode=$(date -j -f "%Y-%m-%d %H:%M:%S %z" "$creation_time +0000" "+%H:%M:%S:00")
# Use a temporary file to modify metadata
temp_file="temp_$file"
ffmpeg -i "$file" -c copy -timecode "$timecode" "$temp_file"
# Replace original file with updated file
if [[ -f "$temp_file" ]]; then
mv "$temp_file" "$file"
echo " Updated Timecode: $timecode"
else
echo " Error updating $file"
fi
done
- Click File > Save
- Name it fix_timecode.sh (ensure it has the .sh extension)
- Save it in the same folder as your video files
B. Make the Script Executable
Back in Terminal, navigate to your video folder again (cd [drag & drop folder]
).
Then make the script executable by running:
chmod +x fix_timecode.sh
C. Run the Script
Now, execute the script with:
./fix_timecode.sh
✅ What Happens?
- The script reads the creation timestamp from each file
- It detects the frame rate (25fps or 50fps)
- It applies the correct timecode format
- It updates each file’s timecode without re-encoding
⚠️ Caveats & Notes
- Your camera clock must have been set correctly when recording
- Camera clock accuracy drifts over time – sync your cameras soon before the shoot.
- Filesystem timestamps may not have sub-second precision, so fine-tuning might still be needed
- Drop Frame vs. Non-Drop Frame is not covered here.
- Timecode only spans 24 hours, so multi-day shoots need additional tagging/grouping.
Leave a Reply