ffmpeg_sidecar::log_parser

Function try_parse_duration

Source
pub fn try_parse_duration(string: &str) -> Option<f64>
Expand description

§Example:

use ffmpeg_sidecar::log_parser::try_parse_duration;
let line = "[info]   Duration: 00:00:05.00, start: 0.000000, bitrate: 16 kb/s, start: 0.000000, bitrate: N/A\n";
let duration = try_parse_duration(line);
println!("{:?}", duration);
assert!(duration == Some(5.0));

§Unknown duration

use ffmpeg_sidecar::log_parser::try_parse_duration;
let line = "[info]   Duration: N/A, start: 0.000000, bitrate: N/A\n";
let duration = try_parse_duration(line);
assert!(duration == None);