Mastering Event Hooks: Automating your Cam Software Workflow guide illustration
⏱️ 3 min read

Mastering Event Hooks: Automating your Cam Software Workflow


Table of Contents

Cam Software isn’t just a recorder; it’s an automation engine. By using Event Hooks, you can trigger actions the exact moment a recording starts or finishes. This guide covers how to set up webhooks and local scripts for a professional, hands-off workflow.

1. What are Event Hooks?

Event hooks are signals sent by Cam Software when a specific state change occurs. The two most important events are:

  • on_start: Triggered when a stream is detected and recording begins.
  • on_stop: Triggered when a stream ends or the connection drops.

2. Setting up Discord Webhooks

The simplest way to monitor your rig is via Discord. You can get an instant notification on your phone whenever a high-priority model goes live.

  1. In Discord, go to Server Settings > Integrations > Webhooks.
  2. Create a new webhook and copy the URL.
  3. In Cam Software’s config.json (or the Settings UI), paste the URL into the Webhook field under the global or model-specific configuration.

Cam Software will send a payload containing the model name, site, and timestamp automatically.

3. Executing Local Scripts

For advanced users, Cam Software can run a shell script or executable on your PC. This is powerful for moving files or starting post-processing.

Example: Auto-Move to NAS (Windows .bat) Create move_file.bat:

@echo off
set FILENAME=%1
move "%FILENAME%" "\\MY-NAS\Recordings\Archive\"

In Cam Software, set your on_stop hook command to: C:\scripts\move_file.bat %f (where %f is the placeholder for the file path).

4. Advanced Post-Processing with FFmpeg

Want to automatically generate a preview GIF or compress the recording? Use a Python script as a hook.

Example: Create 10s Preview (Python)

import sys
import subprocess
import os

file_path = sys.argv[1] # Path passed by Cam Software
output_path = file_path.replace(".mp4", "_preview.mp4")

# Run FFmpeg to grab a 10s clip from the 1-minute mark
cmd = [
    "ffmpeg", "-ss", "00:01:00", "-t", "10", 
    "-i", file_path, "-c", "copy", output_path
]
subprocess.run(cmd)

5. Best Practices

  • Async is Key: Cam Software runs hooks asynchronously, so they won’t block other recordings. However, ensure your script doesn’t consume 100% CPU and starve the encoder.
  • Error Logging: Always redirect script output to a log file (>> log.txt) so you can troubleshoot if a hook fails silently.
  • Path Handling: Always use double quotes around file paths ("%f") to handle spaces in model names or folder structures.

By mastering event hooks, you can transform your recording rig into a fully automated archival machine.

Related guides

Rate this guide

Loading ratings...

Was this guide helpful?

Comments