Skip to content

CLI Reference

The StreamPack command-line interface provides comprehensive options for video conversion. This reference covers all available commands and options.

Basic Usage

streampack [OPTIONS] INPUT_FILE

Command Structure

streampack input.mp4 [options]
             ↑         ↑
       input file   configuration options

Global Options

Help and Information

--help, -h

Show help message and exit.

streampack --help

--version, -v

Show program version and exit.

streampack --version
# Output: streampack 1.0.0

--list-encoders

List all available video and audio encoders on your system.

streampack --list-encoders

Example output:

Available Encoders
┏━━━━━━━┳━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━┓
┃ Type  ┃ Category ┃ Codec             ┃ Name                     ┃ Selected ┃
┡━━━━━━━╇━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━┩
│ Video │ Hardware │ h264_videotoolbox │ VideoToolbox (macOS)     │ ✅       │
│ Video │ Software │ libx264           │ x264 Software            │          │
│ Audio │ Hardware │ aac_at            │ AudioToolbox AAC (macOS) │ ✅       │
└───────┴──────────┴───────────────────┴──────────────────────────┴──────────┘

--analyze-only

Analyze input file without performing conversion. Useful for checking video properties and optimal settings.

streampack input.mp4 --analyze-only

Input/Output Options

Input File

Required. Path to the input video file.

streampack /path/to/video.mp4
streampack "video with spaces.mov"

Supported formats: MP4, MKV, AVI, MOV, M4V, and other FFmpeg-supported formats.

--output, -o

Specify output directory. If not provided, uses input filename without extension.

# Output to specific directory
streampack input.mp4 --output streaming_files

# Output to current directory with custom name  
streampack input.mp4 --output ./my_stream

# Absolute path
streampack input.mp4 --output /var/www/streams/video1

Default behavior: - Input: movie.mp4 → Output: movie/ - Input: /path/video.mov → Output: /path/video/

Quality and Resolution Options

--resolutions, -r

Comma-separated list of resolutions to generate.

Available resolutions: 144p, 240p, 360p, 480p, 720p, 1080p, 1440p, 2160p

# Mobile-friendly resolutions
streampack input.mp4 --resolutions 360p,480p,720p

# High-quality streaming
streampack input.mp4 --resolutions 720p,1080p,1440p

# Single resolution
streampack input.mp4 --resolutions 1080p

# All available resolutions
streampack input.mp4 --resolutions 144p,240p,360p,480p,720p,1080p,1440p,2160p

Automatic Resolution Selection

If --resolutions is not specified, StreamPack automatically selects optimal resolutions based on your input video:

  • 4K input480p,720p,1080p,1440p,2160p
  • 1080p input360p,480p,720p,1080p
  • 720p input240p,360p,480p,720p

--preset, -p

Encoding speed vs quality preset.

Available presets: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow

# Fastest encoding (lower quality)
streampack input.mp4 --preset ultrafast

# Balanced speed/quality (default)
streampack input.mp4 --preset fast

# Best quality (slower encoding)
streampack input.mp4 --preset slow

Preset Comparison:

Preset Speed Quality Use Case
ultrafast ⚡⚡⚡⚡⚡ ⭐⭐ Quick previews, testing
fast ⚡⚡⚡⚡ ⭐⭐⭐⭐ Default, good balance
medium ⚡⚡⚡ ⭐⭐⭐⭐⭐ Web streaming
slow ⚡⚡ ⭐⭐⭐⭐⭐⭐ Archive quality

--crf

Constant Rate Factor for software encoding. Lower values = better quality.

Range: 0-51 (default: 23)

# Higher quality (larger files)
streampack input.mp4 --crf 18

# Standard quality  
streampack input.mp4 --crf 23

# Lower quality (smaller files)
streampack input.mp4 --crf 28

CRF Guidelines: - 18-22: Visually lossless quality - 23-25: High quality (default range)
- 26-30: Standard quality - 31+: Lower quality, smaller files

Performance Options

--workers, -w

Number of parallel processing workers.

# Use 4 parallel workers
streampack input.mp4 --workers 4

# Use all available CPU cores minus 1 (auto-detected)
streampack input.mp4  # Default behavior

# Single-threaded processing
streampack input.mp4 --workers 1

Guidelines: - Default: Auto-detects optimal workers (usually CPU cores - 1) - High-end systems: Can handle 6-8 workers - Limited memory: Use 2-4 workers - Network storage: Reduce workers to 2-3

--segment-duration

HLS segment duration in seconds.

# 2-second segments (better seeking, more files)
streampack input.mp4 --segment-duration 2

# 6-second segments (better compression, fewer files)  
streampack input.mp4 --segment-duration 6

# 10-second segments (lowest overhead)
streampack input.mp4 --segment-duration 10

Duration Trade-offs:

Duration Seeking Compression Network Files
2s ⚡ Fast 📊 Lower 🌐 Better 📁 More
6s ⚡ Medium 📊 Better 🌐 Medium 📁 Medium
10s ⚡ Slower 📊 Best 🌐 Higher latency 📁 Fewer

Recommendations: - Live streaming: 2-4 seconds - VOD streaming: 4-6 seconds
- Archive/download: 6-10 seconds

--gop-size

Group of Pictures (GOP) size. Affects seeking precision and compression.

# Better seeking (more keyframes)
streampack input.mp4 --gop-size 30

# Default (balanced)
streampack input.mp4 --gop-size 48

# Better compression (fewer keyframes)  
streampack input.mp4 --gop-size 120

