技能 编程开发 TechSmith视频自动化工作流模式

TechSmith视频自动化工作流模式

v20260423
techsmith-sdk-patterns
本指南提供了一套基于PowerShell和COM API的TechSmith自动化模式。它包含Snagit屏幕捕获工厂模式,用于标准化截图采集,以及Camtasia批处理渲染功能。这些模式适用于构建完整的、自动化程度高的视频内容生产管线,实现从捕获到渲染的全流程自动化。
获取技能
148 次下载
概览

TechSmith Sdk Patterns

Overview

Production patterns for TechSmith COM API: capture factories, output configuration, and batch processing.

Instructions

Step 1: Capture Factory Pattern

function New-SnagitCapture {
    param(
        [ValidateSet('Desktop', 'Window', 'Region')]
        [string]$InputType = 'Window',
        [ValidateSet('PNG', 'JPEG', 'BMP', 'GIF')]
        [string]$Format = 'PNG',
        [string]$OutputDir = "C:\Screenshots",
        [bool]$Preview = $false
    )

    $inputMap = @{ Desktop = 0; Window = 4; Region = 2 }
    $formatMap = @{ PNG = 3; JPEG = 4; BMP = 0; GIF = 2 }

    $capture = New-Object -ComObject Snagit.ImageCapture
    $capture.Input = $inputMap[$InputType]
    $capture.Output = 2  # File
    $capture.OutputImageFile.FileType = $formatMap[$Format]
    $capture.OutputImageFile.Directory = $OutputDir
    $capture.OutputImageFile.Filename = "capture_$(Get-Date -Format 'yyyyMMdd_HHmmss')"
    $capture.EnablePreview = $Preview

    return $capture
}

# Usage
$cap = New-SnagitCapture -InputType Window -Format PNG
$cap.Capture()

Step 2: Batch Camtasia Rendering

function Invoke-CamtasiaBatchRender {
    param(
        [string[]]$ProjectFiles,
        [string]$OutputDir,
        [string]$Preset = "MP4 - Smart Player (up to 1080p)"
    )

    $producer = "C:\Program Files\TechSmith\Camtasia 2025\CamtasiaProducer.exe"
    $results = @()

    foreach ($project in $ProjectFiles) {
        $name = [System.IO.Path]::GetFileNameWithoutExtension($project)
        $output = Join-Path $OutputDir "$name.mp4"

        $proc = Start-Process -FilePath $producer -ArgumentList @(
            "/i", "`"$project`"",
            "/o", "`"$output`"",
            "/preset", "`"$Preset`""
        ) -Wait -PassThru

        $results += @{ File = $name; ExitCode = $proc.ExitCode }
    }
    return $results
}

Error Handling

PatternUse CaseBenefit
Factory functionDifferent capture typesConsistent configuration
Batch renderingMultiple projectsAutomated pipeline
Timestamped namesAvoid overwritesUnique filenames

Resources

Next Steps

Apply patterns in techsmith-core-workflow-a.

信息
分类 编程开发
名称 techsmith-sdk-patterns
版本 v20260423
大小 2.74KB
更新时间 2026-04-28
语言