Introduction

In modern media production, working with high-resolution footage has become the standard. Whether it’s 4K, 6K, or even 8K RAW files from cameras like RED, ARRI, or Blackmagic, the sheer size of these files presents significant challenges for editing workflows. Editors need lightweight proxy files to work efficiently, while the original high-resolution masters are safely archived.

P5 Archive offers a powerful yet often overlooked feature: custom preview converter scripts. This capability allows organizations to automatically generate proxy files during the archiving process, seamlessly integrating archive and production workflows.

In this article, we introduce a flexible proxy generator script that leverages this feature to create both P5 browser previews and workflow-ready editing proxies in a single automated process.

The Challenge: Bridging Archive and Edit Workflows

Media production facilities typically face a common dilemma:

  • RAW footage arrives from set and needs to be archived for safety
  • Proxy files need to be created for the editing team
  • Preview files are needed for browsing the archive in P5
  • These processes are often handled separately, leading to duplicated effort and potential inconsistencies

The traditional approach involves multiple manual steps: ingesting footage, running a separate transcoding application, organizing proxy files, and then archiving the originals. This workflow is time-consuming, error-prone, and doesn’t scale well for larger productions.

The Solution: Integrated Proxy Generation in P5

P5 Archive’s preview converter feature allows custom scripts to be executed during the archiving process. Our proxy generator script takes full advantage of this capability, offering:

  • Dual-output generation: Create both P5 browser previews and high-quality workflow proxies simultaneously
  • Flexible path mapping: Automatically organize proxy files in your existing project structure
  • Single-encode optimization: When the same quality works for both purposes, only one encoding pass is needed
  • Seamless integration: Works within P5’s existing preview infrastructure

How It Works

Basic Concept

When P5 Archive processes a video file, it can call an external script to generate a preview. Our script extends this concept:

  • P5 passes the source file path to the script
  • The script generates one or two proxy files (depending on configuration)
  • Workflow proxies are stored in a configurable location
  • A preview file path is returned to P5 for browser display

Configuration Overview

The script is controlled entirely through a configuration header, no command-line parameters are needed. This makes it easy to set up different configurations for different archive plans.

Configuration Parameters

The script header contains all configurable options:
P5 Preview Settings

ENABLE_P5_PREVIEW=true # Return a preview to P5 (false = dummy image)
P5_PREVIEW_SOURCE="preview" # preview | workflow (which quality to use)

Workflow Proxy Settings

ENABLE_WORKFLOW_STORE=true # Store a proxy in workflow location
WORKFLOW_STORE_SOURCE="workflow" # preview | workflow (which quality to use)

FFmpeg Configuration

FFMPEG_PATH="" # Custom FFmpeg (empty = P5 built-in)
# Example: /usr/local/bin/ffmpeg

The script supports two FFmpeg variants:

  • P5 built-in FFmpeg (libopenh264): Limited options, bitrate control only
  • Custom FFmpeg (libx264): Better quality, more control through CRF, preset and tune options

Workflow Path Configuration

WORKFLOW_PROJECT_FOLDER="" # Step 1: Marker folder (empty = skip)
WORKFLOW_NEW_BASE="" # Step 1: New base path
WORKFLOW_REMOVE_LEVELS=1 # Step 2: Directories to remove (0 = skip)
WORKFLOW_REPLACE_WITH="proxies" # Step 3: Path to append (empty = skip)

Preview Quality Settings (for P5 browser – speed optimized)

PREVIEW_SCALE="320"                 # Width in pixels (height proportional)
PREVIEW_ABITRATE="64k" # Audio bitrate
PREVIEW_CODEC="h264" # h264 | prores | dnxhd

# P5 built-in FFmpeg (libopenh264):
PREVIEW_VBITRATE="256k" # Video bitrate

# Custom FFmpeg (libx264):
PREVIEW_CRF="28" # Quality (higher = smaller, range 18-32)
PREVIEW_PRESET="veryfast" # ultrafast|veryfast|fast|medium
PREVIEW_TUNE="fastdecode" # fastdecode|zerolatency|film (empty = none)

Workflow Quality Settings (for editing – quality optimized)

