peasy-video 0.2.2

Rust client for PeasyVideo — video tools, glossary, and guides API
Documentation

peasy-video

crates.io docs.rs License: MIT crates.io GitHub stars

Async Rust client for the PeasyVideo API — calculate resolution, estimate bitrate, and analyze frame rates for video files. Built with reqwest, serde, and tokio.

Built from PeasyVideo, a comprehensive video processing toolkit offering free online tools for trimming, resizing, generating thumbnails, and creating GIFs from video files. The site includes in-depth guides on video codec selection, compression strategies for web delivery, and a glossary covering concepts from H.264 encoding and frame rates to container formats and color grading.

Try the interactive tools at peasyvideo.comVideo Resolution Calculator, Video Bitrate Calculator, Video Framerate Converter, and more.

Table of Contents

Install

[dependencies]
peasy-video = "0.2.0"
tokio = { version = "1", features = ["full"] }

Or via cargo:

cargo add peasy-video

Quick Start

use peasy_video::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();

    // List available video tools
    let tools = client.list_tools(&Default::default()).await?;
    for tool in &tools.results {
        println!("{}: {}", tool.name, tool.description);
    }

    Ok(())
}

What You Can Do

Video Analysis Tools

Digital video combines spatial resolution (the number of pixels in each frame) with temporal resolution (the number of frames displayed per second) to create the illusion of motion. A 1080p video at 30 fps produces 30 full 1920x1080 frames every second — over 62 million pixels per second of raw data. Codecs like H.264 (AVC) and H.265 (HEVC) use inter-frame prediction, motion compensation, and transform coding to compress this data by 100-1000x, while newer codecs like AV1 push efficiency even further at the cost of encoding time. PeasyVideo provides calculators and analysis tools for understanding these encoding parameters.

Tool Slug Description
Resolution Calculator video-resolution Calculate pixel counts, aspect ratios, and display dimensions
Bitrate Calculator video-bitrate Estimate file sizes for different bitrate and duration combinations
Framerate Converter video-framerate Analyze frame rate conversions and motion smoothness trade-offs
use peasy_video::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();

    // Get the resolution calculator for pixel and aspect ratio analysis
    let tool = client.get_tool("video-resolution").await?;
    println!("Tool: {}", tool.name);              // Video resolution calculator name
    println!("Description: {}", tool.description); // How resolution calculation works

    // List all available video tools with pagination
    let opts = peasy_video::ListOptions {
        page: Some(1),
        limit: Some(20),
        ..Default::default()
    };
    let tools = client.list_tools(&opts).await?;
    println!("Total video tools available: {}", tools.count);

    Ok(())
}

Learn more: Video Resolution Calculator · Video Codecs Explained · Video Compression for Web Delivery

Browse Reference Content

PeasyVideo includes a comprehensive glossary of video engineering terminology and practical guides for common workflows. The glossary covers foundational concepts like H.264 (the most widely deployed video codec, used in everything from Blu-ray discs to web streaming), frame rate (the number of individual frames displayed per second, typically 24 fps for cinema, 30 fps for broadcast TV, and 60 fps for gaming), container formats (MP4 and WebM wrap encoded video and audio streams into a single file), and color grading (the process of altering the color and tone of footage for creative or corrective purposes).

Term Description
AV1 AOMedia Video 1 — royalty-free codec with 30% better compression than H.265
Frame Rate Frames per second — 24 fps (cinema), 30 fps (broadcast), 60 fps (gaming)
Color Grading Creative color adjustment for tone, mood, and visual consistency
use peasy_video::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();

    // Browse the video glossary for codec and encoding terminology
    let glossary = client.list_glossary(&peasy_video::ListOptions {
        search: Some("codec".into()), // Search for video encoding concepts
        ..Default::default()
    }).await?;
    for term in &glossary.results {
        println!("{}: {}", term.term, term.definition);
    }

    // Read a guide explaining video codec selection and trade-offs
    let guide = client.get_guide("video-codecs-explained").await?;
    println!("Guide: {} (Level: {})", guide.title, guide.audience_level);

    Ok(())
}

Learn more: Video Glossary · Video Codecs Explained · Video Compression for Web Delivery

Search and Discovery

