Are you looking for a way to automatically track and save timestamps for your OBS scenes during streams or recordings? Whether you're a content creator managing gaming streams, podcasts and interviews, tutorials and reviews, tarot and astrology readings, or any other type of live or recorded content, this Python script will streamline the process. No more manual logging of scene changes—this script will generate a detailed timestamp file when you stop streaming or recording.
Why Automate Scene Timestamps?
Tracking scene transitions is crucial for organizing content, especially when you review your footage or create time-based highlights. Manual tracking can be tedious, and OBS doesn’t have a built-in feature to log timestamps in a user-friendly way. That's where automation comes in.
With this Python script, timestamps are logged and saved as a text file automatically, making the post-production process much smoother. And, it even generates hashtags that are useful for astrologers or tarot readers, making the script perfect for niche content creators!
How the Script Works
This Python script integrates seamlessly with OBS, capturing when scenes change and logging their durations. When the stream or recording ends, a timestamp file is generated and saved to your desktop. Here's a breakdown of how the script works:
- Scene Tracking: The script captures each scene name and its duration during the stream or recording session.
- Hashtag Generation: The script adds pre-configured hashtags, like
#tarot #astrology #allsigns #tarotreading #love #lovereading
, to the timestamp file. - Timestamps and Total Duration: For each scene, a starting timestamp is logged, and once the session ends, the total stream/recording time is appended at the bottom of the file.
- Output: The result is a well-organized text file saved to your desktop, containing a breakdown of each scene's start time and the total session duration.
The Python Script: "timestamps.py"
import os
import datetime
# Generate timestamp file on stop
def generate_timestamp_file(mode):
global scene_history, start_time
# Automatically get the desktop path for the current user
desktop_path = os.path.join(os.path.expanduser("~"), "Desktop")
timestamp = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
filename = os.path.join(desktop_path, f"timestamps_{timestamp}.txt")
total_duration = time.time() - start_time
total_duration_str = time.strftime("%H:%M:%S", time.gmtime(total_duration))
with open(filename, 'w') as f:
# Write hashtags
f.write("#tarot #astrology #allsigns #tarotreading #love #lovereading\n\n")
# Calculate starting time for each scene
accumulated_time = 0
for i, (scene_name, duration) in enumerate(scene_history):
start_time_str = time.strftime("%H:%M:%S", time.gmtime(accumulated_time))
f.write(f"{scene_name}: {start_time_str}\n")
accumulated_time += duration
# Add total duration after a blank line
f.write("\n")
if mode == "stream":
f.write(f"Total stream time: {total_duration_str}\n")
else:
f.write(f"Total recording time: {total_duration_str}\n")
print(f"Timestamps saved to {filename}")
Setting It Up
Why This Script Stands Out
- Automation: No manual effort is required—once set up, the script runs in the background and logs your timestamps automatically.
- User-Friendly: The timestamp file is saved directly to your desktop for easy access.
- Versatile: It works for both streams and recordings, ensuring you never miss out on logging important scene transitions.
Conclusion
Whether you're livestreaming games, podcasts, tarot readings, astrology sessions, educational material, or doing live or recorded content creation of any kind, this Python script helps you keep track of your scene transitions effortlessly. With timestamps and total durations neatly organized, you can easily revisit key moments in your streams or recordings.
Integrate this automation into your OBS workflow and let the script handle the heavy lifting for you!