GOP Size Guidelines: - 30 frames: Better seeking, larger files - 48 frames: Good balance (default) - 120 frames: Better compression, less precise seeking

Audio and Subtitle Options

--no-subtitles

Skip subtitle conversion entirely.

streampack input.mp4 --no-subtitles

--include-bitmap-subtitles

Include bitmap subtitle formats (PGS, DVD). Usually skipped because they require OCR.

streampack input.mp4 --include-bitmap-subtitles

Bitmap Subtitles

Bitmap subtitles (PGS, DVD) cannot be directly converted to WebVTT text format. This option will attempt conversion but may fail or produce empty subtitle files.

Configuration Options

--config, -c

Load settings from JSON configuration file.

streampack input.mp4 --config my_settings.json

Example configuration file:

{
  "segment_duration": 4,
  "preset": "medium",
  "crf": 20,
  "max_workers": 6,
  "convert_subtitles": true,
  "bitrate_profiles": [
    {
      "name": "720p",
      "resolution": [1280, 720],
      "max_bitrate_kbps": 2500,
      "min_bitrate_kbps": 1800
    }
  ]
}

--save-config

Save current settings to JSON file for reuse.

# Save current settings
streampack input.mp4 --preset medium --crf 20 --save-config my_settings.json

# Later, reuse the settings
streampack another_video.mp4 --config my_settings.json

Configuration Priority

Settings are applied in this order (later overrides earlier): 1. Default settings 2. Configuration file (--config) 3. Command-line arguments

Logging Options

--quiet, -q

Reduce output verbosity. Shows only essential information.

streampack input.mp4 --quiet

--debug

Enable detailed debug logging. Shows FFmpeg commands, detailed progress, and error traces.

streampack input.mp4 --debug

Debug output includes: - FFmpeg command lines - Encoder detection details - Detailed timing information - Full error stack traces - Step-by-step progress

Practical Examples

Quick Conversion Examples

# Convert with automatic settings
streampack movie.mp4

# Convert to specific directory
streampack movie.mp4 --output ./streaming

# Convert with custom resolutions
streampack movie.mp4 --resolutions 720p,1080p
# High quality for archive
streampack movie.mp4 --preset slow --crf 18

# Fast conversion for testing
streampack movie.mp4 --preset ultrafast

# Balanced quality/speed
streampack movie.mp4 --preset medium --crf 21
# Mobile-friendly streaming
streampack movie.mp4 \
  --resolutions 240p,360p,480p,720p \
  --segment-duration 2 \
  --preset fast

# Data-conscious settings  
streampack movie.mp4 \
  --resolutions 240p,360p,480p \
  --crf 26
# Maximum performance (if hardware allows)
streampack movie.mp4 --workers 8 --preset ultrafast

# Conservative resource usage
streampack movie.mp4 --workers 2 --preset fast

# Memory-constrained systems
streampack movie.mp4 --workers 1 --segment-duration 10

Advanced Workflows

# Convert all MP4 files
for file in *.mp4; do
  streampack "$file" --output "hls_${file%.mp4}" \
    --resolutions 720p,1080p \
    --preset medium
done
# Create reusable configuration
streampack sample.mp4 \
  --preset medium \
  --segment-duration 4 \
  --resolutions 720p,1080p,1440p \
  --save-config production.json \
  --analyze-only  # Don't actually convert

# Use configuration for production
streampack movie1.mp4 --config production.json
streampack movie2.mp4 --config production.json
# Analyze video without conversion
streampack movie.mp4 --analyze-only

# Check encoder capabilities
streampack --list-encoders

# Test with debug information
streampack sample.mp4 --debug --resolutions 720p

Exit Codes

The CLI returns different exit codes for scripting:

Code Meaning
0 Success
1 General error (file not found, conversion failed)
2 Invalid arguments
130 Interrupted by user (Ctrl+C)

Example usage in scripts:

if streampack movie.mp4 --quiet; then
  echo "Conversion successful"
  upload_to_cdn movie/
else
  echo "Conversion failed with code $?"
  exit 1
fi

Environment Variables

FFMPEG_BINARY

Override FFmpeg executable path:

export FFMPEG_BINARY="/usr/local/bin/ffmpeg"
streampack movie.mp4

HLS_CONVERTER_CONFIG

Default configuration file:

export HLS_CONVERTER_CONFIG="/etc/streampack/default.json"
streampack movie.mp4  # Uses default config automatically

Shell Completion

Enable tab completion for bash/zsh:

# Bash
eval "$(_HLS_CONVERTER_COMPLETE=source streampack)"

# Zsh  
eval "$(_HLS_CONVERTER_COMPLETE=source_zsh streampack)"

# Add to your shell profile for persistence
echo 'eval "$(_HLS_CONVERTER_COMPLETE=source streampack)"' >> ~/.bashrc

Common Patterns

Development Workflow

# Quick test conversion
streampack test.mp4 --preset ultrafast --resolutions 720p --quiet

# Production conversion  
streampack final.mp4 --config production.json --output /var/www/streams/

CI/CD Pipeline

#!/bin/bash
set -e  # Exit on error

# Validate input
streampack "$1" --analyze-only --quiet || exit 1

# Convert with error handling
streampack "$1" \
  --output "./dist/${1%.*}" \
  --config ci-config.json \
  --quiet || {
    echo "Conversion failed for $1" >&2
    exit 1
}

echo "Successfully converted $1"

Next Steps