WORKFLOW_SCALE="1920"               # Width in pixels (height proportional)
WORKFLOW_ABITRATE="128k" # Audio bitrate
WORKFLOW_CODEC="h264" # h264 | prores | dnxhd

# P5 built-in FFmpeg (libopenh264):
WORKFLOW_VBITRATE="5000k" # Video bitrate

# Custom FFmpeg (libx264):
WORKFLOW_CRF="18" # Quality (lower = better, range 16-23)
WORKFLOW_PRESET="medium" # fast|medium|slow|veryslow
WORKFLOW_TUNE="" # film|animation (empty = none)

Quality Definitions

Two quality levels can be defined independently:

  • Preview Quality (optimized for P5 browser): Small file size for fast loading, lower resolution (e.g., 320px width), lower bitrate (e.g., 256 kbps).
  • Workflow Quality (optimized for editing): Higher resolution (e.g., 1920px width), higher bitrate (e.g., 5 Mbps), suitable for offline editing in Premiere, Final Cut, DaVinci Resolve, etc.

Typical Use Cases

Use Case 1: P5 Preview Only (Default Behavior)

For organizations that only need previews for browsing the P5 archive:

ENABLE_P5_PREVIEW=true
P5_PREVIEW_SOURCE="preview"
ENABLE_WORKFLOW_STORE=false

Result: One small preview file is generated and returned to P5.

Use Case 2: Workflow Proxies Only

For facilities with existing preview solutions but needing automated proxy generation:

ENABLE_P5_PREVIEW=false
ENABLE_WORKFLOW_STORE=true
WORKFLOW_STORE_SOURCE="workflow"

Result: High-quality proxies are stored in the configured location. P5 receives a placeholder image.

Use Case 3: Single Proxy for Both Purposes

When workflow requirements are modest and one quality level serves both needs:

ENABLE_P5_PREVIEW=true
P5_PREVIEW_SOURCE="workflow"
ENABLE_WORKFLOW_STORE=true
WORKFLOW_STORE_SOURCE="workflow"

Result: One encoding pass creates a proxy that’s both stored for editing and returned to P5.

Use Case 4: Separate Qualities (Full Feature)

For maximum flexibility with different requirements for browsing vs. editing:

ENABLE_P5_PREVIEW=true
P5_PREVIEW_SOURCE="preview"
ENABLE_WORKFLOW_STORE=true
WORKFLOW_STORE_SOURCE="workflow"

Result: Two encoding passes create optimized files for each purpose.

Intelligent Path Mapping

One of the most powerful features is the flexible path configuration. The script can automatically organize proxy files to match your existing project structure.

Three Independent Operations

The destination path is built through three configurable steps:

Step 1 – Base Path Replacement: Replace the storage location while preserving project structure.

Step 2 – Directory Level Removal: Remove a specified number of directories from the path (e.g., remove “Camera_Raw” to place proxies at project level).

Step 3 – Path Appending: Add a new directory component (e.g., “Proxies”).

Practical Example 1: Different Storage for Proxies

Consider footage stored on a high-speed RAW storage:

Source:

/Volumes/RAW_Storage/Projects/2024/BMW_Commercial/Footage/A-Cam/A001C003.mov

Configuration:

WORKFLOW_PROJECT_FOLDER="Projects"
WORKFLOW_NEW_BASE="/Volumes/Proxy_Storage"
WORKFLOW_REMOVE_LEVELS=1
WORKFLOW_REPLACE_WITH="Proxies"

Result:

/Volumes/Proxy_Storage/Projects/2024/BMW_Commercial/Footage/Proxies/A001C003.mp4

This maintains the project structure while keeping proxies organized on separate (potentially slower/cheaper) storage.

Practical Example 2: Proxies Next to Source Footage

Source:

/Volumes/Production/2024/Documentary/Camera_Raw/Day01/B001.mov

Configuration:

WORKFLOW_PROJECT_FOLDER=""
WORKFLOW_NEW_BASE=""
WORKFLOW_REMOVE_LEVELS=1
WORKFLOW_REPLACE_WITH="Proxies"

Result:

/Volumes/Production/2024/Documentary/Camera_Raw/Proxies/B001.mp4

Technical Details

Codec Support

