By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,953 Members | 1,143 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,953 IT Pros & Developers. It's quick & easy.

get Lengh video. as HH:MM:SS:FF

P: 1
Hi all, i am new babie in vb.net.I use mediainfo to get lengh video and display as HH:MM:SS, so can i display it as HH:MM:SS:FF, thanks all advance.
Sep 15 '16 #1
Share this Question
Share on Google+
2 Replies


IronRazer
P: 82
You could use an axWindowsMediaPlayer control to get the length of a video as a Double type value. Then use the TimeSpan class to get a String formatted as "HH:MM:SS". You could modify the example to format it to include milliseconds too if needed.

I am not sure what the "FF" stands for in your post so, i`m not sure what to tell you for that.

Also, you will want to test any video formats that you want to use this for. The axWindowsMediaPlayer control may not support some video formats.

Expand|Select|Wrap|Line Numbers
  1. Public Class Form1
  2.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  3.         AxWindowsMediaPlayer1.URL = "C:\test\vids\cc.avi"
  4.     End Sub
  5.  
  6.     Private Sub AxWindowsMediaPlayer1_StatusChange(sender As Object, e As EventArgs) Handles AxWindowsMediaPlayer1.StatusChange
  7.         If AxWindowsMediaPlayer1.status.ToLower.Contains("playing") Then
  8.             AxWindowsMediaPlayer1.Ctlcontrols.stop()
  9.             Dim ts As TimeSpan = TimeSpan.FromSeconds(AxWindowsMediaPlayer1.currentMedia.duration)
  10.             Me.Text = If(ts.ToString.Contains("."), ts.ToString.Remove(ts.ToString.IndexOf(".")), ts.ToString).ToString
  11.         End If
  12.     End Sub
  13. End Class
  14.  
Oct 10 '16 #2

!NoItAll
100+
P: 296
FF is Frames and will vary depending upon the frame-rate of the video. Also - if working with 59.94 don't forget to account for drop-frame.
Oct 11 '16 #3

Post your reply

Sign in to post your reply or Sign up for a free account.