ffmpeg_sidecar::log_parser

Function parse_time_str

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

Parse a time string in the format HOURS:MM:SS.MILLISECONDS into a number of seconds.

https://trac.ffmpeg.org/wiki/Seeking#Timeunitsyntax

ยงExamples

use ffmpeg_sidecar::log_parser::parse_time_str;
assert!(parse_time_str("00:00:00.00") == Some(0.0));
assert!(parse_time_str("5") == Some(5.0));
assert!(parse_time_str("0.123") == Some(0.123));
assert!(parse_time_str("1:00.0") == Some(60.0));
assert!(parse_time_str("1:01.0") == Some(61.0));
assert!(parse_time_str("1:01:01.123") == Some(3661.123));
assert!(parse_time_str("N/A") == None);