I found the NReco.VideoInfo library to be the best option and simpler
1] Find the NReco.VideoInfo library in NuGet Package Manager and import it in your project
2] After that import the namespace "using NReco.VideoInfo"
3] Add the below line of code into the method.
var ffProbe = new FFProbe();
var videoInfo = ffProbe.GetMediaInfo(blob.Uri.AbsoluteUri);
return videoInfo.Duration.TotalMilliseconds;
here you can see some other option