Preserving Video Metadata: A Complete Guide for ResourceSpace Users
Introduction
When working with video files in ResourceSpace, preserving original metadata is crucial for:
– Maintaining accurate creation dates and timestamps
– Preserving important technical information
– Ensuring proper archival practices
– Maintaining timecode information for editing
– Tracking the original source of content
The Metadata Challenge
During transcoding, whether through DaVinci Resolve or FFmpeg, files often lose critical metadata:
– Original creation dates are replaced with export dates
– Camera/device information may be lost
– Timecodes can be reset
– Essential technical metadata may disappear
Solution Overview
This guide provides a complete workflow for:
1. Properly exporting from DaVinci Resolve
2. Using a metadata preservation script
3. Alternative FFmpeg transcoding approach
Part 1: DaVinci Resolve Setup
Export Settings
1. In the Deliver page:
– Select “Individual Clips” for separate file export
– Use “Source Name” for filename
– Enable “Use unique filenames” if needed
– Set desired resolution (e.g., 1080p)
GPU Acceleration
1. Open **Preferences > System > Memory and GPU**
2. Select your GPU from available options
3. Configure Auto mode for optimal performance
4. Ensure proper CUDA/OpenCL drivers are installed
Part 2: Metadata Preservation Script
Complete Script
“`bash
#!/bin/bash
# Configuration
ORIGINAL_PATH=””
TARGET_PATH=””
LOGFILE=”metadata_transfer_log.txt”
# Function to display usage
show_usage() {
echo “Usage: $0 -i <input_folder> -o <output_folder>”
echo “Options:”
echo ” -i Input folder containing original MXF files”
echo ” -o Output folder containing transcoded files”
echo ” -h Show this help message”
exit 1
}
# Parse command line arguments
while getopts “i:o:h” opt; do
case $opt in
i) ORIGINAL_PATH=”$OPTARG”;;
o) TARGET_PATH=”$OPTARG”;;
h) show_usage;;
?) show_usage;;
esac
done
# Validate input and output paths
if [ -z “$ORIGINAL_PATH” ] || [ -z “$TARGET_PATH” ]; then
show_usage
fi
# Function to log messages
log_message() {
echo “[$(date ‘+%Y-%m-%d %H:%M:%S’)] $1” | tee -a “$LOGFILE”
}
# Function to extract MXF metadata
extract_mxf_metadata() {
local input_file=”$1″
local metadata_json=$(ffprobe -v quiet -print_format json -show_format -show_streams “$input_file”)
local creation_date=$(echo “$metadata_json” | jq -r ‘.format.tags.modification_date // empty’)
local timecode=$(echo “$metadata_json” | jq -r ‘.format.tags.timecode // empty’)
local company=$(echo “$metadata_json” | jq -r ‘.format.tags.company_name // empty’)
echo “{
\”creation_date\”: \”$creation_date\”,
\”timecode\”: \”$timecode\”,
\”company\”: \”$company\”
}”
}
# Function to verify timestamps
verify_timestamps() {
local file=”$1″
local expected_date=”$2″
log_message “Verifying timestamps for: $(basename “$file”)”
local creation_date=$(GetFileInfo -d “$file”)
log_message “File creation date: $creation_date”
local mod_date=$(stat -f “%Sm” “$file”)
log_message “File modification date: $mod_date”
local metadata=$(ffprobe -v quiet -print_format json -show_format “$file”)
log_message “Metadata dates:”
log_message “creation_time: $(echo “$metadata” | jq -r ‘.format.tags.creation_time // “Not found”‘)”
log_message “modification_time: $(echo “$metadata” | jq -r ‘.format.tags.modification_time // “Not found”‘)”
}
# Function to process a file pair
process_file_pair() {
local source_file=”$1″
local target_file=”$2″
local temp_file=”${target_file}.temp.mp4″
local metadata=$(extract_mxf_metadata “$source_file”)
local creation_date=$(echo “$metadata” | jq -r ‘.creation_date’)
local timecode=$(echo “$metadata” | jq -r ‘.timecode’)
local company=$(echo “$metadata” | jq -r ‘.company’)
log_message “Processing files:”
log_message “Source: $(basename “$source_file”)”
log_message “Target: $(basename “$target_file”)”
log_message “Creation date: $creation_date”
log_message “Timecode: $timecode”
ffmpeg -i “$target_file” -c copy \
-metadata creation_time=”$creation_date” \
-metadata modification_time=”$creation_date” \
-metadata CreateDate=”$creation_date” \
-metadata DateCreated=”$creation_date” \
-metadata DateTimeOriginal=”$creation_date” \
-metadata MediaCreateDate=”$creation_date” \
-metadata MediaModifyDate=”$creation_date” \
-metadata timecode=”$timecode” \
-metadata company=”$company” \
-movflags use_metadata_tags \
“$temp_file”
mv “$temp_file” “$target_file”
if [ ! -z “$creation_date” ]; then
local touch_date=$(date -j -f “%Y-%m-%dT%H:%M:%S” “${creation_date%.*}” “+%Y%m%d%H%M.%S” 2>/dev/null)
if [ ! -z “$touch_date” ]; then
touch -t “$touch_date” “$target_file”
local setfile_date=$(date -j -f “%Y-%m-%dT%H:%M:%S” “${creation_date%.*}” “+%m/%d/%Y %H:%M:%S”)
SetFile -d “$setfile_date” “$target_file”
log_message “Set file timestamps to: $creation_date”
fi
fi
verify_timestamps “$target_file” “$creation_date”
}
# Main execution
log_message “Starting metadata transfer process”
find “$ORIGINAL_PATH” -type f -iname “*.MXF” | while read -r source_file; do
base_name=$(basename “$source_file” .MXF)
target_file=$(find “$TARGET_PATH” -type f -name “${base_name}.*” ! -name “*.temp.*” | head -n 1)
if [ ! -z “$target_file” ]; then
process_file_pair “$source_file” “$target_file”
else
log_message “No matching file found for: $base_name”
fi
done
log_message “Metadata transfer complete”
“`
Setup Instructions
1. Save the script as `metadata_transfer.sh`
2. Make executable:
“`bash
chmod +x metadata_transfer.sh
“`
### Usage
“`bash
./metadata_transfer.sh -i “/path/to/original/MXF/files” -o “/path/to/transcoded/files”
“`
Part 3: FFmpeg Alternative
For users without DaVinci Resolve, here’s a complete FFmpeg transcoding command:
“`bash
ffmpeg -i input.mxf \
-c:v libx264 \
-preset slow \
-crf 18 \
-vf “scale=-2:1080” \
-c:a aac \
-b:a 320k \
-ac 2 \
output.mp4
“`
Best Practices
1. Always maintain original files
2. Test workflow with a few files first
3. Verify metadata transfer
4. Keep detailed logs
5. Use consistent naming conventions
Troubleshooting
Common issues and solutions:
1. **Missing metadata**
– Verify original file metadata exists
– Check file permissions
– Ensure proper ffmpeg/jq installation
2. **Timestamp mismatches**
– Verify timezone settings
– Check date format compatibility
– Ensure proper macOS tools installation
3. **File matching issues**
– Confirm consistent naming patterns
– Check for special characters
– Verify file extensions
Conclusion
Proper metadata preservation is essential for:
– Archival integrity
– Workflow efficiency
– Content management
– Legal compliance
– Historical accuracy
By following this guide and using the provided script, you can maintain critical metadata while optimizing your video files for ResourceSpace.
Additional Resources
– [FFmpeg Documentation](https://ffmpeg.org/documentation.html)
– [DaVinci Resolve Manual](https://www.blackmagicdesign.com/products/davinciresolve/training)
– [ResourceSpace Documentation](https://www.resourcespace.com/knowledge-base)
– [Video Metadata Standards](https://www.loc.gov/preservation/digital/formats/content/video_metadata.shtml)
—
This format should paste well into WordPress and retain clear headings, code blocks, and lists for optimal readability.