Crate rust_ffplay

Source
Expand description

Safe and idiomatic Rust wrapper for FFplay

This crate provides a high-level, safe interface to FFplay functionality, allowing you to play multimedia files with various options.

§Examples

§Basic playback

use ffplay_rs::FFplayBuilder;

// Play a video file
let mut player = FFplayBuilder::play("video.mp4")
    .spawn()
    .await?;

// Wait for playback to complete
player.wait().await?;

§Advanced usage

use ffplay_rs::{FFplayBuilder, ShowMode};
use ffplay_rs::playback::SyncType;
use ffmpeg_common::{Duration, StreamSpecifier};

// Play with custom options
let mut player = FFplayBuilder::new()?
    .input("https://example.com/stream.m3u8")
    .size(1280, 720)
    .fullscreen(false)
    .window_title("My Stream")
    .seek(Duration::from_secs(30))
    .duration(Duration::from_secs(120))
    .volume(75)
    .audio_stream(StreamSpecifier::Index(1))
    .sync(SyncType::Audio)
    .autoexit(true)
    .spawn()
    .await?;

// Kill the player after some time
tokio::time::sleep(std::time::Duration::from_secs(10)).await;
player.kill().await?;

§Audio visualization

use ffplay_rs::{FFplayBuilder, ShowMode};

// Play audio with waveform visualization
let mut player = FFplayBuilder::play("audio.mp3")
    .show_mode(ShowMode::Waves)
    .window_title("Audio Player")
    .spawn()
    .await?;

player.wait().await?;

Re-exports§

pub use builder::FFplayBuilder;
pub use builder::FFplayProcess;
pub use display::DisplayOptions;
pub use playback::PlaybackOptions;
pub use playback::SyncType;
pub use types::HwAccelOptions;
pub use types::KeyBinding;
pub use types::MouseAction;
pub use types::PlaybackState;
pub use types::ShowMode;
pub use types::VisualizationType;
pub use types::VulkanOptions;
pub use types::WindowState;

Modules§

builder
display
playback
prelude
Prelude module for convenient imports
scenarios
Common playback scenarios
types
utils
Helper utilities

Structs§

Capabilities
Capabilities detection for FFmpeg tools
Duration
Represents a duration in FFmpeg format (HH:MM:SS.MS or seconds)
MediaPath
Input or output file/URL
Version
Version information for the FFmpeg suite

Enums§

Error
Main error type for FFmpeg suite operations
LogLevel
Log level for FFmpeg tools
StreamSpecifier
Represents a stream specifier in FFmpeg
StreamType
Stream type

Functions§

capabilities
Get FFplay capabilities
get_version
Get version information for an FFmpeg executable
is_available
Check if FFplay is available
play
Play a media file with default settings
play_audio
Play audio only
play_fullscreen
Play in fullscreen
version
Get FFplay version

Type Aliases§

Result
Result type for FFmpeg suite operations