dftt_timecode#
Python timecode library for film and TV industry, with high frame rate support and comprehensive features.
DFTT stands for the Department of Film and TV Technology of Beijing Film Academy.
Features#
Multiple Timecode Format Support: SMPTE (DF/NDF), SRT, DLP (Cine Canvas), FFMPEG, FCPX, frame count, timestamp
High Frame Rate Support: Supports frame rates from 0.01 to 999.99 fps
Drop-Frame/Non-Drop-Frame: Strictly supports SMPTE DF/NDF formats
Extended Time Range: Currently supports time range from -99 to 99 hours
Strict Mode: 24-hour cycling mode that automatically converts timecodes outside the 0-24 hour range
High Precision: Internal storage using high-precision Fraction timestamps for accurate conversions
Rich Operators: Comprehensive support for arithmetic and comparison operations between timecodes and numbers
Installation#
pip install dftt_timecode
Quick Start#
from dftt_timecode import DfttTimecode
# Create a timecode object
tc = DfttTimecode('01:00:00:00', 'auto', fps=24, drop_frame=False, strict=True)
# Access properties
print(tc.type) # 'smpte'
print(tc.fps) # 24
print(tc.framecount) # 86400
print(tc.timestamp) # 3600.0
# Convert between formats
print(tc.timecode_output('srt')) # '01:00:00,000'
print(tc.timecode_output('ffmpeg')) # '01:00:00.00'
# Arithmetic operations
tc2 = DfttTimecode('00:30:00:00', 'auto', fps=24)
result = tc + tc2
print(result.timecode_output('smpte')) # '01:30:00:00'
# Comparison operations
print(tc > tc2) # True
Contents#
User Guide
API Reference
Development