Skip to main content

Progress

A parsed progress snapshot from ffmpeg’s -progress pipe:1 output. This struct contains real-time information about the encoding process, including frame count, encoding speed, bitrate, and overall progress state.
frame
usize
Number of frames processed so far.
fps
f64
Current encoding speed in frames per second.
bitrate
isize
Current bitrate in bytes per second.
total_size
usize
Total output size in bytes.
out_time
Duration
Elapsed output time (position in the output stream).
dup_frames
usize
Number of duplicated frames.
drop_frames
usize
Number of dropped frames.
speed
f64
Encoding speed as a multiplier of realtime (e.g. 2.0 = 2x realtime).
progress
ProgressState
Whether ffmpeg is still processing or has finished.

Example

use libffmpeg::ffmpeg::progress::Progress;

// Progress is typically obtained from PartialProgress
// See PartialProgress example for usage

PartialProgress

Accumulator for parsing ffmpeg’s -progress pipe:1 output line by line. Feed lines via with_line(), then call finish() once a complete progress block has been received to produce a Progress snapshot.
frame
usize
default:"0"
Accumulated frame count.
fps
f64
default:"0.0"
Accumulated frames per second value.
bitrate
String
default:"\"\""
Accumulated bitrate string (e.g., “1234kbits/s”).
total_size
usize
default:"0"
Accumulated total output size.
out_time_us
u128
default:"0"
Accumulated output time in microseconds.
dup_frames
usize
default:"0"
Accumulated duplicated frame count.
drop_frames
usize
default:"0"
Accumulated dropped frame count.
speed
String
default:"\"\""
Accumulated speed string (e.g., “2.5x”).
progress
PartialProgressState
default:"Unset"
Current progress state.

Methods

with_line

pub fn with_line(&mut self, line: &str) -> bool
Feed a single key=value line from ffmpeg’s progress output. Returns true if the line was recognized (or intentionally ignored), false if the key was completely unknown.

finish

pub fn finish(&self) -> Option<Progress>
Attempt to produce a complete Progress snapshot from the accumulated state. Returns None if no progress= line has been received yet, or if the bitrate value could not be parsed.

Example

use libffmpeg::ffmpeg::progress::PartialProgress;

let mut partial = PartialProgress::default();
partial.with_line("frame=120");
partial.with_line("fps=30.00");
partial.with_line("progress=continue");

if let Some(progress) = partial.finish() {
    println!("frame={} fps={}", progress.frame, progress.fps);
}

ProgressState

The state reported in ffmpeg’s progress= line.

Variants

Continue
variant
ffmpeg is continuing to process the input. More progress updates are expected.
End
variant
ffmpeg has finished processing. This is the final progress update.
Unknown
variant
An unrecognized progress state was reported.Fields:
  • String - The raw, unrecognized state value

Example

use libffmpeg::ffmpeg::progress::ProgressState;

match progress.progress {
    ProgressState::Continue => println!("Still encoding..."),
    ProgressState::End => println!("Encoding complete!"),
    ProgressState::Unknown(ref s) => println!("Unknown state: {}", s),
}

PartialProgressState

Internal state tracking for PartialProgress accumulation.

Variants

Continue
variant
Progress state is set to “continue”.
End
variant
Progress state is set to “end”.
Unknown
variant
An unrecognized progress state value was encountered.Fields:
  • String - The raw, unrecognized state value
Unset
variant
No progress state has been set yet (initial state).

Build docs developers (and LLMs) love