The API supports full-text search across all content types — tools, glossary terms, guides, use cases, and format documentation. Search results are grouped by content type, making it easy to find the right tool or reference for any video workflow.

use peasy_video::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();

    // Search across all video content — tools, glossary, guides, and formats
    let results = client.search("convert mp4", Some(20)).await?;
    println!("Found {} tools, {} glossary terms, {} guides",
        results.results.tools.len(),
        results.results.glossary.len(),
        results.results.guides.len(),
    );

    // Discover format conversion paths — what can WebM convert to?
    let conversions = client.list_conversions(&peasy_video::ListConversionsOptions {
        source: Some("webm".into()), // Find all formats WebM can be converted to
        ..Default::default()
    }).await?;
    for c in &conversions.results {
        println!("{} -> {}", c.source_format, c.target_format);
    }

    Ok(())
}

Learn more: REST API Docs · All Video Tools

API Client

The client wraps the PeasyVideo REST API with strongly-typed Rust structs using serde deserialization.

use peasy_video::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();
    // Or with a custom base URL:
    // let client = Client::with_base_url("https://custom.example.com");

    // List tools with filters
    let opts = peasy_video::ListOptions {
        page: Some(1),
        limit: Some(10),
        search: Some("trim".into()),
        ..Default::default()
    };
    let tools = client.list_tools(&opts).await?;

    // Get a specific tool
    let tool = client.get_tool("video-trim").await?;
    println!("{}: {}", tool.name, tool.description);

    // Search across all content
    let results = client.search("trim", Some(20)).await?;
    println!("Found {} tools", results.results.tools.len());

    // Browse the glossary
    let glossary = client.list_glossary(&peasy_video::ListOptions {
        search: Some("mp4".into()),
        ..Default::default()
    }).await?;
    for term in &glossary.results {
        println!("{}: {}", term.term, term.definition);
    }

    // Discover guides
    let guides = client.list_guides(&peasy_video::ListGuidesOptions {
        category: Some("video".into()),
        ..Default::default()
    }).await?;
    for guide in &guides.results {
        println!("{} ({})", guide.title, guide.audience_level);
    }

    // List format conversions
    let conversions = client.list_conversions(&peasy_video::ListConversionsOptions {
        source: Some("webm".into()),
        ..Default::default()
    }).await?;

    Ok(())
}

Available Methods

Method Description
list_tools(&opts) List tools (paginated, filterable)
get_tool(slug) Get tool by slug
list_categories(&opts) List tool categories
list_formats(&opts) List file formats
get_format(slug) Get format by slug
list_conversions(&opts) List format conversions
list_glossary(&opts) List glossary terms
get_glossary_term(slug) Get glossary term
list_guides(&opts) List guides
get_guide(slug) Get guide by slug
list_use_cases(&opts) List use cases
search(query, limit) Search across all content
list_sites() List Peasy sites
openapi_spec() Get OpenAPI specification

Full API documentation at peasyvideo.com/developers/. OpenAPI 3.1.0 spec: peasyvideo.com/api/openapi.json.

Learn More About Video Tools

Also Available

Language Package Install
Python peasy-video pip install "peasy-video[all]"
TypeScript peasy-video npm install peasy-video
Go peasy-video-go go get github.com/peasytools/peasy-video-go
Ruby peasy-video gem install peasy-video

Peasy Developer Tools

Part of the Peasy Tools open-source developer ecosystem.

Package PyPI npm crates.io Description
peasy-pdf PyPI npm crate PDF merge, split, rotate, compress — peasypdf.com
peasy-image PyPI npm crate Image resize, crop, convert, compress — peasyimage.com
peasy-audio PyPI npm crate Audio trim, merge, convert, normalize — peasyaudio.com
peasy-video PyPI npm crate Video trim, resize, thumbnails, GIF — peasyvideo.com
peasy-css PyPI npm crate CSS minify, format, analyze — peasycss.com
peasy-compress PyPI npm crate ZIP, TAR, gzip compression — peasytools.com
peasy-document PyPI npm crate Markdown, HTML, CSV, JSON conversion — peasyformats.com
peasytext PyPI npm crate Text case conversion, slugify, word count — peasytext.com

License

MIT