The script is designed to work with P5’s built-in FFmpeg, which uses the OpenH264 encoder. This provides broad compatibility with editing software, hardware-accelerated playback on most systems, and reasonable file sizes for proxy workflows.

For facilities requiring professional codecs like Apple ProRes or Avid DNxHD, an external FFmpeg installation with appropriate codec support can be configured.

Custom FFmpeg with libx264

When a custom FFmpeg with libx264 support is configured, advanced encoding options become available:

  • CRF (Constant Rate Factor): Constant quality instead of fixed bitrate
  • Presets: From “ultrafast” (fast, larger files) to “veryslow” (slow, smallest files)
  • Tune: Optimization for specific content (e.g., “fastdecode” for fast playback)

The script automatically detects whether libx264 is available and selects the appropriate options.

Automatic Cleanup

Preview proxies are stored in P5’s temp directory and automatically cleaned up on server restart. Workflow proxies remain in their configured location as permanent files for the editing team.

Debug Mode

A built-in debug mode helps troubleshoot path mapping and encoding issues. When enabled, detailed information about each processing step is written to the log file:

DEBUG_MODE=true

Installation and Setup

Note: Before proceeding with the installation, please read the disclaimer at the end of this article.
On the Server (macOS/Linux)

Step 1: Create a scripts directory in the P5 home directory (typically /usr/local/aw):

sudo mkdir /usr/local/aw/scripts

Step 2: Copy the script to this directory:

sudo cp p5_proxy_generator.sh /usr/local/aw/scripts/

Step 3: Grant execute privileges to the script:

sudo chmod +x /usr/local/aw/scripts/p5_proxy_generator.sh

In the P5 Browser

Step 4: Open your Archive Plan and navigate to the Previews section. Click ‘New’ below the list of Preview Generators and select ‘Add a custom script’ from the dropdown menu. Assign the script by entering the relative path:

scripts/p5_proxy_generator.sh

Step 5: Add the appropriate file extensions to this preview generator, for example:

  • .mov
  • .mp4
  • .mxf
  • .avi

Configuration

Step 6: Edit the script header to match your requirements:

  • Set quality parameters for preview and workflow proxies
  • Configure path mapping for your storage infrastructure
  • Enable/disable P5 preview and workflow storage as needed
  • Optional: Configure a custom FFmpeg for advanced encoding options

Testing

Step 7: Archive a few test files and verify:

  • Preview appears correctly in P5 browser
  • Workflow proxy is created in the expected location
  • Log file shows successful processing (check /usr/local/aw/log/proxy_generator.log)

Best Practices

Storage Considerations

Place workflow proxies on storage accessible to your editing systems. Consider network bandwidth when choosing proxy bitrates. Use faster storage for frequently accessed proxies.

Quality Settings

Match proxy resolution to your offline editing resolution. For 4K projects, 1080p or 720p proxies typically suffice. Higher bitrates improve scrubbing performance but increase storage needs.

Path Organization

Maintain consistent folder structures across projects. Use the path mapping feature to separate proxies from original media. Consider using separate storage volumes for proxies vs. camera originals.

Fazit

Automating proxy generation as part of the archiving workflow eliminates manual steps, ensures consistency, and bridges the gap between archive and production systems. P5 Archive’s custom preview converter feature, combined with a well-designed script, transforms a complex multi-step process into a seamless, automated workflow.

The proxy generator script presented here provides the flexibility to handle various production scenarios—from simple preview-only setups to sophisticated dual-output configurations with intelligent path mapping. By integrating proxy generation into the archive workflow, media facilities can improve efficiency, reduce errors, and ensure editors always have the proxy files they need, exactly where they need them.


Disclaimer: This script is provided “as is” without warranty of any kind, express or implied. Archiware makes no guarantees regarding functionality, completeness, or fitness for a particular purpose. Use at your own risk. Archiware shall not be liable for any direct or indirect damages, data loss, or other impairments arising from the use of this script.

Support: As this script relies on external components such as FFmpeg and its scope falls outside our software and responsibility, we are unable to provide technical support for its use. However, we welcome any feedback and suggestions for improvement – please contact us at support@archiware.com.

We recommend thoroughly testing the script in a test environment before production use.

Automating Proxy Generation for Media Workflows with P5 Archive
de_DE