AppleScript Automation Templates

Overview

Parallel Media Encoder includes an AppleScript dictionary with three commands:

  • transcode — convert a file with a preset or custom codec/quality
  • probe — inspect a file's metadata (returns JSON)
  • list presets — get all available encoding presets (returns JSON)

The app must be running for AppleScript commands to work. All transcode operations require a Pro license.


Setup

  1. Open Script Editor (Applications → Utilities → Script Editor).
  2. To browse the dictionary: File → Open Dictionary → select "Parallel Media Encoder".
  3. Write your script and click Run, or save as an application for one-click use.

Probe File Info

When to use: Check a file's codec, resolution, frame rate, and audio tracks before processing.

Probe File Info
-- Probe File Info.applescript
-- Inspect a media file and display its metadata.
-- Returns JSON with codec, resolution, frame rate, duration, and audio tracks.

set filePath to POSIX path of (choose file with prompt "Select a media file to inspect")

tell application "Parallel Media Encoder"
	set metadata to probe filePath
end tell

display dialog metadata with title "Media File Info" buttons {"Copy to Clipboard", "OK"} default button "OK"

if button returned of result is "Copy to Clipboard" then
	set the clipboard to metadata
	display notification "Metadata copied to clipboard" with title "Parallel Media Encoder"
end if

Note: Probe works without a Pro license.


Transcode with Preset

When to use: Quick exports using built-in presets like YouTube 4K H.265, ProRes 422 HQ, etc.

Transcode with Preset
-- Transcode with Preset.applescript
-- Transcode a file using one of PME's built-in presets.
--
-- Available presets include:
--   YouTube 1080p H.264, YouTube 1080p H.265, YouTube 4K H.265,
--   Vimeo 1080p, Vimeo 4K, Social Media 1080p,
--   Master H.264, Master H.265, Archive,
--   ProRes 422 Proxy/LT/422/HQ, ProRes 4444/4444 XQ,
--   DNxHR LB/SQ/HQ/HQX/444,
--   Quick Review, LucidLink

tell application "Parallel Media Encoder"
	set inputFile to "/Users/me/Videos/raw_footage.mxf"
	set outputFile to "/Users/me/Videos/Exports/raw_footage.mov"

	set result to transcode inputFile to outputFile using preset "YouTube 4K H.265"

	display notification "Export complete: " & result with title "Parallel Media Encoder"
end tell

Transcode with Custom Settings

When to use: Specific codec and quality control. Quality ranges from 0.0 (smallest file) to 1.0 (highest quality).

Transcode with Custom Settings
-- Transcode with Custom Settings.applescript
-- Transcode to a specific codec with custom quality.
--
-- Supported codecs:
--   h264, hevc, prores422proxy, prores422lt, prores422,
--   prores422hq, prores4444, prores4444xq,
--   dnxhr-lb, dnxhr-sq, dnxhr-hq, dnxhr-hqx, dnxhr-444
--
-- Quality: 0.0 (smallest file) to 1.0 (highest quality)

tell application "Parallel Media Encoder"
	set result to transcode "/Users/me/Videos/clip.mov" ¬
		to "/Users/me/Desktop/clip_hevc.mov" ¬
		using codec "hevc" ¬
		with quality 0.7

	display notification "Saved to: " & result with title "Parallel Media Encoder"
end tell

Batch Transcode Folder

When to use: Process all files of a specific type in a folder. Tracks success/failure counts. Customize the fileExtension and outputCodec variables.

Batch Transcode Folder
-- Batch Transcode Folder.applescript
-- Transcode all files of a given type in a folder.
-- Prompts for input and output folders, then processes each file.

set inputFolder to POSIX path of (choose folder with prompt "Select the folder with source files")
set outputFolder to POSIX path of (choose folder with prompt "Select the output folder")

-- Change this to match your source files: "mxf", "mov", "mp4", "braw", "r3d"
set fileExtension to "mxf"

-- Change this to your desired codec or preset
set outputCodec to "prores422hq"

tell application "System Events"
	set fileList to every file of folder inputFolder whose name extension is fileExtension
end tell

if (count of fileList) is 0 then
	display dialog "No ." & fileExtension & " files found in the selected folder." buttons {"OK"}
	return
end if

set successCount to 0
set failCount to 0

