I’ a little confused how to parse the duration and time component of the output of ffmpeg.
My goal is to approximate the percentage of a task completed.
The string representation of the duration of a video clip is displayed like so…
“00:01:26.42” which I assume is hours:minutes:seconds.hundreths of seconds.
If I Convert to DateTime with either of the following, I get “27/11/2020 00:01:26”
Convert.ToDateTime("00:01:26.42");
DateTime.Parse("00:01:26.42");
As you can see, the last unit of measurement (whatever that is), is not present.
I’d like to be as accurate as I can, as some operation can be short, and it’s only an approximation anyway.
Looking for some ideas.
Thanks for reading.
Timespan
OK, thanks guys. I’ve decided to just ignore the weird decimal at the end. and use TimeSpan.
https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings
https://docs.microsoft.com/en-us/dotnet/api/system.timespan
https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-timespan-format-strings
OK, thanks guys. I’ve decided to just ignore the weird decimal at the end. and use TimeSpan.
C# devs
null reference exceptions