tell application "Parallel Media Encoder"
	repeat with f in fileList
		set fileName to name of f
		-- Strip extension from filename
		set baseName to text 1 thru ((offset of "." in fileName) - 1) of fileName
		set inputPath to inputFolder & fileName
		set outputPath to outputFolder & baseName & ".mov"

		try
			transcode inputPath to outputPath using codec outputCodec
			set successCount to successCount + 1
		on error errMsg
			set failCount to failCount + 1
			log "Failed: " & fileName & " — " & errMsg
		end try
	end repeat
end tell

set summary to (successCount as text) & " succeeded"
if failCount > 0 then
	set summary to summary & ", " & (failCount as text) & " failed"
end if

display notification summary with title "Batch Transcode Complete"

Watch Folder Action

When to use: Automatically transcode any video files dropped into a watched folder. Creates a "Transcoded" subfolder for output. See the Automator setup section below.

Watch Folder Action
-- Watch Folder Action.applescript
-- Auto-transcode files dropped into a folder.
--
-- To use as a Folder Action:
-- 1. Open Automator > New > Folder Action
-- 2. Set "Folder Action receives files added to:" to your watch folder
-- 3. Add a "Run AppleScript" action and paste this script
-- 4. Save the workflow
--
-- Or attach directly:
-- 1. Right-click a folder in Finder > Services > Folder Actions Setup
-- 2. Attach this script

on adding folder items to thisFolder after receiving addedItems
	set outputFolder to (POSIX path of thisFolder) & "Transcoded/"

	-- Create output subfolder if it doesn't exist
	do shell script "mkdir -p " & quoted form of outputFolder

	-- Supported file extensions
	set validExtensions to {"mxf", "mov", "mp4", "braw", "r3d", "mkv", "avi"}

	set processedCount to 0

	tell application "Parallel Media Encoder"
		repeat with addedItem in addedItems
			set inputPath to POSIX path of addedItem
			set fileName to name of (info for addedItem)
			set fileExt to name extension of (info for addedItem)

			-- Only process video files
			if validExtensions contains fileExt then
				set baseName to text 1 thru ((offset of "." in fileName) - 1) of fileName
				set outputPath to outputFolder & baseName & ".mov"

				try
					transcode inputPath to outputPath using codec "hevc" with quality 0.8
					set processedCount to processedCount + 1
				on error errMsg
					log "PME Watch Folder: Failed " & fileName & " — " & errMsg
				end try
			end if
		end repeat
	end tell

	if processedCount > 0 then
		display notification (processedCount as text) & " file(s) transcoded" with title "PME Watch Folder"
	end if
end adding folder items to

List Available Presets

When to use: Discover available presets and their settings. Returns a JSON array.

List Available Presets
-- List Available Presets.applescript
-- Get all encoding presets and display them.
-- Returns a JSON array you can parse or display.

tell application "Parallel Media Encoder"
	set presetJSON to list presets
end tell

display dialog presetJSON with title "Available Presets" buttons {"Copy to Clipboard", "OK"} default button "OK"

if button returned of result is "Copy to Clipboard" then
	set the clipboard to presetJSON
	display notification "Preset list copied to clipboard" with title "Parallel Media Encoder"
end if

Using with Automator

Step-by-step for creating the Watch Folder Action:

1

Open Automator

Launch Automator from Applications → Automator.

2

Create a Folder Action

Choose New Document → select Folder Action.

3

Set your watch folder

At the top, set “Folder Action receives files and folders added to” and choose your watch folder.

4

Add a Run AppleScript action

From the actions library, drag Run AppleScript into the workflow.

5

Paste the script

Replace the default script with the Watch Folder Action code above.

6

Save the workflow

File → Save and name your workflow (e.g., “PME Auto Transcode”).

7

Test it

Drop a video file into the folder to verify it works.

The folder action runs automatically whenever new files appear in the watched folder.


Using with Shortcuts

Parallel Media Encoder also provides native Shortcuts actions:

  • Transcode Media File — with codec, preset, and quality parameters
  • Probe Media File — returns JSON metadata
  • List Encoding Presets — returns preset names

Open the Shortcuts app, create a new shortcut, and search for "Parallel Media Encoder" in the actions list. You can also trigger these via Siri:

"Transcode a file with Parallel Media Encoder"

"Get video info with Parallel Media Encoder"